mirror of
https://github.com/plankanban/planka.git
synced 2025-07-22 14:49:43 +02:00
Add validation to background field
This commit is contained in:
parent
ab83d7c9ab
commit
99d9ab4a9e
10 changed files with 130 additions and 25 deletions
|
@ -15,9 +15,35 @@ module.exports = {
|
|||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
},
|
||||
// TODO: add validation
|
||||
background: {
|
||||
type: 'json',
|
||||
custom: (value) => {
|
||||
if (_.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!_.isPlainObject(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Project.BACKGROUND_TYPES.includes(value.type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
value.type === 'gradient' &&
|
||||
_.size(value) === 2 &&
|
||||
Project.BACKGROUND_GRADIENTS.includes(value.name)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value.type === 'image' && _.size(value) === 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
},
|
||||
backgroundImage: {
|
||||
type: 'json',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue