// ============================================ // TREATMENT MILESTONE TRACKER // ============================================ model TreatmentPlan { id String @id @default(cuid()) workspaceId String @unique title String // e.g., "Grace's Chemotherapy Plan" totalCycles Int currentCycle Int @default(0) startDate DateTime? estimatedEnd DateTime? status String @default("ACTIVE") // ACTIVE, PAUSED, COMPLETED cycleType String @default("WEEKLY") // WEEKLY, BIWEEKLY, MONTHLY, CUSTOM cycleDays Int @default(7) // Days between cycles createdAt DateTime @default(now()) updatedAt DateTime @updatedAt createdById String workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade) createdBy User @relation(fields: [createdById], references: [id]) milestones TreatmentMilestone[] @@index([workspaceId]) } model TreatmentMilestone { id String @id @default(cuid()) planId String cycleNumber Int // Which cycle this milestone represents date DateTime // When it happened (or estimated) status String @default("UPCOMING") // UPCOMING, COMPLETED, SKIPPED notes String? // Personal reflection sideEffects String? // What was experienced celebratedAt DateTime? // When we showed the celebration createdAt DateTime @default(now()) plan TreatmentPlan @relation(fields: [planId], references: [id], onDelete: Cascade) @@index([planId]) @@index([planId, cycleNumber]) } // ============================================ // CAREGIVER COORDINATION // ============================================ model CareTask { id String @id @default(cuid()) workspaceId String title String description String? assignedToId String? // User ID or null for anyone dueAt DateTime? completedAt DateTime? completedById String? priority String @default("MEDIUM") // LOW, MEDIUM, HIGH, URGENT category String @default("GENERAL") // MEDICATION, APPOINTMENT, SYMPTOM, GENERAL createdAt DateTime @default(now()) updatedAt DateTime @updatedAt createdById String workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade) assignedTo User? @relation("AssignedTasks", fields: [assignedToId], references: [id]) completedBy User? @relation("CompletedTasks", fields: [completedById], references: [id]) createdBy User @relation(fields: [createdById], references: [id]) @@index([workspaceId]) @@index([workspaceId, assignedToId]) @@index([workspaceId, completedAt]) } model HandoffNote { id String @id @default(cuid()) workspaceId String content String category String @default("GENERAL") // GENERAL, SYMPTOM, MEDICATION, MOOD priority String @default("NORMAL") // LOW, NORMAL, HIGH expiresAt DateTime // Auto-expire after shift (e.g., 12 hours) createdById String createdAt DateTime @default(now()) acknowledgedBy String[] // User IDs who've seen it (stored as JSON string) workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade) createdBy User @relation(fields: [createdById], references: [id]) @@index([workspaceId]) @@index([workspaceId, expiresAt]) } // ============================================ // ENHANCED SYMPTOM TRACKING // ============================================ // Additional fields for existing Symptom model (add to existing model): // durationMinutes Int? // How long the symptom lasted // triggers String? // Optional triggers (comma-separated) // medicationTaken String? // ID of medication taken for relief // reliefNotes String? // Did it help? // ============================================ // CALENDAR INTEGRATION // ============================================ model CalendarFeed { id String @id @default(cuid()) workspaceId String token String @unique // Secret token for feed URL includeMeds Boolean @default(false) includeAppointments Boolean @default(true) daysAhead Int @default(90) // How many days to include createdAt DateTime @default(now()) lastAccessedAt DateTime? workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade) @@index([token]) @@index([workspaceId]) }