mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
ref: Remove board types, refactoring
This commit is contained in:
parent
d39da61295
commit
5cd025ffb7
182 changed files with 1573 additions and 1239 deletions
|
@ -1,11 +1,24 @@
|
|||
const valuesValidator = (value) => {
|
||||
if (!_.isPlainObject(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_.isPlainObject(value.card)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_.isPlainObject(value.label)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
label: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
card: {
|
||||
values: {
|
||||
type: 'ref',
|
||||
custom: valuesValidator,
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
|
@ -18,15 +31,18 @@ module.exports = {
|
|||
},
|
||||
|
||||
async fn(inputs) {
|
||||
const { values } = inputs;
|
||||
|
||||
const cardLabel = await CardLabel.create({
|
||||
cardId: inputs.card.id,
|
||||
labelId: inputs.label.id,
|
||||
...values,
|
||||
cardId: values.card.id,
|
||||
labelId: values.label.id,
|
||||
})
|
||||
.intercept('E_UNIQUE', 'labelAlreadyInCard')
|
||||
.fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${inputs.card.boardId}`,
|
||||
`board:${values.card.boardId}`,
|
||||
'cardLabelCreate',
|
||||
{
|
||||
item: cardLabel,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue