|
@@ -51,10 +51,6 @@ module.exports = function(crowi) {
|
|
|
return `/attachment/${this._id}`;
|
|
return `/attachment/${this._id}`;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- attachmentSchema.virtual('brandLogoFilePathProxied').get(function() {
|
|
|
|
|
- return `/attachment/brand-logo/${this._id}`;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
attachmentSchema.virtual('downloadPathProxied').get(function() {
|
|
attachmentSchema.virtual('downloadPathProxied').get(function() {
|
|
|
return `/download/${this._id}`;
|
|
return `/download/${this._id}`;
|
|
|
});
|
|
});
|
|
@@ -83,6 +79,9 @@ module.exports = function(crowi) {
|
|
|
return attachment;
|
|
return attachment;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ attachmentSchema.statics.isBrandLogoExist = function() {
|
|
|
|
|
+ return this.findOne({ attachmentType: AttachmentType.BRAND_LOGO }) != null;
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
attachmentSchema.methods.getValidTemporaryUrl = function() {
|
|
attachmentSchema.methods.getValidTemporaryUrl = function() {
|
|
|
if (this.temporaryUrlExpiredAt == null) {
|
|
if (this.temporaryUrlExpiredAt == null) {
|
|
@@ -105,9 +104,5 @@ module.exports = function(crowi) {
|
|
|
return this.save();
|
|
return this.save();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- attachmentSchema.methods.isBrandLogo = function() {
|
|
|
|
|
- return this.attachmentType === AttachmentType.BRAND_LOGO;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
return mongoose.model('Attachment', attachmentSchema);
|
|
return mongoose.model('Attachment', attachmentSchema);
|
|
|
};
|
|
};
|