mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 12:49:43 +02:00
109 lines
2.3 KiB
JavaScript
Executable file
109 lines
2.3 KiB
JavaScript
Executable file
/*!
|
|
* Copyright (c) 2024 PLANKA Software GmbH
|
|
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
|
*/
|
|
|
|
/**
|
|
* List.js
|
|
*
|
|
* @description :: A model definition represents a database table/collection.
|
|
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
|
|
*/
|
|
|
|
const Types = {
|
|
ACTIVE: 'active',
|
|
CLOSED: 'closed',
|
|
ARCHIVE: 'archive',
|
|
TRASH: 'trash',
|
|
};
|
|
|
|
const TypeStates = {
|
|
OPENED: 'opened',
|
|
CLOSED: 'closed',
|
|
};
|
|
|
|
const SortFieldNames = {
|
|
NAME: 'name',
|
|
DUE_DATE: 'dueDate',
|
|
CREATED_AT: 'createdAt',
|
|
};
|
|
|
|
// TODO: should not be here
|
|
const SortOrders = {
|
|
ASC: 'asc',
|
|
DESC: 'desc',
|
|
};
|
|
|
|
const FINITE_TYPES = [Types.ACTIVE, Types.CLOSED];
|
|
|
|
const TYPE_STATE_BY_TYPE = {
|
|
[Types.ACTIVE]: TypeStates.OPENED,
|
|
[Types.CLOSED]: Types.CLOSED,
|
|
};
|
|
|
|
const COLORS = [
|
|
'berry-red',
|
|
'pumpkin-orange',
|
|
'lagoon-blue',
|
|
'pink-tulip',
|
|
'light-mud',
|
|
'orange-peel',
|
|
'bright-moss',
|
|
'antique-blue',
|
|
'dark-granite',
|
|
'turquoise-sea',
|
|
];
|
|
|
|
module.exports = {
|
|
Types,
|
|
TypeStates,
|
|
SortFieldNames,
|
|
SortOrders,
|
|
FINITE_TYPES,
|
|
TYPE_STATE_BY_TYPE,
|
|
COLORS,
|
|
|
|
attributes: {
|
|
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
|
|
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
|
|
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
|
|
|
|
type: {
|
|
type: 'string',
|
|
isIn: Object.values(Types),
|
|
required: true,
|
|
},
|
|
position: {
|
|
type: 'number',
|
|
allowNull: true,
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
isNotEmptyString: true,
|
|
allowNull: true,
|
|
},
|
|
color: {
|
|
type: 'string',
|
|
isIn: COLORS,
|
|
allowNull: true,
|
|
},
|
|
|
|
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
|
|
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
|
|
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
|
|
|
|
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
|
|
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
|
|
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
|
|
|
|
boardId: {
|
|
model: 'Board',
|
|
required: true,
|
|
columnName: 'board_id',
|
|
},
|
|
cards: {
|
|
collection: 'Card',
|
|
via: 'listId',
|
|
},
|
|
},
|
|
};
|