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/Card.js

90 lines
2.1 KiB
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
/**
* Card.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
position: {
type: 'number',
2022-12-26 21:10:50 +01:00
required: true,
2019-08-31 04:07:25 +05:00
},
name: {
type: 'string',
required: true,
2019-08-31 04:07:25 +05:00
},
description: {
type: 'string',
isNotEmptyString: true,
allowNull: true,
2019-08-31 04:07:25 +05:00
},
dueDate: {
type: 'ref',
columnName: 'due_date',
2019-08-31 04:07:25 +05:00
},
stopwatch: {
type: 'json',
2019-08-31 04:07:25 +05:00
},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
boardId: {
model: 'Board',
required: true,
columnName: 'board_id',
2019-08-31 04:07:25 +05:00
},
listId: {
model: 'List',
2022-12-26 21:10:50 +01:00
required: true,
columnName: 'list_id',
},
creatorUserId: {
model: 'User',
columnName: 'creator_user_id',
},
2020-04-23 03:02:53 +05:00
coverAttachmentId: {
model: 'Attachment',
columnName: 'cover_attachment_id',
},
2019-08-31 04:07:25 +05:00
subscriptionUsers: {
collection: 'User',
via: 'cardId',
through: 'CardSubscription',
2019-08-31 04:07:25 +05:00
},
memberUsers: {
2019-08-31 04:07:25 +05:00
collection: 'User',
via: 'cardId',
through: 'CardMembership',
2019-08-31 04:07:25 +05:00
},
labels: {
collection: 'Label',
via: 'cardId',
through: 'CardLabel',
2019-08-31 04:07:25 +05:00
},
tasks: {
collection: 'Task',
via: 'cardId',
},
2020-04-21 05:04:34 +05:00
attachments: {
collection: 'Attachment',
via: 'cardId',
},
actions: {
collection: 'Action',
via: 'cardId',
},
},
2019-08-31 04:07:25 +05:00
};