Parcourir la source

fix attachment.js route, delete function

zamis il y a 5 ans
Parent
commit
4fb68ef336
1 fichiers modifiés avec 1 ajouts et 11 suppressions
  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 actions = {};
   const api = {};
   const api = {};
@@ -637,7 +627,7 @@ module.exports = function(crowi, app) {
     }
     }
 
 
     try {
     try {
-      await removeAttachment(attachment);
+      await attachmentService.removeAttachment(attachment);
     }
     }
     catch (err) {
     catch (err) {
       logger.error(err);
       logger.error(err);