2019-08-31 04:07:25 +05:00
|
|
|
/**
|
|
|
|
* Label.js
|
|
|
|
*
|
|
|
|
* @description :: A model definition represents a database table/collection.
|
|
|
|
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
|
|
|
|
*/
|
|
|
|
|
|
|
|
const COLORS = [
|
|
|
|
'green',
|
|
|
|
'yellow',
|
|
|
|
'orange',
|
|
|
|
'red',
|
|
|
|
'purple',
|
|
|
|
'blue',
|
|
|
|
'sky',
|
|
|
|
'lime',
|
|
|
|
'pink',
|
2019-11-05 18:01:42 +05:00
|
|
|
'black',
|
2019-08-31 04:07:25 +05:00
|
|
|
];
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
COLORS,
|
|
|
|
|
|
|
|
attributes: {
|
|
|
|
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
|
|
|
|
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
|
|
|
|
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
|
|
|
|
|
|
|
|
name: {
|
|
|
|
type: 'string',
|
2019-10-09 18:48:19 +05:00
|
|
|
isNotEmptyString: true,
|
2019-11-05 18:01:42 +05:00
|
|
|
allowNull: true,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
color: {
|
|
|
|
type: 'string',
|
|
|
|
isIn: COLORS,
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
|
|
|
|
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
|
|
|
|
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
|
|
|
|
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
|
|
|
|
|
|
|
|
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
|
|
|
|
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
|
|
|
|
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
|
|
|
|
|
|
|
|
boardId: {
|
|
|
|
model: 'Board',
|
|
|
|
required: true,
|
2019-11-05 18:01:42 +05:00
|
|
|
columnName: 'board_id',
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
cards: {
|
|
|
|
collection: 'Card',
|
|
|
|
via: 'labelId',
|
2019-11-05 18:01:42 +05:00
|
|
|
through: 'CardLabel',
|
|
|
|
},
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|