Add 'Mark as Cleaned Up' functionality

- Add cleaned_at and cleaned_by_user_id fields to reports table
- Create database migration for cleanup tracking
- Add markAsCleaned backend endpoint and service method
- Add Mark as Cleaned Up button to ReportDetailModal
- Update types to include cleaned fields
- Add frontend handler to mark reports as cleaned
This commit is contained in:
2025-11-16 22:26:59 +00:00
parent beb5d8e7d8
commit 17e3e85781
9 changed files with 168 additions and 21 deletions

View File

@@ -25,6 +25,7 @@ model User {
eventRegistrations EventRegistration[]
organizedEvents Event[] @relation("EventOrganizer")
reports Report[]
cleanedReports Report[] @relation("CleanedByUser")
verifications Verification[]
@@index([clerkId], map: "idx_clerk_id")
@@ -49,15 +50,20 @@ model Report {
updatedAt DateTime? @default(now()) @updatedAt @map("updated_at") @db.Timestamp(0)
submittedAt DateTime? @default(now()) @map("submitted_at") @db.Timestamp(0)
verificationStatus reports_verification_status? @default(pending) @map("verification_status")
cleanedAt DateTime? @map("cleaned_at") @db.Timestamp(0)
cleanedByUserId String? @map("cleaned_by_user_id") @db.VarChar(36)
environmentalConcerns EnvironmentalConcern[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "reports_ibfk_1")
cleanedByUser User? @relation("CleanedByUser", fields: [cleanedByUserId], references: [id], onDelete: SetNull, onUpdate: NoAction, map: "reports_cleaned_by_fk")
verifications Verification[]
@@index([createdAt], map: "idx_created_at")
@@index([cleanedAt], map: "idx_cleaned_at")
@@index([latitude, longitude], map: "idx_lat_lng")
@@index([litterType], map: "idx_litter_type")
@@index([location(length: 32)], map: "idx_location")
@@index([userId], map: "user_id")
@@index([cleanedByUserId], map: "cleaned_by_user_id")
@@map("reports")
}