/** * List.js * * @description :: A model definition represents a database table/collection. * @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models */ const SortTypes = { NAME_ASC: 'name_asc', DUE_DATE_ASC: 'dueDate_asc', CREATED_AT_ASC: 'createdAt_asc', CREATED_AT_DESC: 'createdAt_desc', }; const COLORS = [ 'berry-red', 'pumpkin-orange', 'lagoon-blue', 'pink-tulip', 'light-mud', 'orange-peel', 'bright-moss', 'antique-blue', 'dark-granite', 'lagune-blue', ]; module.exports = { SortTypes, COLORS, attributes: { // ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗ // ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗ // ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝ position: { type: 'number', required: true, }, name: { type: 'string', required: true, }, color: { type: 'string', isIn: COLORS, allowNull: true, }, // ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗ // ║╣ ║║║╠╩╗║╣ ║║╚═╗ // ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝ // ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗ // ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗ // ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝ boardId: { model: 'Board', required: true, columnName: 'board_id', }, cards: { collection: 'Card', via: 'listId', }, }, };