feat(listings): complete PATCH /api/v1/listings/:id endpoint

- Add mediaOrder field to UpdateListingDto, Command, and Handler for
  reordering media items
- Add updateMediaOrder method to IPropertyRepository and Prisma impl
- Fix PrismaPropertyRepository.update() to persist amenities, nearbyPOIs,
  floors, floor, totalFloors, and metroDistanceM columns
- Add unit tests for media order updates in handler spec
- Add DTO validation tests for mediaOrder with nested validation
- Add e2e integration tests covering content updates, auth, ownership
  guard, and forbidden field rejection

Existing guards enforced:
- Only seller or assigned agent can update (403 for others)
- ACTIVE listings transition to PENDING_REVIEW on edit
- propertyType, address, location blocked via DTO whitelist

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 06:10:27 +07:00
parent a48abf23b5
commit 62a8842193
9 changed files with 200 additions and 3 deletions

View File

@@ -11,4 +11,5 @@ export interface IPropertyRepository {
findMediaByPropertyId(propertyId: string): Promise<PropertyMediaEntity[]>;
deleteMedia(mediaId: string): Promise<void>;
countMediaByPropertyId(propertyId: string): Promise<number>;
updateMediaOrder(propertyId: string, mediaOrder: { mediaId: string; order: number }[]): Promise<void>;
}