Add mantis summaries and start of email summaries... Need to figure out a way to get the emails since MS block IMAP :(
This commit is contained in:
parent
2d11d0bd79
commit
2ad9a63582
18 changed files with 1993 additions and 577 deletions
101
prisma/schema.prisma
Normal file
101
prisma/schema.prisma
Normal file
|
@ -0,0 +1,101 @@
|
|||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Form {
|
||||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
description String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
categories Category[]
|
||||
responses Response[]
|
||||
|
||||
@@map("forms") // Map to the 'forms' table
|
||||
}
|
||||
|
||||
model Category {
|
||||
id Int @id @default(autoincrement())
|
||||
formId Int @map("form_id")
|
||||
name String
|
||||
sortOrder Int @default(0) @map("sort_order")
|
||||
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
|
||||
fields Field[]
|
||||
|
||||
@@map("categories") // Map to the 'categories' table
|
||||
}
|
||||
|
||||
enum FieldType {
|
||||
text
|
||||
number
|
||||
date
|
||||
textarea
|
||||
boolean
|
||||
}
|
||||
|
||||
model Field {
|
||||
id Int @id @default(autoincrement())
|
||||
categoryId Int @map("category_id")
|
||||
label String
|
||||
type FieldType // Using Prisma Enum based on CHECK constraint
|
||||
description String?
|
||||
sortOrder Int @map("sort_order")
|
||||
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
||||
responseValues ResponseValue[]
|
||||
|
||||
@@map("fields") // Map to the 'fields' table
|
||||
}
|
||||
|
||||
model Response {
|
||||
id Int @id @default(autoincrement())
|
||||
formId Int @map("form_id")
|
||||
submittedAt DateTime @default(now()) @map("submitted_at")
|
||||
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
|
||||
responseValues ResponseValue[]
|
||||
|
||||
@@map("responses") // Map to the 'responses' table
|
||||
}
|
||||
|
||||
model ResponseValue {
|
||||
id Int @id @default(autoincrement())
|
||||
responseId Int @map("response_id")
|
||||
fieldId Int @map("field_id")
|
||||
value String?
|
||||
response Response @relation(fields: [responseId], references: [id], onDelete: Cascade)
|
||||
field Field @relation(fields: [fieldId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("response_values") // Map to the 'response_values' table
|
||||
}
|
||||
|
||||
model MantisSummary {
|
||||
id Int @id @default(autoincrement())
|
||||
summaryDate DateTime @unique @db.Date @map("summary_date")
|
||||
summaryText String @map("summary_text")
|
||||
generatedAt DateTime @default(now()) @map("generated_at")
|
||||
|
||||
@@map("mantis_summaries") // Map to the 'mantis_summaries' table
|
||||
}
|
||||
|
||||
model EmailSummary {
|
||||
id Int @id @default(autoincrement())
|
||||
summaryDate DateTime @unique @db.Date
|
||||
summaryText String
|
||||
generatedAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Setting {
|
||||
key String @id
|
||||
value String
|
||||
|
||||
@@map("settings") // Map to the 'settings' table
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue