diff --git a/server/index.js b/server/index.js index b4589cb..12cbe36 100644 --- a/server/index.js +++ b/server/index.js @@ -6,7 +6,7 @@ const prisma = new Prisma.PrismaClient(); const port = process.send.PORT || 3000; app.get("/", async (_req, res) => { - const result = await prisma.test.findMany(); + const result = await prisma.substitution.findMany(); res.send(result); }); diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index 474c38e..b0eef5d 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -7,7 +7,49 @@ datasource db { url = env("DATABASE_URL") } -model test { - key String @id - value String -} \ No newline at end of file +model Timetable { + id Int @id @unique @default(autoincrement()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + class String + validFrom DateTime @default(now()) + validUntil DateTime? + data Json +} + +model Substitution { + id Int @id @unique @default(autoincrement()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + class String[] + date DateTime + type String + lesson Int + changedTeacher String? + changedRoom String? + changedSubject String? + removed Boolean @default(false) + + SubstitutionChange SubstitutionChange[] +} + +model SubstitutionChange { + id Int @id @unique @default(autoincrement()) + createdAt DateTime @default(now()) + substitution Substitution @relation(fields: [substitutionId], references: [id]) + substitutionId Int + type String + changes Json? + parseEvent ParseEvent @relation(fields: [parseEventId], references: [id]) + parseEventId Int +} + +model ParseEvent { + id Int @id @unique @default(autoincrement()) + createdAt DateTime @default(now()) + logFile String + originalData String + duration Int + + SubstitutionChange SubstitutionChange[] +}