Skip to content

feat: create actual News/Event/Resource content on country request ap…#54

Merged
Rashed99Azm merged 1 commit into
develop-backendfrom
feat/state-rep-content-refactoring
Jun 11, 2026
Merged

feat: create actual News/Event/Resource content on country request ap…#54
Rashed99Azm merged 1 commit into
develop-backendfrom
feat/state-rep-content-refactoring

Conversation

@Rashed99Azm

Copy link
Copy Markdown
Collaborator

Description
Currently, when an admin approves a state representative's content request (News, Event, or Resource), the request status is updated to Approved but no actual content is created in the news, events, or resources tables. The data remains trapped in the country_content_requests table with no effect.
This PR closes the gap by introducing a domain event handler that, on approval, creates and publishes the corresponding content aggregate in the same transaction.
Changes

  1. Entity enhancement — Added ProposedCategoryId to CountryContentRequest so resource category is captured at submission time. Also fixed a bug where Event.FeaturedImageAssetId was validated but discarded.
  2. New handler — CountryContentRequestApprovedContentHandler subscribes to CountryContentRequestApprovedEvent (via MediatR) and:
  • Resource → Resource.Draft(...) + .Publish()
  • News → News.Draft(...) + .Publish()
  • Event → Event.Schedule(...)
    Because domain events are dispatched inside EF's SavingChangesAsync interceptor, the new content is persisted atomically with the approval status update — no dual-write window.
  1. Migration — Adds proposed_category_id column to country_content_requests.
    Related user stories
  • US050 — Process Country Request (approve → create actual content)
    Checklist
  • Source projects build with 0 warnings, 0 errors
  • No manual DI registration needed (MediatR scans assembly)
  • Migration generated

…proval

- Add ProposedCategoryId to CountryContentRequest entity + EF config
- Pass CategoryId to SubmitResource and FeaturedImageAssetId to SubmitEvent factories
- Create CountryContentRequestApprovedContentHandler that reads approved request
  and creates + publishes the corresponding content aggregate (News.Draft/Publish,
  Resource.Draft/Publish, Event.Schedule) in the same transaction
- MediatR auto-discovers handler via assembly scanning
- Add migration for proposed_category_id column
@Rashed99Azm Rashed99Azm merged commit 2ccc93f into develop-backend Jun 11, 2026
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.

2 participants