1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-24 23:59:48 +02:00

Project managers, board members, auto-update after reconnection, refactoring

This commit is contained in:
Maksim Eltyshev 2021-06-24 01:05:22 +05:00
parent d6cb1f6683
commit b39119ace4
478 changed files with 21226 additions and 19495 deletions

View file

@ -5,10 +5,14 @@
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const TYPES = ['createCard', 'moveCard', 'commentCard'];
const Types = {
CREATE_CARD: 'createCard',
MOVE_CARD: 'moveCard',
COMMENT_CARD: 'commentCard',
};
module.exports = {
TYPES,
Types,
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
@ -17,7 +21,7 @@ module.exports = {
type: {
type: 'string',
isIn: TYPES,
isIn: Object.values(Types),
required: true,
},
data: {

View file

@ -42,10 +42,10 @@ module.exports = {
required: true,
columnName: 'card_id',
},
userId: {
creatorUserId: {
model: 'User',
required: true,
columnName: 'user_id',
columnName: 'creator_user_id',
},
},

View file

@ -5,10 +5,13 @@
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const TYPES = ['kanban', 'collection'];
const Types = {
KANBAN: 'kanban',
COLLECTION: 'collection',
};
module.exports = {
TYPES,
Types,
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
@ -17,7 +20,7 @@ module.exports = {
type: {
type: 'string',
isIn: TYPES,
isIn: Object.values(Types),
required: true,
},
position: {
@ -42,6 +45,11 @@ module.exports = {
required: true,
columnName: 'project_id',
},
memberUsers: {
collection: 'User',
via: 'boardId',
through: 'BoardMembership',
},
lists: {
collection: 'List',
via: 'boardId',

View file

@ -0,0 +1,35 @@
/**
* BoardMembership.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
boardId: {
model: 'Board',
required: true,
columnName: 'board_id',
},
userId: {
model: 'User',
required: true,
columnName: 'user_id',
},
},
tableName: 'board_membership',
};

View file

@ -49,6 +49,10 @@ module.exports = {
model: 'List',
columnName: 'list_id',
},
creatorUserId: {
model: 'User',
columnName: 'creator_user_id',
},
coverAttachmentId: {
model: 'Attachment',
columnName: 'cover_attachment_id',
@ -58,7 +62,7 @@ module.exports = {
via: 'cardId',
through: 'CardSubscription',
},
membershipUsers: {
memberUsers: {
collection: 'User',
via: 'cardId',
through: 'CardMembership',

View file

@ -5,7 +5,10 @@
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const BACKGROUND_TYPES = ['gradient', 'image'];
const BackgroundTypes = {
GRADIENT: 'gradient',
IMAGE: 'image',
};
const BACKGROUND_GRADIENTS = [
'old-lime',
@ -36,7 +39,7 @@ const BACKGROUND_GRADIENTS = [
];
module.exports = {
BACKGROUND_TYPES,
BackgroundTypes,
BACKGROUND_GRADIENTS,
attributes: {
@ -66,10 +69,10 @@ module.exports = {
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
membershipUsers: {
managerUsers: {
collection: 'User',
via: 'projectId',
through: 'ProjectMembership',
through: 'ProjectManager',
},
boards: {
collection: 'Board',

View file

@ -1,5 +1,5 @@
/**
* ProjectMembership.js
* ProjectManager.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
@ -31,5 +31,5 @@ module.exports = {
},
},
tableName: 'project_membership',
tableName: 'project_manager',
};

View file

@ -71,10 +71,15 @@ module.exports = {
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
membershipProjects: {
managerProjects: {
collection: 'Project',
via: 'userId',
through: 'ProjectMembership',
through: 'ProjectManager',
},
membershipBoards: {
collection: 'Board',
via: 'userId',
through: 'BoardMembership',
},
subscriptionCards: {
collection: 'Card',