1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/models/Label.js
Maksim Eltyshev a741e26ccb feat: Labels reordering
Closes #289
2023-01-09 12:17:06 +01:00

78 lines
1.8 KiB
JavaScript
Executable file

/**
* Label.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const COLORS = [
'berry-red',
'pumpkin-orange',
'lagoon-blue',
'pink-tulip',
'light-mud',
'orange-peel',
'bright-moss',
'antique-blue',
'dark-granite',
'lagune-blue',
'sunny-grass',
'morning-sky',
'light-orange',
'midnight-blue',
'tank-green',
'gun-metal',
'wet-moss',
'red-burgundy',
'light-concrete',
'apricot-red',
'desert-sand',
'navy-blue',
'egg-yellow',
'coral-green',
'light-cocoa',
];
module.exports = {
COLORS,
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
position: {
type: 'number',
required: true,
},
name: {
type: 'string',
isNotEmptyString: true,
allowNull: true,
},
color: {
type: 'string',
isIn: COLORS,
required: true,
},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
boardId: {
model: 'Board',
required: true,
columnName: 'board_id',
},
cards: {
collection: 'Card',
via: 'labelId',
through: 'CardLabel',
},
},
};