1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00
planka/server/api/models/Project.js

93 lines
2.3 KiB
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
/**
* Project.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const BackgroundTypes = {
GRADIENT: 'gradient',
IMAGE: 'image',
};
2020-06-03 22:27:20 +05:00
const BACKGROUND_GRADIENTS = [
'old-lime',
'ocean-dive',
'tzepesch-style',
'jungle-mesh',
'strawberry-dust',
'purple-rose',
'sun-scream',
'warm-rust',
'sky-change',
'green-eyes',
'blue-xchange',
'blood-orange',
'sour-peel',
'green-ninja',
'algae-green',
'coral-reef',
'steel-grey',
'heat-waves',
'velvet-lounge',
'purple-rain',
'blue-steel',
'blueish-curve',
'prism-light',
'green-mist',
'red-curtain',
];
2019-08-31 04:07:25 +05:00
module.exports = {
BackgroundTypes,
2020-06-03 22:27:20 +05:00
BACKGROUND_GRADIENTS,
2019-08-31 04:07:25 +05:00
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
name: {
type: 'string',
required: true,
2019-08-31 04:07:25 +05:00
},
2020-05-26 00:46:04 +05:00
background: {
type: 'json',
},
backgroundImageDirname: {
type: 'string',
isNotEmptyString: true,
allowNull: true,
columnName: 'background_image_dirname',
},
2019-08-31 04:07:25 +05:00
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
managerUsers: {
2019-08-31 04:07:25 +05:00
collection: 'User',
via: 'projectId',
through: 'ProjectManager',
2019-08-31 04:07:25 +05:00
},
boards: {
collection: 'Board',
via: 'projectId',
},
},
2020-05-26 00:46:04 +05:00
customToJSON() {
return {
..._.omit(this, ['backgroundImageDirname']),
backgroundImage: this.backgroundImageDirname && {
url: `${sails.config.custom.projectBackgroundImagesUrl}/${this.backgroundImageDirname}/original.jpg`,
coverUrl: `${sails.config.custom.projectBackgroundImagesUrl}/${this.backgroundImageDirname}/cover-336.jpg`,
},
};
},
2019-08-31 04:07:25 +05:00
};