/** * 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', }, }, };