Add total litter collected display to user profile
- Updated backend userService to calculate total litter collected across all attended events - Added totalLitterCollected field to UserProfile interface - Added new statistics card showing total litter collected in kg - Updated profile grid layout to accommodate 5 statistics cards - Displays litter collected with 1 decimal place precision
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `event_registrations`
|
||||
ADD COLUMN `litter_collected` DECIMAL(10, 2) NULL,
|
||||
ADD COLUMN `contribution_note` TEXT NULL;
|
||||
@@ -96,13 +96,15 @@ model Event {
|
||||
}
|
||||
|
||||
model EventRegistration {
|
||||
id String @id @default(dbgenerated("(uuid())")) @db.VarChar(36)
|
||||
userId String @map("user_id") @db.VarChar(36)
|
||||
eventId String @map("event_id") @db.VarChar(36)
|
||||
registeredAt DateTime? @default(now()) @map("registered_at") @db.Timestamp(0)
|
||||
attended Boolean? @default(false)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "event_registrations_ibfk_1")
|
||||
event Event @relation(fields: [eventId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "event_registrations_ibfk_2")
|
||||
id String @id @default(dbgenerated("(uuid())")) @db.VarChar(36)
|
||||
userId String @map("user_id") @db.VarChar(36)
|
||||
eventId String @map("event_id") @db.VarChar(36)
|
||||
registeredAt DateTime? @default(now()) @map("registered_at") @db.Timestamp(0)
|
||||
attended Boolean? @default(false)
|
||||
litterCollected Decimal? @map("litter_collected") @db.Decimal(10, 2)
|
||||
contributionNote String? @map("contribution_note") @db.Text
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "event_registrations_ibfk_1")
|
||||
event Event @relation(fields: [eventId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "event_registrations_ibfk_2")
|
||||
|
||||
@@unique([userId, eventId], map: "unique_user_event")
|
||||
@@index([eventId], map: "event_id")
|
||||
|
||||
Reference in New Issue
Block a user