Skip to content

Done with Delete comment refacatoring#53

Open
Bavithbabu wants to merge 1 commit into18-create-a-admin-backendfrom
52-delete-comment-refacatoring
Open

Done with Delete comment refacatoring#53
Bavithbabu wants to merge 1 commit into18-create-a-admin-backendfrom
52-delete-comment-refacatoring

Conversation

@Bavithbabu
Copy link
Copy Markdown
Contributor

@Bavithbabu Bavithbabu commented Apr 12, 2026

LLD: Delete Comment Archive System

The delete system is designed so that any post/comment deletion follows one reusable flow:

delete request -> shared delete module -> move to archive -> remove from live collection
This avoids writing separate delete logic for user delete, future admin delete, or moderation-based delete.

Main Flow

For comment delete:

User/Admin/Moderation calls delete comment
-> validates permission outside delete module
-> ContentDeleteService.deleteComment(commentId)
-> fetch comment from postdescription
-> save comment into archive_comments
-> delete comment from postdescription

Archive Table for comment:
When a comment is deleted, the comment is moved frompostdescriptiontoarchive_comments.

Field Example Purpose
_id 69d9f4a8feb63ab50410e031 New archive document id
originalCommentId 69d9f42afeb63ab50410e030 Original comment id from postdescription
postId 69d9f0b4feb63ab50410e02d Post where the comment belonged
userId 69d9ed84de89b227fed805dc Owner of the comment
username Test User Comment owner username
userImageUrl profile image url User profile image
description This inscription looks like a 12th century temple wall record. Comment text
upvote 0 Comment upvote count
status ACCEPTED Status at the time of archive
report.count 0 Report count at the time of archive
createdAt 2026-04-11T07:15:20.100Z Original created date
updatedAt 2026-04-11T07:15:20.100Z Original updated date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant