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

ref: Collapse image data into one column

This commit is contained in:
Maksim Eltyshev 2022-06-21 12:01:41 +02:00
parent e7495e0067
commit 6268ced4cb
10 changed files with 102 additions and 86 deletions

View file

@ -19,20 +19,8 @@ module.exports = {
type: 'string',
required: true,
},
isImage: {
type: 'boolean',
required: true,
columnName: 'is_image',
},
imageWidth: {
type: 'number',
allowNull: true,
columnName: 'image_width',
},
imageHeight: {
type: 'number',
allowNull: true,
columnName: 'image_height',
image: {
type: 'json',
},
name: {
type: 'string',
@ -61,9 +49,9 @@ module.exports = {
customToJSON() {
return {
..._.omit(this, ['dirname', 'filename', 'isImage']),
..._.omit(this, ['dirname', 'filename']),
url: `${sails.config.custom.attachmentsUrl}/${this.id}/download/${this.filename}`,
coverUrl: this.isImage
coverUrl: this.image
? `${sails.config.custom.attachmentsUrl}/${this.id}/download/thumbnails/cover-256.jpg`
: null,
};