Reviews Subscribers Reference
Review Removal Subscriber
remove-review-request-removed-handler
Deletes a review when a review removal request is approved. Event:requests.review.removed (RemoveReviewRequestUpdatedEvent.REMOVED)Source:
packages/modules/reviews/src/subscribers/remove-review-request-removed.ts
Functionality
When a review removal request is accepted by an admin:- Receives the review ID from the event payload
- Executes
deleteReviewWorkflowto soft delete the review - Removes the review from the database (soft delete)
- Workflow hooks trigger any necessary cleanup or notifications
Event Payload
Workflow Execution
Use Cases
- Content Moderation: Allows admins to remove inappropriate or fraudulent reviews
- Customer Requests: Handles customer requests to delete their reviews
- Policy Enforcement: Removes reviews that violate marketplace policies
- Legal Compliance: Supports right-to-be-forgotten and similar regulations
Notes
Review Removal Process
The review removal follows a two-step approval process:- Request Creation: Customer or admin creates a review removal request
- Admin Approval: Admin reviews and approves the removal request
- Event Emission:
requests.review.removedevent is emitted - This Subscriber: Executes the actual deletion workflow
- Soft Delete: Review is marked as deleted but retained in database
- Audit trail for all review deletions
- Admin oversight on moderation actions
- Ability to restore accidentally deleted reviews
- Compliance with data retention policies
Integration with Requests Module
This subscriber bridges the Requests Module and Reviews Module: Requests Module:- Handles the approval workflow
- Emits
requests.review.removedevent when approved
- This subscriber listens to the event
- Executes the actual deletion
- Consistent approval process across all request types
- Reviews module remains focused on review management
- Clear responsibility boundaries between modules
Soft Delete vs Hard Delete
ThedeleteReviewWorkflow performs a soft delete:
Soft Delete:
- Review record remains in database
- Marked with
deleted_attimestamp - Excluded from normal queries
- Can be restored if needed
- Maintains referential integrity
- Audit and compliance requirements
- Ability to investigate disputes
- Accidental deletion recovery
- Data analytics and reporting
Workflow Hooks
ThedeleteReviewWorkflow exposes a reviewDeleted hook that can be used for:
- Updating aggregate ratings
- Notifying the review author
- Logging deletion for compliance
- Triggering search index updates