Sfoglia il codice sorgente

add isExpiredExternalUrl

itizawa 5 anni fa
parent
commit
27e16707fc
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      src/server/models/attachment.js

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

@@ -68,5 +68,12 @@ module.exports = function(crowi) {
   };
 
 
+  attachmentSchema.methods.isExpiredExternalUrl = function() {
+    if (this.externalUrlExpiredAt == null) {
+      return false;
+    }
+    return this.externalUrlExpiredAt.getTime() < new Date().getTime();
+  };
+
   return mongoose.model('Attachment', attachmentSchema);
 };