itizawa 5 лет назад
Родитель
Сommit
9e4daff19e
1 измененных файлов с 6 добавлено и 6 удалено
  1. 6 6
      src/server/models/attachment.js

+ 6 - 6
src/server/models/attachment.js

@@ -31,8 +31,8 @@ module.exports = function(crowi) {
     fileFormat: { type: String, required: true },
     fileSize: { type: Number, default: 0 },
     createdAt: { type: Date, default: Date.now },
-    externalUrlCached: { type: String },
-    externalUrlExpiredAt: { type: Date },
+    temporaryUrlCached: { type: String },
+    temporaryUrlExpiredAt: { type: Date },
   });
   attachmentSchema.plugin(uniqueValidator);
   attachmentSchema.plugin(mongoosePaginate);
@@ -78,12 +78,12 @@ module.exports = function(crowi) {
     return this.externalUrlExpiredAt.getTime() > new Date().getTime();
   };
 
-  attachmentSchema.methods.cashExternalUrl = function(externalUrl) {
-    if (externalUrl == null) {
+  attachmentSchema.methods.cashTemporaryUrlByProvideSec = function(temporaryUrl, provideSec) {
+    if (temporaryUrl == null) {
       throw new Error('url is required.');
     }
-    this.externalUrlCached = externalUrl;
-    this.externalUrlExpiredAt = addSeconds(new Date(), SECONDS_OF_CASH_EXPIRATION);
+    this.temporaryUrlCached = temporaryUrl;
+    this.temporaryUrlExpiredAt = addSeconds(new Date(), provideSec);
 
     return this.save();
   };