Explorar o código

fix attachment.js route, delete function

zamis %!s(int64=5) %!d(string=hai) anos
pai
achega
4fb68ef336
Modificáronse 1 ficheiros con 1 adicións e 11 borrados
  1. 1 11
      src/server/routes/attachment.js

+ 1 - 11
src/server/routes/attachment.js

@@ -244,16 +244,6 @@ module.exports = function(crowi, app) {
     }
   }
 
-  async function removeAttachment(attachmentId) {
-    const { fileUploadService } = crowi;
-
-    // retrieve data from DB to get a completely populated instance
-    const attachment = await Attachment.findById(attachmentId);
-
-    await fileUploadService.deleteFiles(attachment);
-
-    return attachment.remove();
-  }
 
   const actions = {};
   const api = {};
@@ -637,7 +627,7 @@ module.exports = function(crowi, app) {
     }
 
     try {
-      await removeAttachment(attachment);
+      await attachmentService.removeAttachment(attachment);
     }
     catch (err) {
       logger.error(err);