Showing
1 changed file
with
13 additions
and
15 deletions
... | @@ -18,27 +18,27 @@ model User { | ... | @@ -18,27 +18,27 @@ model User { |
18 | emailSecret String? @default("") | 18 | emailSecret String? @default("") |
19 | phoneSecret String? @default("") | 19 | phoneSecret String? @default("") |
20 | bio String? @default("") | 20 | bio String? @default("") |
21 | - rooms Room[] @relation(references: [id]) | 21 | + groups Group[] @relation(references: [id]) |
22 | messages Message[] | 22 | messages Message[] |
23 | - sender User[] @relation("SenderReceiver", references: [id]) | 23 | + directMessages DirectMessage[] |
24 | - receiver User[] @relation("SenderReceiver", references: [id]) | ||
25 | createdAt DateTime? @default(now()) | 24 | createdAt DateTime? @default(now()) |
26 | } | 25 | } |
27 | 26 | ||
28 | -model Room { | 27 | +model Group { |
29 | id Int @default(autoincrement()) @id | 28 | id Int @default(autoincrement()) @id |
30 | name String @unique | 29 | name String @unique |
31 | - participants User[] @relation(references: [id]) | 30 | + participants User[] |
32 | - categories Category[] | ||
33 | messages Message[] | 31 | messages Message[] |
32 | + files String? @default("") | ||
33 | + createdAt DateTime? @default(now()) | ||
34 | } | 34 | } |
35 | 35 | ||
36 | -model Category { | 36 | +model DirectMessage { |
37 | id Int @default(autoincrement()) @id | 37 | id Int @default(autoincrement()) @id |
38 | - name String @default("") @unique | 38 | + text String @default("") |
39 | - room Room @relation(fields: [roomId], references: [id]) | 39 | + sender User @relation(fields: [senderId], references: [id]) |
40 | - roomId Int | 40 | + senderId Int |
41 | - messages Message[] | 41 | + createdAt DateTime? @default(now()) |
42 | } | 42 | } |
43 | 43 | ||
44 | model Message { | 44 | model Message { |
... | @@ -46,9 +46,7 @@ model Message { | ... | @@ -46,9 +46,7 @@ model Message { |
46 | text String @default("") | 46 | text String @default("") |
47 | sender User @relation(fields: [senderId], references: [id]) | 47 | sender User @relation(fields: [senderId], references: [id]) |
48 | senderId Int | 48 | senderId Int |
49 | - room Room @relation(fields: [roomId], references: [id]) | 49 | + group Group @relation(fields: [groupId], references: [id]) |
50 | - roomId Int | 50 | + groupId Int |
51 | createdAt DateTime? @default(now()) | 51 | createdAt DateTime? @default(now()) |
52 | - category Category? @relation(fields: [categoryId], references: [id]) | ||
53 | - categoryId Int? | ||
54 | } | 52 | } | ... | ... |
-
Please register or login to post a comment