Spaces:
Configuration error
Configuration error
// 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" | |
} | |
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") | |
} | |
model User { | |
id String | |
email String | |
username String | |
displayName String | |
password String | |
avatar String? | |
bio String? | |
isOnline Boolean | |
lastSeen DateTime | |
isAdmin Boolean | |
isVerified Boolean | |
createdAt DateTime | |
updatedAt DateTime | |
// Relations | |
sentMessages Message[] | |
chatParticipants ChatParticipant[] | |
messageReactions MessageReaction[] | |
ownedGroups Group[] | |
notifications Notification[] | |
userSessions UserSession[] | |
@ | |
} | |
model Chat { | |
id String | |
type ChatType | |
name String? | |
description String? | |
avatar String? | |
createdAt DateTime | |
updatedAt DateTime | |
// Relations | |
participants ChatParticipant[] | |
messages Message[] | |
group Group? | |
@ | |
} | |
model ChatParticipant { | |
id String | |
chatId String | |
userId String | |
role ParticipantRole | |
permissions Json? | |
joinedAt DateTime | |
leftAt DateTime? | |
// Relations | |
chat Chat | |
user User | |
@ | |
@ | |
} | |
model Message { | |
id String | |
chatId String | |
senderId String | |
content String | |
type MessageType | |
replyToId String? | |
isEdited Boolean | |
isDeleted Boolean | |
createdAt DateTime | |
updatedAt DateTime | |
// Relations | |
chat Chat | |
sender User | |
replyTo Message? | |
replies Message[] | |
attachments MessageAttachment[] | |
reactions MessageReaction[] | |
@ | |
} | |
model MessageAttachment { | |
id String | |
messageId String | |
type String | |
name String | |
url String | |
size Int | |
mimeType String | |
thumbnail String? | |
// Relations | |
message Message | |
@ | |
} | |
model MessageReaction { | |
id String | |
messageId String | |
userId String | |
emoji String | |
createdAt DateTime | |
// Relations | |
message Message | |
user User | |
@ | |
@ | |
} | |
model Group { | |
id String | |
chatId String | |
name String | |
description String? | |
avatar String? | |
type GroupType | |
maxMembers Int | |
ownerId String | |
settings Json? | |
createdAt DateTime | |
updatedAt DateTime | |
// Relations | |
chat Chat | |
owner User | |
@ | |
} | |
model Notification { | |
id String | |
userId String | |
type NotificationType | |
title String | |
content String | |
data Json? | |
isRead Boolean | |
createdAt DateTime | |
// Relations | |
user User | |
@ | |
} | |
model UserSession { | |
id String | |
userId String | |
token String | |
userAgent String? | |
ipAddress String? | |
expiresAt DateTime | |
createdAt DateTime | |
// Relations | |
user User | |
@ | |
} | |
// Enums | |
enum ChatType { | |
DIRECT | |
GROUP | |
} | |
enum ParticipantRole { | |
MEMBER | |
ADMIN | |
OWNER | |
} | |
enum MessageType { | |
TEXT | |
IMAGE | |
FILE | |
AUDIO | |
VIDEO | |
SYSTEM | |
} | |
enum GroupType { | |
PUBLIC | |
PRIVATE | |
} | |
enum NotificationType { | |
MESSAGE | |
MENTION | |
GROUP_INVITE | |
SYSTEM | |
} | |