1
0
Fork 0
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:
Maksim Eltyshev 2022-12-26 21:10:50 +01:00
parent d39da61295
commit 5cd025ffb7
182 changed files with 1573 additions and 1239 deletions

View file

@ -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,