(commentInfo)
| 55 | } |
| 56 | |
| 57 | async function softDelete (commentInfo) { |
| 58 | const toDelete = makeComment(commentInfo) |
| 59 | toDelete.markDeleted() |
| 60 | await commentsDb.update({ |
| 61 | id: toDelete.getId(), |
| 62 | author: toDelete.getAuthor(), |
| 63 | text: toDelete.getText(), |
| 64 | replyToId: toDelete.getReplyToId(), |
| 65 | postId: toDelete.getPostId() |
| 66 | }) |
| 67 | return { |
| 68 | deletedCount: 1, |
| 69 | softDelete: true, |
| 70 | message: 'Comment has replies. Soft deleted.' |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | async function deleteCommentAndParent (comment) { |
| 75 | await Promise.all([ |