forked from notiz-dev/nestjs-prisma-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
77 lines (68 loc) · 1.83 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
// previewFeatures = []
}
generator dbml {
provider = "prisma-dbml-generator"
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
email String @unique
role Role
password String
firstname String?
lastname String?
posts Post[]
bookings ParticipantsOnBookings[] @relation("partcipantOnBooking")
assignedParticipantsOnBookings ParticipantsOnBookings[] @relation("assignedParticipantOnBooking")
}
model Post {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean
title String
content String?
author User? @relation(fields: [authorId], references: [id])
authorId String?
}
model Booking {
id String @id @default(cuid())
active Boolean? @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
timeStart DateTime
timeEnd DateTime
title String?
description String?
participants ParticipantsOnBookings[]
}
model ParticipantsOnBookings {
participant User @relation(name: "partcipantOnBooking", fields: [participantId], references: [id])
participantId String
participantRole ParticipantRole
booking Booking @relation(fields: [bookingId], references: [id])
bookingId String
assignedAt DateTime @default(now())
assignedBy User? @relation(name: "assignedParticipantOnBooking", fields: [assignedById], references: [id])
assignedById String?
@@id([participantId, bookingId])
}
enum Role {
ADMIN
TRAINER
CLIENT
}
enum ParticipantRole {
ORGANISER
TRAINER
CLIENT
GUEST
}