1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 21:29:43 +02:00
planka/server/api/models/Notification.js
2025-05-17 01:50:40 +02:00

79 lines
2 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
*/
/**
* Notification.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const Types = {
MOVE_CARD: 'moveCard',
COMMENT_CARD: 'commentCard',
ADD_MEMBER_TO_CARD: 'addMemberToCard',
};
module.exports = {
Types,
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
type: {
type: 'string',
isIn: Object.values(Types),
required: true,
},
data: {
type: 'json',
required: true,
},
isRead: {
type: 'boolean',
defaultsTo: false,
columnName: 'is_read',
},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
userId: {
model: 'User',
required: true,
columnName: 'user_id',
},
creatorUserId: {
model: 'User',
columnName: 'creator_user_id',
},
// Denormalization
boardId: {
model: 'Board',
required: true,
columnName: 'board_id',
},
cardId: {
model: 'Card',
required: true,
columnName: 'card_id',
},
commentId: {
model: 'Comment',
columnName: 'comment_id',
},
actionId: {
model: 'Action',
columnName: 'action_id',
},
},
};