mirror of
https://github.com/plankanban/planka.git
synced 2025-12-14 01:10:46 +03:00
@@ -26,17 +26,6 @@ module.exports = {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
allowNull: true,
|
||||
},
|
||||
thumb: {
|
||||
type: 'string',
|
||||
allowNull: true,
|
||||
},
|
||||
|
||||
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
|
||||
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
|
||||
@@ -59,20 +48,12 @@ module.exports = {
|
||||
},
|
||||
|
||||
customToJSON() {
|
||||
let { url, thumb } = this;
|
||||
if (!url) {
|
||||
url = `${sails.config.custom.attachmentsUrl}/${this.id}/download/${this.filename}`;
|
||||
}
|
||||
if (!thumb) {
|
||||
thumb = this.image
|
||||
? `${sails.config.custom.attachmentsUrl}/${this.id}/download/thumbnails/cover-256.${this.image.thumbnailsExtension}`
|
||||
: null;
|
||||
}
|
||||
|
||||
return {
|
||||
..._.omit(this, ['type', 'dirname', 'filename', 'image.thumbnailsExtension']),
|
||||
url,
|
||||
coverUrl: thumb,
|
||||
..._.omit(this, ['dirname', 'filename', 'image.thumbnailsExtension']),
|
||||
url: `${sails.config.custom.baseUrl}/attachments/${this.id}/download/${this.filename}`,
|
||||
coverUrl: this.image
|
||||
? `${sails.config.custom.baseUrl}/attachments/${this.id}/download/thumbnails/cover-256.${this.image.thumbnailsExtension}`
|
||||
: null,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user