Initial commit — Grow baby tracker
Next.js 16 App Router, Prisma + PostgreSQL, NextAuth v5 JWT. Features: dashboard quick-log, timeline, growth charts (WHO percentiles), stats, journal/notes, doctor notes, milestones, vaccinations, settings, superadmin panel. Mobile-first with sidebar nav + bottom nav + quick-add FAB. Dark mode, PWA push notifications, multi-family invite system. Docker: multi-stage Dockerfile + docker-compose with postgres service.
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../src/generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
}
|
||||
|
||||
enum UserRole {
|
||||
PARENT
|
||||
READONLY
|
||||
DOCTOR
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
email String @unique
|
||||
name String
|
||||
password String?
|
||||
image String?
|
||||
role UserRole @default(PARENT)
|
||||
isSuperAdmin Boolean @default(false)
|
||||
pushoverUserKey String?
|
||||
familyId String?
|
||||
family Family? @relation(fields: [familyId], references: [id])
|
||||
events Event[]
|
||||
sessions Session[]
|
||||
accounts Account[]
|
||||
doctorNotes DoctorNote[]
|
||||
journalNotes JournalNote[]
|
||||
passwordResetTokens PasswordResetToken[]
|
||||
forcedLogoutAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model PasswordResetToken {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
token String @unique @default(cuid())
|
||||
expiresAt DateTime
|
||||
used Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model SystemConfig {
|
||||
key String @id
|
||||
value String
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String?
|
||||
access_token String?
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String?
|
||||
session_state String?
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String @unique
|
||||
expires DateTime
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
|
||||
model Family {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
inviteCode String @unique @default(cuid())
|
||||
users User[]
|
||||
babies Baby[]
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Baby {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
birthDate DateTime
|
||||
gender String?
|
||||
familyId String
|
||||
family Family @relation(fields: [familyId], references: [id])
|
||||
events Event[]
|
||||
growthLogs GrowthLog[]
|
||||
doctorNotes DoctorNote[]
|
||||
journalNotes JournalNote[]
|
||||
milestones Milestone[]
|
||||
vaccinations Vaccination[]
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Event {
|
||||
id String @id @default(cuid())
|
||||
babyId String
|
||||
baby Baby @relation(fields: [babyId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
type EventType
|
||||
startedAt DateTime
|
||||
endedAt DateTime?
|
||||
notes String?
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
enum EventType {
|
||||
BREASTFEED
|
||||
BOTTLE
|
||||
DIAPER_WET
|
||||
DIAPER_STOOL
|
||||
NAP
|
||||
NIGHT_SLEEP
|
||||
MEDICATION
|
||||
TEMPERATURE
|
||||
}
|
||||
|
||||
model GrowthLog {
|
||||
id String @id @default(cuid())
|
||||
babyId String
|
||||
baby Baby @relation(fields: [babyId], references: [id], onDelete: Cascade)
|
||||
date DateTime
|
||||
weight Float?
|
||||
height Float?
|
||||
headCirc Float?
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model DoctorNote {
|
||||
id String @id @default(cuid())
|
||||
babyId String
|
||||
baby Baby @relation(fields: [babyId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
content String
|
||||
date DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model JournalNote {
|
||||
id String @id @default(cuid())
|
||||
babyId String
|
||||
baby Baby @relation(fields: [babyId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
date DateTime
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Milestone {
|
||||
id String @id @default(cuid())
|
||||
babyId String
|
||||
baby Baby @relation(fields: [babyId], references: [id], onDelete: Cascade)
|
||||
title String
|
||||
date DateTime
|
||||
notes String?
|
||||
icon String?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Vaccination {
|
||||
id String @id @default(cuid())
|
||||
babyId String
|
||||
baby Baby @relation(fields: [babyId], references: [id], onDelete: Cascade)
|
||||
name String
|
||||
date DateTime?
|
||||
dueDate DateTime?
|
||||
notes String?
|
||||
done Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
Reference in New Issue
Block a user