Explorar el Código

add isExpiredExternalUrl

itizawa hace 5 años
padre
commit
27e16707fc
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  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);
 };