|
|
@@ -43,14 +43,28 @@ class AttachmentService {
|
|
|
return attachment;
|
|
|
}
|
|
|
|
|
|
- async removeAttachment(attachmentId) {
|
|
|
+ async removeAttachment(attachments) {
|
|
|
const Attachment = this.crowi.model('Attachment');
|
|
|
const { fileUploadService } = this.crowi;
|
|
|
+ // console.log(attachments);
|
|
|
+ console.log('===============');
|
|
|
+ console.log(attachments);
|
|
|
+ console.log('===============');
|
|
|
|
|
|
- const attachment = await Attachment.findById(attachmentId);
|
|
|
- await fileUploadService.deleteFile(attachment);
|
|
|
|
|
|
- return attachment.remove();
|
|
|
+ await attachments.forEach(attachment => Attachment.findById(attachment._id));
|
|
|
+ console.log('===============');
|
|
|
+
|
|
|
+ console.log(attachments);
|
|
|
+ console.log('===============');
|
|
|
+
|
|
|
+ await attachments.forEach(attachment => fileUploadService.deleteFile(attachment));
|
|
|
+ console.log('===============');
|
|
|
+ console.log(attachments);
|
|
|
+ console.log('===============');
|
|
|
+
|
|
|
+
|
|
|
+ return attachments.forEach(attachment => attachment.remove());
|
|
|
}
|
|
|
|
|
|
}
|