-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.prisma
More file actions
80 lines (66 loc) · 2.04 KB
/
schema.prisma
File metadata and controls
80 lines (66 loc) · 2.04 KB
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
78
79
80
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
output = "./generated/client"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Competition {
id String @id
name String
importedAt DateTime @default(now())
country String
startDate String
endDate String
// if true, the server will automatically advance the competition to the next activity
autoAdvance Boolean @default(false)
// the delay in seconds before the server advances the competition to the next activity
autoAdvanceDelay Int @default(0)
status Status @default(NOT_STARTED)
competitionAccess CompetitionAccess[]
activityHistory ActivityHistory[]
webhooks Webhook[]
}
model CompetitionAccess {
competitionId String @db.VarChar(255)
userId Int
roomId Int
competition Competition @relation(fields: [competitionId], references: [id])
@@unique([competitionId, userId])
}
model ActivityHistory {
competitionId String @db.VarChar(255)
activityId Int
startTime DateTime?
endTime DateTime?
// For autoAdvance competitions, the server will advance to the next activity when the scheduledEnd is reached
scheduledStartTime DateTime?
scheduledEndTime DateTime?
competition Competition @relation(fields: [competitionId], references: [id])
@@unique([competitionId, activityId])
}
enum HTTPMethod {
GET
POST
PATCH
PUT
DELETE
@@map("Method")
}
model Webhook {
id Int @id @default(autoincrement())
competitionId String @db.VarChar(255)
url String @db.VarChar(255)
method HTTPMethod
headers Json?
competition Competition @relation(fields: [competitionId], references: [id])
@@unique([competitionId, url])
}
enum Status {
NOT_STARTED
IN_PROGRESS
FINISHED
}