This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

chore(prisma): update schema

+155 -128
+7 -7
go.mod
··· 10 10 github.com/nats-io/nats.go v1.37.0 11 11 github.com/orcaman/concurrent-map/v2 v2.0.1 12 12 github.com/shopspring/decimal v1.4.0 13 - github.com/steebchen/prisma-client-go v0.44.0 13 + github.com/steebchen/prisma-client-go v0.45.0 14 14 golang.org/x/oauth2 v0.24.0 15 15 google.golang.org/api v0.210.0 16 16 ) 17 17 18 18 require ( 19 19 cloud.google.com/go v0.116.0 // indirect 20 - cloud.google.com/go/auth v0.10.2 // indirect 21 - cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect 20 + cloud.google.com/go/auth v0.11.0 // indirect 21 + cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect 22 22 cloud.google.com/go/compute/metadata v0.5.2 // indirect 23 23 cloud.google.com/go/firestore v1.17.0 // indirect 24 24 cloud.google.com/go/iam v1.2.2 // indirect ··· 33 33 github.com/go-logr/logr v1.4.2 // indirect 34 34 github.com/go-logr/stdr v1.2.2 // indirect 35 35 github.com/golang-jwt/jwt v3.2.2+incompatible // indirect 36 - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect 36 + github.com/golang-jwt/jwt/v4 v4.5.1 // indirect 37 37 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect 38 38 github.com/golang/protobuf v1.5.4 // indirect 39 39 github.com/google/s2a-go v0.1.8 // indirect ··· 58 58 golang.org/x/text v0.20.0 // indirect 59 59 golang.org/x/time v0.8.0 // indirect 60 60 google.golang.org/appengine/v2 v2.0.6 // indirect 61 - google.golang.org/genproto v0.0.0-20241113202542-65e8d215514f // indirect 62 - google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect 63 - google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect 61 + google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect 62 + google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect 63 + google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect 64 64 google.golang.org/grpc v1.67.1 // indirect 65 65 google.golang.org/protobuf v1.35.2 // indirect 66 66 gopkg.in/yaml.v3 v3.0.1 // indirect
+12
go.sum
··· 3 3 cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= 4 4 cloud.google.com/go/auth v0.10.2 h1:oKF7rgBfSHdp/kuhXtqU/tNDr0mZqhYbEh+6SiqzkKo= 5 5 cloud.google.com/go/auth v0.10.2/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= 6 + cloud.google.com/go/auth v0.11.0/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= 6 7 cloud.google.com/go/auth/oauth2adapt v0.2.5 h1:2p29+dePqsCHPP1bqDJcKj4qxRyYCcbzKpFyKGt3MTk= 7 8 cloud.google.com/go/auth/oauth2adapt v0.2.5/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= 9 + cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= 8 10 cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= 9 11 cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= 10 12 cloud.google.com/go/firestore v1.17.0 h1:iEd1LBbkDZTFsLw3sTH50eyg4qe8eoG6CjocmEXO9aQ= ··· 17 19 cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= 18 20 firebase.google.com/go/v4 v4.15.0 h1:k27M+cHbyN1YpBI2Cf4NSjeHnnYRB9ldXwpqA5KikN0= 19 21 firebase.google.com/go/v4 v4.15.0/go.mod h1:S/4MJqVZn1robtXkHhpRUbwOC4gdYtgsiMMJQ4x+xmQ= 22 + firebase.google.com/go/v4 v4.15.1/go.mod h1:eunxbsh4UXI2rA8po3sOiebvWYuW0DVxAdZFO0I6wdY= 20 23 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 21 24 github.com/MicahParks/keyfunc v1.9.0 h1:lhKd5xrFHLNOWrDc4Tyb/Q1AJ4LCzQ48GVJyVIID3+o= 22 25 github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x95xuVNtM5jw= ··· 50 53 github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 51 54 github.com/ewen-lbh/label-logger-go v0.1.1 h1:jHTjmhD1OBP7xqdG+xs6NvO96JJ3+5mhskTKVJxLDm4= 52 55 github.com/ewen-lbh/label-logger-go v0.1.1/go.mod h1:ORVakjovWm+MfrGXmHBZAJvxNqYwAxdG3Sev8CXXChM= 56 + github.com/ewen-lbh/label-logger-go v0.1.3/go.mod h1:ORVakjovWm+MfrGXmHBZAJvxNqYwAxdG3Sev8CXXChM= 53 57 github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= 54 58 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= 55 59 github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= ··· 62 66 github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 63 67 github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= 64 68 github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 69 + github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 65 70 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 66 71 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 67 72 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= ··· 133 138 github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= 134 139 github.com/steebchen/prisma-client-go v0.44.0 h1:1p35CHnWmKDXHEJV5+nPfh+k8Nq/KzzUBkPWHTJsotw= 135 140 github.com/steebchen/prisma-client-go v0.44.0/go.mod h1:FjDTO7dSYb7GCTnvnoIEFYDJGfD2rQ1h56ukDurbt1E= 141 + github.com/steebchen/prisma-client-go v0.45.0 h1:sXqCi96/1HIh3CScfd/27OlcR/YDXDtgbrpkDSk+3TY= 142 + github.com/steebchen/prisma-client-go v0.45.0/go.mod h1:4sNeijtPnYSX04/CIXRptUrczEsmPDpWSYR7ahY+H+c= 136 143 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 137 144 github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 138 145 github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= ··· 141 148 github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 142 149 github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= 143 150 github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 151 + github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= 144 152 github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= 145 153 github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= 146 154 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= ··· 234 242 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 235 243 google.golang.org/api v0.209.0 h1:Ja2OXNlyRlWCWu8o+GgI4yUn/wz9h/5ZfFbKz+dQX+w= 236 244 google.golang.org/api v0.209.0/go.mod h1:I53S168Yr/PNDNMi5yPnDc0/LGRZO6o7PoEbl/HY3CM= 245 + google.golang.org/api v0.210.0/go.mod h1:B9XDZGnx2NtyjzVkOVTGrFSAVZgPcbedzKg/gTLwqBs= 237 246 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 238 247 google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 239 248 google.golang.org/appengine/v2 v2.0.6 h1:LvPZLGuchSBslPBp+LAhihBeGSiRh1myRoYK4NtuBIw= ··· 243 252 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 244 253 google.golang.org/genproto v0.0.0-20241113202542-65e8d215514f h1:zDoHYmMzMacIdjNe+P2XiTmPsLawi/pCbSPfxt6lTfw= 245 254 google.golang.org/genproto v0.0.0-20241113202542-65e8d215514f/go.mod h1:Q5m6g8b5KaFFzsQFIGdJkSJDGeJiybVenoYFMMa3ohI= 255 + google.golang.org/genproto v0.0.0-20241118233622-e639e219e697/go.mod h1:JJrvXBWRZaFMxBufik1a4RpFw4HhgVtBBWQeQgUj2cc= 246 256 google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= 247 257 google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= 258 + google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f/go.mod h1:Yo94eF2nj7igQt+TiJ49KxjIH8ndLYPZMIRSiRcEbg0= 248 259 google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f h1:C1QccEa9kUwvMgEUORqQD9S17QesQijxjZ84sO82mfo= 249 260 google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= 261 + google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= 250 262 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 251 263 google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 252 264 google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
+136 -121
schema.prisma
··· 13 13 14 14 /// Users are the people who use the app 15 15 model User { 16 - id String @id @default(dbgenerated("nanoid('u:')")) 17 - uid String @unique @db.VarChar(255) 18 - createdAt DateTime @default(now()) 16 + id String @id @default(dbgenerated("nanoid('u:'::text)")) 17 + uid String @unique @db.VarChar(255) 18 + createdAt DateTime @default(now()) 19 + lastSeenAt DateTime @default(now()) 19 20 20 21 // School details 21 22 schoolServer String? @db.VarChar(255) ··· 37 38 birthday DateTime? 38 39 description String @default("") @db.Text 39 40 nickname String @default("") @db.VarChar(255) 41 + pronouns String @default("") @db.VarChar(255) 40 42 phone String @default("") @db.VarChar(255) 41 43 pictureFile String @default("") @db.VarChar(255) 42 44 links Link[] ··· 65 67 events Event[] 66 68 notificationSubscriptions NotificationSubscription[] 67 69 notifications Notification[] 68 - godparent User? @relation("mentorship", fields: [godparentId], references: [id]) // Le parrain ou la marraine 70 + godparent User? @relation("mentorship", fields: [godparentId], references: [id], onDelete: SetNull) // Le parrain ou la marraine 69 71 godchildren User[] @relation("mentorship") // Les filleul(e)s 70 72 incomingGodparentRequests GodparentRequest[] @relation("godparent") 71 73 outgoingGodparentRequests GodparentRequest[] @relation("godchild") ··· 78 80 cancellations Registration[] @relation("cancelledBy") 79 81 receivedBookings Registration[] @relation("beneficiaryOf") 80 82 documents Document[] 81 - comments Comment[] 82 83 bannedFromEvents Event[] @relation("bannedFromEvents") 83 84 reactions Reaction[] 84 85 formAnswers Answer[] ··· 90 91 sharedPosts Article[] @relation("shares") 91 92 sharedEvents Event[] @relation("shares") 92 93 seenBookings Registration[] @relation("seenBy") 94 + eventManagerInvites EventManagerInvite[] @relation("eventManagerInviteUses") 95 + invitedToTickets Ticket[] @relation("invitedTo") 93 96 94 97 // For full-text search 95 98 search Unsupported("tsvector") @default(dbgenerated("''::tsvector")) 96 99 claimedPromotions PromotionCode[] 97 100 formsWithMarkedCheckboxes Form[] @relation("formsWithMarkedCheckbox") 98 101 createdPages Page[] 102 + pointOfContactFor Registration[] @relation("pointOfContactFor") 99 103 100 104 @@unique([schoolServer, schoolUid]) 101 105 @@index([search], type: Gin) ··· 103 107 104 108 /// A bookmarked page, used to make personal quick access links 105 109 model Bookmark { 106 - id String @id @default(dbgenerated("nanoid('bookmark:')")) 110 + id String @id @default(dbgenerated("nanoid('bookmark:'::text)")) 107 111 createdAt DateTime @default(now()) 108 112 updatedAt DateTime @updatedAt 109 113 user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade) ··· 116 120 117 121 /// Requests to become someone's godchild. Gets deleted once the request has been accepted (or denied). godchild is the requester, godparent is the requested. 118 122 model GodparentRequest { 119 - id String @id @unique @default(dbgenerated("nanoid('godparentreq:')")) 123 + id String @id @default(dbgenerated("nanoid('godparentreq:'::text)")) 120 124 createdAt DateTime @default(now()) 121 125 updatedAt DateTime @updatedAt 122 126 123 - godchild User @relation("godchild", fields: [godchildId], references: [id]) 127 + godchild User @relation("godchild", fields: [godchildId], references: [id], onDelete: Cascade) 124 128 godchildId String 125 - godparent User @relation("godparent", fields: [godparentId], references: [id]) 129 + godparent User @relation("godparent", fields: [godparentId], references: [id], onDelete: Cascade) 126 130 godparentId String 127 131 128 132 @@unique([godchildId, godparentId]) ··· 130 134 131 135 /// UserCandidates are users in the registration process 132 136 model UserCandidate { 133 - id String @id @default(dbgenerated("nanoid('candidate:')")) 137 + id String @id @default(dbgenerated("nanoid('candidate:'::text)")) 134 138 token String @unique 135 139 createdAt DateTime @default(now()) 136 140 ··· 157 161 158 162 /// A password reset token 159 163 model PasswordReset { 160 - id String @id @default(dbgenerated("nanoid('passreset:')")) 164 + id String @id @default(dbgenerated("nanoid('passreset:'::text)")) 161 165 createdAt DateTime @default(now()) 162 166 updatedAt DateTime @updatedAt 163 167 user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade) ··· 167 171 168 172 /// A email validation request 169 173 model EmailChange { 170 - id String @id @default(dbgenerated("nanoid('emailchange:')")) 174 + id String @id @default(dbgenerated("nanoid('emailchange:'::text)")) 171 175 createdAt DateTime @default(now()) 172 176 updatedAt DateTime @updatedAt 173 177 email String ··· 176 180 userId String 177 181 pending Boolean @default(true) 178 182 // token is not exposed to the API, whereas id has to be 179 - token String @unique @default(dbgenerated("nanoid('', 30)")) 183 + token String @unique @default(dbgenerated("nanoid(''::text, 30)")) 180 184 } 181 185 182 186 model QuickSignup { 183 - id String @id @default(dbgenerated("nanoid('quicksignup:', 6)")) 187 + id String @id @default(dbgenerated("nanoid('quicksignup:'::text, 6)")) 184 188 createdAt DateTime @default(now()) 185 189 updatedAt DateTime @updatedAt 186 190 validUntil DateTime ··· 199 203 200 204 /// A service 201 205 model Service { 202 - id String @id @default(dbgenerated("nanoid('service:')")) 206 + id String @id @default(dbgenerated("nanoid('service:'::text)")) 203 207 name String @db.VarChar(255) 204 208 url String @default("") @db.VarChar(255) 205 209 description String @default("") @db.VarChar(255) ··· 220 224 221 225 /// A single external link 222 226 model Link { 223 - id String @id @default(dbgenerated("nanoid('link:')")) 227 + id String @id @default(dbgenerated("nanoid('link:'::text)")) 224 228 name String @db.VarChar(255) 225 229 value String @db.VarChar(255) 226 230 createdAt DateTime @default(now()) 227 231 228 232 // All resources that can have links 229 - User User? @relation(fields: [userId], references: [id]) 233 + User User? @relation(fields: [userId], references: [id], onDelete: SetNull) 230 234 userId String? 231 235 StudentAssociation StudentAssociation? @relation(fields: [studentAssociationId], references: [id]) 232 236 studentAssociationId String? ··· 256 260 257 261 /// A school syllabus 258 262 model Major { 259 - id String @id @default(dbgenerated("nanoid('major:')")) 263 + id String @id @default(dbgenerated("nanoid('major:'::text)")) 260 264 uid String @unique @db.VarChar(255) 261 265 name String @db.VarChar(255) 262 266 shortName String @default("") @db.VarChar(255) ··· 276 280 } 277 281 278 282 model Minor { 279 - id String @id @default(dbgenerated("nanoid('minor:')")) 283 + id String @id @default(dbgenerated("nanoid('minor:'::text)")) 280 284 name String 281 285 shortName String @default("") 282 286 slug String ··· 289 293 } 290 294 291 295 model School { 292 - id String @id @default(dbgenerated("nanoid('school:')")) 296 + id String @id @default(dbgenerated("nanoid('school:'::text)")) 293 297 uid String @unique @db.VarChar(255) 294 298 name String @db.VarChar(255) 295 299 color String @db.VarChar(7) 296 300 studentMailDomain String @default("") @db.VarChar(255) 297 - aliasMailDomains String[] @default([]) @db.VarChar(255) 301 + aliasMailDomains String[] @default([]) 298 302 description String @default("") @db.Text 299 303 address String @default("") @db.VarChar(255) 300 304 pictureFile String @default("") @db.VarChar(255) ··· 317 321 318 322 /// A credential is a way to authenticate a user 319 323 model Credential { 320 - id String @id @default(dbgenerated("nanoid('credential:')")) 324 + id String @id @default(dbgenerated("nanoid('credential:'::text)")) 321 325 userId String? 322 326 groupId String? 323 327 name String @default("") @db.VarChar(255) ··· 334 338 335 339 /// There is one student association per school 336 340 model StudentAssociation { 337 - id String @id @default(dbgenerated("nanoid('ae:')")) 341 + id String @id @default(dbgenerated("nanoid('ae:'::text)")) 338 342 uid String @unique @db.VarChar(255) 339 343 description String @default("") @db.Text 340 344 schoolId String ··· 363 367 } 364 368 365 369 model Contribution { 366 - id String @id @default(dbgenerated("nanoid('contribution:')")) 370 + id String @id @default(dbgenerated("nanoid('contribution:'::text)")) 367 371 option ContributionOption @relation(fields: [optionId], references: [id], onDelete: Cascade, onUpdate: Cascade) 368 372 optionId String 369 373 transaction LydiaTransaction? ··· 376 380 } 377 381 378 382 model ContributionOption { 379 - id String @id @default(dbgenerated("nanoid('contributionoption:')")) 383 + id String @id @default(dbgenerated("nanoid('contributionoption:'::text)")) 380 384 offeredIn School @relation(fields: [offeredInId], references: [id], onDelete: Cascade, onUpdate: Cascade) 381 385 offeredInId String 382 386 paysFor StudentAssociation[] ··· 400 404 401 405 /// A group is a collection of users 402 406 model Group { 403 - id String @id @default(dbgenerated("nanoid('g:')")) 407 + id String @id @default(dbgenerated("nanoid('g:'::text)")) 404 408 uid String @unique @db.VarChar(255) 405 409 parentId String? 406 410 /// Helper field to get a whole tree without processing all groups ··· 493 497 494 498 /// An article is a post in a group 495 499 model Article { 496 - id String @id @default(dbgenerated("nanoid('a:')")) 500 + id String @id @default(dbgenerated("nanoid('a:'::text)")) 497 501 authorId String? 498 502 groupId String 499 503 slug String @db.VarChar(255) // TODO remove ··· 506 510 notifiedAt DateTime? @default(now()) // to prevent old notifications before this was added. Another migration will remove this default value. 507 511 pictureFile String @default("") @db.VarChar(255) 508 512 links Link[] 509 - comments Comment[] 510 513 511 514 author User? @relation(fields: [authorId], references: [id], onUpdate: Cascade, onDelete: SetNull) 512 515 group Group @relation(fields: [groupId], references: [id], onUpdate: Cascade, onDelete: Cascade) ··· 530 533 531 534 /// An event is a date, time and place, as well as an optional ticket 532 535 model Event { 533 - id String @id @default(dbgenerated("nanoid('e:')")) 534 - createdAt DateTime @default(now()) 535 - updatedAt DateTime @default(now()) @updatedAt 536 - authorId String? 537 - groupId String 538 - contactMail String 539 - beneficiary LydiaAccount? @relation(fields: [lydiaAccountId], references: [id]) 540 - description String @db.Text 541 - slug String @db.VarChar(255) 542 - title String @db.VarChar(255) 536 + id String @id @default(dbgenerated("nanoid('e:'::text)")) 537 + createdAt DateTime @default(now()) 538 + updatedAt DateTime @default(now()) @updatedAt 539 + authorId String? 540 + groupId String 541 + contactMail String 542 + beneficiary LydiaAccount? @relation(fields: [lydiaAccountId], references: [id]) 543 + description String @db.Text 544 + slug String @db.VarChar(255) 545 + title String @db.VarChar(255) 543 546 // events without dates are useful when they're "drafts", but they' can't appear in the calendar - thus they're only visible by link 544 - startsAt DateTime? 545 - endsAt DateTime? 546 - globalCapacity Int? 547 - notifiedAt DateTime? @default(now()) // to prevent old notifications before this was added. Another migration will remove this default value. 548 - location String @default("") @db.VarChar(255) 549 - visibility Visibility 550 - frequency EventFrequency @default(Once) 551 - recurringUntil DateTime? 552 - pictureFile String @default("") @db.VarChar(255) 553 - showPlacesLeft Boolean @default(true) 554 - managers EventManager[] 555 - author User? @relation(fields: [authorId], references: [id], onUpdate: Cascade, onDelete: SetNull) 556 - includeInKiosk Boolean @default(false) 557 - group Group @relation(fields: [groupId], references: [id]) 558 - coOrganizers Group[] @relation("coOrganizer") 559 - tickets Ticket[] 560 - ticketGroups TicketGroup[] 561 - articles Article[] 562 - lydiaAccountId String? 563 - links Link[] 564 - bannedUsers User[] @relation("bannedFromEvents") 565 - reactions Reaction[] 566 - forms Form[] 567 - sharedBy User[] @relation("shares") 568 - applicableOffers Promotion[] 547 + startsAt DateTime? 548 + endsAt DateTime? 549 + globalCapacity Int? 550 + notifiedAt DateTime? @default(now()) // to prevent old notifications before this was added. Another migration will remove this default value. 551 + location String @default("") @db.VarChar(255) 552 + visibility Visibility 553 + frequency EventFrequency @default(Once) 554 + recurringUntil DateTime? 555 + pictureFile String @default("") @db.VarChar(255) 556 + showPlacesLeft Boolean @default(true) 557 + showCapacity Boolean @default(true) 558 + managers EventManager[] 559 + author User? @relation(fields: [authorId], references: [id], onUpdate: Cascade, onDelete: SetNull) 560 + includeInKiosk Boolean @default(false) 561 + group Group @relation(fields: [groupId], references: [id]) 562 + coOrganizers Group[] @relation("coOrganizer") 563 + tickets Ticket[] 564 + ticketGroups TicketGroup[] 565 + articles Article[] 566 + lydiaAccountId String? 567 + links Link[] 568 + bannedUsers User[] @relation("bannedFromEvents") 569 + reactions Reaction[] 570 + forms Form[] 571 + sharedBy User[] @relation("shares") 572 + applicableOffers Promotion[] 573 + managerInvites EventManagerInvite[] 574 + // enfore providing a point of contact for external bookings 575 + enforcePointOfContact Boolean @default(false) 569 576 570 577 // For full-text search 571 578 search Unsupported("tsvector") @default(dbgenerated("''::tsvector")) ··· 581 588 Public 582 589 } 583 590 591 + /// Used to make invite links to invite people as managers of an event 592 + model EventManagerInvite { 593 + id String @id @default(dbgenerated("nanoid('eminvite:')")) 594 + createdAt DateTime @default(now()) 595 + updatedAt DateTime @updatedAt 596 + 597 + /// Maximum number of uses 598 + capacity Int? 599 + code String @unique 600 + /// If null, should expire at the event's end date, not never expire 601 + expiresAt DateTime? 602 + 603 + eventId String 604 + event Event @relation(fields: [eventId], references: [id], onDelete: Cascade) 605 + 606 + canVerifyRegistrations Boolean @default(true) // Can scan tickets 607 + canEdit Boolean @default(false) 608 + canEditPermissions Boolean @default(false) 609 + 610 + usedBy User[] @relation("eventManagerInviteUses") 611 + } 612 + 584 613 /// An event manager is a user that can scan tickets, and may be able to manage the event 585 614 model EventManager { 586 - id String @id @default(dbgenerated("nanoid('em:')")) 615 + id String @id @default(dbgenerated("nanoid('em:'::text)")) 587 616 eventId String 588 617 userId String 589 618 canVerifyRegistrations Boolean @default(true) // Can scan tickets ··· 598 627 599 628 /// A ticket group allows for conditions on multiple tickets, such as an upper limit on the sum of registrations in the sub-tickets 600 629 model TicketGroup { 601 - id String @id @default(dbgenerated("nanoid('tg:')")) 630 + id String @id @default(dbgenerated("nanoid('tg:'::text)")) 602 631 eventId String 603 632 name String @db.VarChar(255) 604 633 ··· 617 646 618 647 /// A ticket is a way to register for an event. May include a price and conditions. 619 648 model Ticket { 620 - id String @id @default(dbgenerated("nanoid('t:')")) 649 + id String @id @default(dbgenerated("nanoid('t:'::text)")) 621 650 slug String 622 651 eventId String 623 652 ticketGroupId String? ··· 632 661 links Link[] 633 662 allowedPaymentMethods PaymentMethod[] @default([]) // empty means all 634 663 countingPolicy TicketCountingPolicy @default(OnBooked) 664 + inviteCode String? @unique 635 665 636 666 // Conditions for that ticket. 637 667 openToPromotions Int[] @default([]) ··· 651 681 group TicketGroup? @relation(fields: [ticketGroupId], references: [id], onDelete: SetNull, onUpdate: Cascade) 652 682 Promotion Promotion? @relation(fields: [promotionId], references: [id]) 653 683 promotionId String? 684 + invited User[] @relation("invitedTo") 654 685 } 655 686 656 687 /// A reservation is a user's registration for a ticket 657 688 model Registration { 658 - id String @id @default(dbgenerated("nanoid('r:')")) 689 + id String @id @default(dbgenerated("nanoid('r:'::text)")) 659 690 ticketId String 660 691 externalBeneficiary String? 661 692 internalBeneficiary User? @relation(fields: [internalBeneficiaryId], references: [id], onUpdate: Cascade, onDelete: SetNull, name: "beneficiaryOf") 662 693 internalBeneficiaryId String? 663 694 authorId String? 664 695 authorEmail String @default("") 696 + authorName String @default("") 665 697 verifiedById String? 666 698 opposedById String? 667 699 cancelledById String? ··· 670 702 paymentMethod PaymentMethod? 671 703 paid Boolean @default(false) 672 704 wantsToPay Float? 705 + // Person to refer to, especially for external beneficiaries, to handle misconducts at the event 706 + pointOfContactId String? 707 + pointOfContact User? @relation(fields: [pointOfContactId], references: [id], onDelete: SetNull, name: "pointOfContactFor") 673 708 674 709 lydiaTransaction LydiaTransaction? 675 710 paypalTransaction PaypalTransaction? 676 711 ticket Ticket @relation(fields: [ticketId], references: [id], onUpdate: Cascade, onDelete: Cascade) 677 - author User? @relation(name: "author", fields: [authorId], references: [id], onUpdate: Cascade, onDelete: Cascade) 712 + author User? @relation(name: "author", fields: [authorId], references: [id], onUpdate: Cascade, onDelete: SetNull) 678 713 verifiedBy User? @relation(name: "verifiedBy", fields: [verifiedById], references: [id], onUpdate: Cascade, onDelete: SetNull) 679 714 verifiedAt DateTime? 680 715 opposedBy User? @relation(name: "opposedBy", fields: [opposedById], references: [id], onUpdate: Cascade, onDelete: SetNull) 681 716 opposedAt DateTime? 682 - cancelledBy User? @relation(name: "cancelledBy", fields: [cancelledById], references: [id], onDelete: SetNull, onUpdate: Cascade) 717 + cancelledBy User? @relation(name: "cancelledBy", fields: [cancelledById], references: [id], onUpdate: Cascade, onDelete: SetNull) 683 718 cancelledAt DateTime? 684 719 seenBy User[] @relation(name: "seenBy") 685 720 formAnswer Answer? 686 721 687 - search Unsupported("tsvector") @default(dbgenerated("''::tsvector")) 722 + // Those are kept in sync by a trigger, and are used for fuzzy-matching in a full text search 723 + authorFullName String? @default("") @db.VarChar(255) 724 + internalBeneficiaryFullName String? @default("") @db.VarChar(255) 725 + search Unsupported("tsvector") @default(dbgenerated("''::tsvector")) 688 726 689 727 @@index([search], type: Gin) 690 728 } ··· 702 740 703 741 /// A log entry is a log of an action that happened on the website 704 742 model LogEntry { 705 - id String @id @default(dbgenerated("nanoid('log:')")) 743 + id String @id @default(dbgenerated("nanoid('log:'::text)")) 706 744 happenedAt DateTime @default(now()) 707 745 userId String? 708 746 area String @db.VarChar(255) // billeterie, gestion clubs, etc. à typer, mais pas dans la DB (pour être plus flexible) ··· 715 753 716 754 /// A Lydia account 717 755 model LydiaAccount { 718 - id String @id @default(dbgenerated("nanoid('lydia:')")) 756 + id String @id @default(dbgenerated("nanoid('lydia:'::text)")) 719 757 groupId String? 720 758 group Group? @relation(fields: [groupId], references: [id], onUpdate: Cascade, onDelete: Cascade) 721 759 name String @default("") @db.VarChar(255) ··· 731 769 732 770 // Lydia payment 733 771 model LydiaTransaction { 734 - id String @id @default(dbgenerated("nanoid('lydiapayment:')")) 772 + id String @id @default(dbgenerated("nanoid('lydiapayment:'::text)")) 735 773 phoneNumber String @default("") @db.VarChar(255) 736 774 registrationId String? @unique 737 775 registration Registration? @relation(fields: [registrationId], references: [id], onUpdate: Cascade, onDelete: Cascade) ··· 757 795 758 796 /// Paypal payment 759 797 model PaypalTransaction { 760 - id String @id @default(dbgenerated("nanoid('paypalpayment:')")) 798 + id String @id @default(dbgenerated("nanoid('paypalpayment:'::text)")) 761 799 emailAddress String @default("") @db.VarChar(255) 762 800 registrationId String? @unique 763 801 registration Registration? @relation(fields: [registrationId], references: [id], onUpdate: Cascade, onDelete: Cascade) ··· 771 809 772 810 /// A NotificationSubscription stores a user's subscription to push notifications on a user agent 773 811 model NotificationSubscription { 774 - id String @id @default(dbgenerated("nanoid('notifsub:')")) 812 + id String @id @default(dbgenerated("nanoid('notifsub:'::text)")) 775 813 name String @default("") @db.VarChar(255) 776 814 createdAt DateTime @default(now()) 777 815 updatedAt DateTime @updatedAt ··· 786 824 787 825 /// A notification is a push notification that was sent to a user 788 826 model Notification { 789 - id String @id @default(dbgenerated("nanoid('notif:')")) 827 + id String @id @default(dbgenerated("nanoid('notif:'::text)")) 790 828 createdAt DateTime @default(now()) 791 829 updatedAt DateTime @updatedAt 792 830 timestamp DateTime? ··· 801 839 group Group? @relation(fields: [groupId], references: [id], onDelete: SetNull, onUpdate: Cascade) 802 840 groupId String? 803 841 channel NotificationChannel @default(Other) 804 - user User? @relation(fields: [userId], references: [id], onDelete: SetNull, onUpdate: Cascade) 842 + user User? @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade) 805 843 userId String? 806 844 goto String @default("") 807 845 } ··· 820 858 821 859 /// Announcement is a way to get a message accross the entire site, such as for maintenance announcements. 822 860 model Announcement { 823 - id String @id @default(dbgenerated("nanoid('ann:')")) 861 + id String @id @default(dbgenerated("nanoid('ann:'::text)")) 824 862 by User? @relation(fields: [userId], references: [id], onDelete: SetNull, onUpdate: Cascade) 825 863 userId String? 826 864 title String @db.VarChar(255) ··· 833 871 } 834 872 835 873 model TeachingUnit { 836 - id String @id @default(dbgenerated("nanoid('ue:')")) 874 + id String @id @default(dbgenerated("nanoid('ue:'::text)")) 837 875 name String @db.VarChar(255) 838 876 shortName String @default("") @db.VarChar(255) 839 877 apogeeCode String? @db.VarChar(255) ··· 841 879 } 842 880 843 881 model Subject { 844 - id String @id @default(dbgenerated("nanoid('subj:')")) 882 + id String @id @default(dbgenerated("nanoid('subj:'::text)")) 845 883 name String 846 884 slug String 847 885 shortName String @default("") @db.VarChar(255) ··· 879 917 } 880 918 881 919 model Document { 882 - id String @id @default(dbgenerated("nanoid('doc:')")) 920 + id String @id @default(dbgenerated("nanoid('doc:'::text)")) 883 921 slug String 884 922 createdAt DateTime @default(now()) 885 923 updatedAt DateTime @updatedAt ··· 894 932 paperPaths String[] // le sujet 895 933 solutionPaths String[] // la correction 896 934 897 - uploader User? @relation(fields: [uploaderId], references: [id], onDelete: Cascade, onUpdate: Cascade) 935 + uploader User? @relation(fields: [uploaderId], references: [id], onDelete: SetNull, onUpdate: Cascade) 898 936 uploaderId String? 899 937 900 - comments Comment[] 901 938 reactions Reaction[] 902 939 903 940 search Unsupported("tsvector") @default(dbgenerated("''::tsvector")) ··· 906 943 @@index([search], type: Gin) 907 944 } 908 945 909 - model Comment { 910 - id String @id @default(dbgenerated("nanoid('comment:')")) 911 - authorId String? 912 - body String @db.Text 913 - createdAt DateTime @default(now()) 914 - updatedAt DateTime @updatedAt 915 - author User? @relation(fields: [authorId], references: [id], onDelete: Cascade, onUpdate: Cascade) 916 - 917 - document Document? @relation(fields: [documentId], references: [id], onDelete: Cascade, onUpdate: Cascade) 918 - documentId String? 919 - article Article? @relation(fields: [articleId], references: [id], onDelete: Cascade, onUpdate: Cascade) 920 - articleId String? 921 - 922 - inReplyTo Comment? @relation(name: "reply", fields: [inReplyToId], references: [id], onDelete: SetNull, onUpdate: Cascade) 923 - inReplyToId String? 924 - replies Comment[] @relation(name: "reply") 925 - reactions Reaction[] 926 - } 927 - 928 946 model Reaction { 929 - id String @id @default(dbgenerated("nanoid('reac:')")) 947 + id String @id @default(dbgenerated("nanoid('reac:'::text)")) 930 948 emoji String 931 949 932 950 createdAt DateTime @default(now()) ··· 940 958 articleId String? 941 959 event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade, onUpdate: Cascade) 942 960 eventId String? 943 - comment Comment? @relation(fields: [commentId], references: [id], onDelete: Cascade, onUpdate: Cascade) 944 - commentId String? 945 961 946 962 @@unique([emoji, authorId, documentId]) 947 963 @@unique([emoji, authorId, articleId]) 948 964 @@unique([emoji, authorId, eventId]) 949 - @@unique([emoji, authorId, commentId]) 950 965 } 951 966 952 967 enum PromotionType { ··· 955 970 } 956 971 957 972 model PromotionCode { 958 - id String @id @default(dbgenerated("nanoid('promocode:')")) 973 + id String @id @default(dbgenerated("nanoid('promocode:'::text)")) 959 974 createdAt DateTime @default(now()) 960 975 updatedAt DateTime @updatedAt 961 976 claimedAt DateTime? 962 977 code String @unique 963 - claimedBy User? @relation(fields: [claimedById], references: [id]) 978 + claimedBy User? @relation(fields: [claimedById], references: [id], onDelete: Cascade) 964 979 claimedById String? 965 - promotion Promotion @relation(fields: [promotionId], references: [id]) 980 + promotion Promotion @relation(fields: [promotionId], references: [id], onDelete: Cascade) 966 981 promotionId String 967 982 } 968 983 969 984 model Promotion { 970 - id String @id @default(dbgenerated("nanoid('promo:')")) 985 + id String @id @default(dbgenerated("nanoid('promo:'::text)")) 971 986 createdAt DateTime @default(now()) 972 987 updatedAt DateTime @updatedAt 973 988 validUntil DateTime? ··· 981 996 } 982 997 983 998 model Form { 984 - id String @id @default(dbgenerated("nanoid('form:')")) 999 + id String @id @default(dbgenerated("nanoid('form:'::text)")) 985 1000 createdAt DateTime @default(now()) 986 1001 updatedAt DateTime @updatedAt 987 1002 createdBy User? @relation(fields: [createdById], references: [id], onDelete: SetNull, onUpdate: Cascade) ··· 1015 1030 } 1016 1031 1017 1032 model FormSection { 1018 - id String @id @default(dbgenerated("nanoid('formsection:')")) 1033 + id String @id @default(dbgenerated("nanoid('formsection:'::text)")) 1019 1034 order Int 1020 1035 form Form @relation(fields: [formId], references: [id], onDelete: Cascade) 1021 1036 formId String ··· 1033 1048 1034 1049 /// Represent a jump condition: answering a certain value of a certain question changes what section of the form is shown next 1035 1050 model FormJump { 1036 - id String @id @default(dbgenerated("nanoid('formjump:')")) 1051 + id String @id @default(dbgenerated("nanoid('formjump:'::text)")) 1037 1052 question Question @relation(fields: [questionId], references: [id], onDelete: Cascade) 1038 1053 questionId String 1039 1054 value String ··· 1042 1057 } 1043 1058 1044 1059 model Question { 1045 - id String @id @default(dbgenerated("nanoid('question:')")) 1060 + id String @id @default(dbgenerated("nanoid('question:'::text)")) 1046 1061 section FormSection @relation(fields: [sectionId], references: [id], onDelete: Cascade, onUpdate: Cascade) 1047 1062 sectionId String 1048 1063 order Int ··· 1082 1097 } 1083 1098 1084 1099 model Answer { 1085 - id String @id @default(dbgenerated("nanoid('answer:')")) 1100 + id String @id @default(dbgenerated("nanoid('answer:'::text)")) 1086 1101 question Question @relation(fields: [questionId], references: [id], onDelete: Cascade) 1087 1102 questionId String 1088 1103 1089 1104 createdAt DateTime @default(now()) 1090 1105 updatedAt DateTime @updatedAt 1091 1106 1092 - createdBy User? @relation(fields: [createdById], references: [id], onDelete: SetNull, onUpdate: Cascade) 1107 + createdBy User? @relation(fields: [createdById], references: [id], onDelete: Cascade, onUpdate: Cascade) 1093 1108 createdById String? 1094 1109 1095 1110 /// Only the first value is considered for all types except SelectMultiple. ··· 1110 1125 1111 1126 /// A user-defined markdown page, useful for custom pages, only liked to student associations for now. 1112 1127 model Page { 1113 - id String @id @default(dbgenerated("nanoid('page:')")) 1128 + id String @id @default(dbgenerated("nanoid('page:'::text)")) 1114 1129 1115 1130 // Paths are unique per linked resource, final URL of the page should therefore be namespaced 1116 1131 path String @db.VarChar(255) ··· 1140 1155 } 1141 1156 1142 1157 model Theme { 1143 - id String @id @default(dbgenerated("nanoid('theme:')")) 1158 + id String @id @default(dbgenerated("nanoid('theme:'::text)")) 1144 1159 name String @db.VarChar(255) 1145 1160 values ThemeValue[] 1146 1161 createdAt DateTime @default(now()) 1147 1162 updatedAt DateTime @updatedAt 1148 1163 visibility Visibility @default(Private) 1149 - startsAt DateTime @default(now()) 1150 - endsAt DateTime 1164 + startsAt DateTime? @default(now()) 1165 + endsAt DateTime? 1151 1166 author Group? @relation(fields: [authorId], references: [id], onDelete: SetNull, onUpdate: Cascade) 1152 1167 authorId String? 1153 1168 ··· 1186 1201 } 1187 1202 1188 1203 model ThemeValue { 1189 - id String @id @default(dbgenerated("nanoid('themeval:')")) 1204 + id String @id @default(dbgenerated("nanoid('themeval:'::text)")) 1190 1205 variable ThemeVariable 1191 1206 value String @db.VarChar(500) 1192 1207 theme Theme @relation(fields: [themeId], references: [id], onDelete: Cascade, onUpdate: Cascade)