Files
app/prisma/schema.prisma
T

56 lines
1.3 KiB
Plaintext

// prisma/schema.prisma
generator client {
provider = "prisma-client"
output = "../generated/prisma"
}
datasource db {
provider = "sqlite"
// Notice: No URL here anymore!
}
// 1. Your Staff/Admins
model User {
id String @id @default(cuid())
name String
pin String
role String // "Admin", "Staff", "Viewer"
}
// 2. The 3-Week Periods
model Period {
id String @id @default(cuid())
name String
startDate String
endDate String
youths Youth[]
}
// 3. The Youth Workers
model Youth {
id String @id @default(cuid())
name String
team String // "PF" or "TU"
periodId String
period Period @relation(fields: [periodId], references: [id], onDelete: Cascade)
attendance Attendance[]
}
// 4. The Daily Attendance Records
model Attendance {
id String @id @default(cuid())
date String
shiftId String // "MORNING" or "AFTERNOON"
hoursWorked Float
weightedHours Float
status String // "Present", "Late", "Absent", "Pending"
note String?
youthId String
youth Youth @relation(fields: [youthId], references: [id], onDelete: Cascade)
// A youth can only have one specific shift record per day
@@unique([date, youthId, shiftId])
}