Skip to content

Commit

Permalink
add mailingLists to schema and endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
135ze committed Nov 30, 2024
1 parent 5f22cd1 commit e32b935
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "_MailingListToUser" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "_MailingListToUser_AB_unique" ON "_MailingListToUser"("A", "B");

-- CreateIndex
CREATE INDEX "_MailingListToUser_B_index" ON "_MailingListToUser"("B");

-- AddForeignKey
ALTER TABLE "_MailingListToUser" ADD CONSTRAINT "_MailingListToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "MailingList"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "_MailingListToUser" ADD CONSTRAINT "_MailingListToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
18 changes: 10 additions & 8 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ model Absence {
}

model User {
id Int @id @default(autoincrement())
authId String @unique
email String @unique
id Int @id @default(autoincrement())
authId String @unique
email String @unique
firstName String
lastName String
role Role @default(TEACHER)
status Status @default(INVITED)
numOfAbsences Int @default(10)
absences Absence[] @relation("absentTeacher")
substitutes Absence[] @relation("substituteTeacher")
role Role @default(TEACHER)
status Status @default(INVITED)
numOfAbsences Int @default(10)
absences Absence[] @relation("absentTeacher")
substitutes Absence[] @relation("substituteTeacher")
mailingLists MailingList[]
}

model Location {
Expand All @@ -47,6 +48,7 @@ model MailingList {
id Int @id @default(autoincrement())
name String
emails String[]
users User[]
}

model Subject {
Expand Down
Loading

0 comments on commit e32b935

Please sign in to comment.