🗃️ Add database schema
This commit is contained in:
@ -6,7 +6,7 @@ const prisma = new Prisma.PrismaClient();
|
|||||||
const port = process.send.PORT || 3000;
|
const port = process.send.PORT || 3000;
|
||||||
|
|
||||||
app.get("/", async (_req, res) => {
|
app.get("/", async (_req, res) => {
|
||||||
const result = await prisma.test.findMany();
|
const result = await prisma.substitution.findMany();
|
||||||
res.send(result);
|
res.send(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7,7 +7,49 @@ datasource db {
|
|||||||
url = env("DATABASE_URL")
|
url = env("DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
model test {
|
model Timetable {
|
||||||
key String @id
|
id Int @id @unique @default(autoincrement())
|
||||||
value String
|
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[]
|
||||||
}
|
}
|
Reference in New Issue
Block a user