mirror of
https://github.com/plankanban/planka.git
synced 2025-12-18 17:23:21 +03:00
feat: Track storage usage
This commit is contained in:
59
server/api/models/UploadedFile.js
Normal file
59
server/api/models/UploadedFile.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
/**
|
||||
* UploadedFile.js
|
||||
*
|
||||
* @description :: A model definition represents a database table/collection.
|
||||
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
|
||||
*/
|
||||
|
||||
const Types = {
|
||||
USER_AVATAR: 'userAvatar',
|
||||
BACKGROUND_IMAGE: 'backgroundImage',
|
||||
ATTACHMENT: 'attachment',
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
Types,
|
||||
|
||||
attributes: {
|
||||
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
|
||||
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
|
||||
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
|
||||
|
||||
type: {
|
||||
type: 'string',
|
||||
isIn: Object.values(Types),
|
||||
required: true,
|
||||
},
|
||||
referencesTotal: {
|
||||
type: 'number',
|
||||
allowNull: true,
|
||||
defaultsTo: 0,
|
||||
columnName: 'references_total',
|
||||
},
|
||||
mimeType: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
columnName: 'mime_type',
|
||||
},
|
||||
size: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
|
||||
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
|
||||
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
|
||||
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
|
||||
|
||||
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
|
||||
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
|
||||
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
|
||||
},
|
||||
|
||||
tableName: 'uploaded_file',
|
||||
};
|
||||
Reference in New Issue
Block a user