First commit

This commit is contained in:
2026-03-16 23:54:36 +01:00 Verified
commit be129af1d9
53 changed files with 49704 additions and 0 deletions
@@ -0,0 +1,40 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"pin" TEXT NOT NULL,
"role" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "Period" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"startDate" TEXT NOT NULL,
"endDate" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "Youth" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"team" TEXT NOT NULL,
"periodId" TEXT NOT NULL,
CONSTRAINT "Youth_periodId_fkey" FOREIGN KEY ("periodId") REFERENCES "Period" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "Attendance" (
"id" TEXT NOT NULL PRIMARY KEY,
"date" TEXT NOT NULL,
"shiftId" TEXT NOT NULL,
"hoursWorked" REAL NOT NULL,
"weightedHours" REAL NOT NULL,
"status" TEXT NOT NULL,
"note" TEXT,
"youthId" TEXT NOT NULL,
CONSTRAINT "Attendance_youthId_fkey" FOREIGN KEY ("youthId") REFERENCES "Youth" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "Attendance_date_youthId_shiftId_key" ON "Attendance"("date", "youthId", "shiftId");
+3
View File
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "sqlite"
+55
View File
@@ -0,0 +1,55 @@
// 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])
}