feat(posts): soft-delete, archive, and restore lifecycle for posts - #69
Merged
aji70 merged 2 commits intoJul 29, 2026
Merged
Conversation
Posts were hard-deleted while users were already soft-deleted. Aligns posts with the same lifecycle: DELETE now soft-deletes (idempotent), adds GET .../archived and POST .../:id/restore, filters deletedAt out of every active-post read path (owner list, public/subscriber feed, single-post lookup), and defines the engagement contract deleted posts must uphold for future likes/comments via assertPostIsEngageable.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #56
PR: Implement Post Soft-Delete, Archive, Restore & Tombstone Lifecycle
Overview
This PR aligns post deletion behavior with the platform's user lifecycle by replacing hard deletes with a soft-delete workflow. Deleted posts are now recoverable, excluded from public-facing content, accessible through an archive for creators, and support consistent tombstone semantics for existing engagement.
The implementation ensures that creators can safely manage their content without permanently removing data through the public API while maintaining predictable behavior across feeds, post retrieval, likes, and comments.
What Changed
Database & Schema**
deletedAttimestamp to thePostentity.deletedByIdsupport for future auditability.deletedAt = NULL.API Endpoints**
Implemented the following lifecycle endpoints:
Soft Delete
DELETE /api/v1/creators/me/posts/:iddeletedAtArchive Listing
GET /api/v1/creators/me/posts/archivedcursor/pageandlimit)Restore
POST /api/v1/creators/me/posts/:id/restoreRead Path Updates
Updated all public queries to automatically exclude soft-deleted posts, including:
Engagement Behavior
Implemented consistent handling for deleted posts:
Authorization
Access control has been updated to ensure:
Idempotency
Implemented predictable API behavior:
Audit Logging
Added audit events for:
This provides traceability for lifecycle actions without exposing deleted content publicly.
Documentation
Added:
docs/post-lifecycle.mdTesting
Added comprehensive test coverage including:
Total Coverage: ≥10 tests
Acceptance Criteria Checklist
Out of Scope