Explorar o código

ensure to set { virtuals: true } to attachment schema

Yuki Takei %!s(int64=7) %!d(string=hai) anos
pai
achega
b5041e1b7a
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/server/models/attachment.js

+ 4 - 0
src/server/models/attachment.js

@@ -37,6 +37,10 @@ module.exports = function(crowi) {
     return `/download/${this._id}`;
   });
 
+  attachmentSchema.set('toObject', { virtuals: true });
+  attachmentSchema.set('toJSON', { virtuals: true });
+
+
   attachmentSchema.statics.create = async function(pageId, user, fileStream, originalName, fileFormat, fileSize) {
     const Attachment = this;