Files
planka/server/api/models/UploadedFile.js

60 lines
1.6 KiB
JavaScript
Raw Normal View History

/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
2019-08-31 04:07:25 +05:00
/**
2025-08-23 00:03:20 +02:00
* UploadedFile.js
2019-08-31 04:07:25 +05:00
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
2025-08-23 00:03:20 +02:00
const Types = {
USER_AVATAR: 'userAvatar',
BACKGROUND_IMAGE: 'backgroundImage',
ATTACHMENT: 'attachment',
};
2019-08-31 04:07:25 +05:00
module.exports = {
2025-08-23 00:03:20 +02:00
Types,
2019-08-31 04:07:25 +05:00
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
2025-08-23 00:03:20 +02:00
type: {
type: 'string',
isIn: Object.values(Types),
required: true,
},
referencesTotal: {
type: 'number',
allowNull: true,
defaultsTo: 0,
2025-08-23 00:03:20 +02:00
columnName: 'references_total',
},
mimeType: {
type: 'string',
isNotEmptyString: true,
allowNull: true,
columnName: 'mime_type',
},
size: {
type: 'string',
required: true,
},
2019-08-31 04:07:25 +05:00
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
},
2025-08-23 00:03:20 +02:00
tableName: 'uploaded_file',
2019-08-31 04:07:25 +05:00
};