feat(listings): add user-facing scam/abuse report flow (GOO-19)

- Add ListingFlag model with FlagReason enum (SCAM, DUPLICATE, WRONG_INFO, ALREADY_SOLD, INAPPROPRIATE)
- Add POST /listings/:id/report endpoint with rate limiting and duplicate prevention
- Auto-flag listings with ≥3 reports to PENDING_REVIEW for moderator review
- Add GET /admin/flagged-listings endpoint for admin moderation queue
- Add "Báo cáo" button + modal on listing detail page (Vietnamese UI)
- Add Prisma migration for listing_flags table with unique constraint per user/listing

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-23 00:19:12 +07:00
parent 94d462ef4f
commit 0329455e9a
26 changed files with 615 additions and 57 deletions

View File

@@ -8,6 +8,7 @@ import { CheckQuotaHandler } from './application/queries/check-quota/check-quota
import { GetBillingHistoryHandler } from './application/queries/get-billing-history/get-billing-history.handler';
import { GetPlanHandler } from './application/queries/get-plan/get-plan.handler';
import { SUBSCRIPTION_REPOSITORY } from './domain/repositories/subscription.repository';
import { BankTransferSubscriptionActivationHandler } from './infrastructure/event-handlers/bank-transfer-subscription-activation.handler';
import { ListingCreatedUsageHandler } from './infrastructure/event-handlers/listing-created-usage.handler';
import { SavedSearchCreatedUsageHandler } from './infrastructure/event-handlers/saved-search-created-usage.handler';
import { PrismaSubscriptionRepository } from './infrastructure/repositories/prisma-subscription.repository';
@@ -40,6 +41,7 @@ const QueryHandlers = [
// Event Listeners
ListingCreatedUsageHandler,
SavedSearchCreatedUsageHandler,
BankTransferSubscriptionActivationHandler,
// CQRS
...CommandHandlers,