Friendship (request/accept/decline/remove, self-request and crossing-request handling, DB-level pair uniqueness via a hand-written expression index), ChatRoom/ChatMessage/ChatReadState backed by Nitro's built-in websocket (server/api/v1/community/ws.get.ts) behind a ChatTransport seam (server/internal/community/chatTransport.ts) with a REST send fallback. Mid-milestone product redirect: chat's primary job is coordinating the persistent-world servers (EQEmu/WoW/DAoC), not per-title discussion -- ChatRoomKind gets a first-class `server` case and chatService.ts ships a static KNOWN_SERVERS registry keyed the same way M4's GameServer will be, once that lands (gameServerId reserved for that wiring-up pass). Presence has no new table -- "online" is a live websocket registry (presenceRuntime.ts), "playing X" reads through an isolated query module (presenceService.ts) that degrades to an empty, clearly-labeled result if PlaySession's shape doesn't match what it expects. Pages: /community/friends, /community/chat, plus a friends/servers strip on /community itself. Migration 20260803120000_m3_friends_chat.
55 lines
1.6 KiB
Text
55 lines
1.6 KiB
Text
model User {
|
|
id String @id @default(uuid())
|
|
username String @unique
|
|
admin Boolean @default(false)
|
|
enabled Boolean @default(true)
|
|
|
|
email String
|
|
displayName String
|
|
profilePictureObjectId String // Object
|
|
|
|
authMecs LinkedAuthMec[]
|
|
mfas LinkedMFAMec[]
|
|
|
|
clients Client[]
|
|
notifications Notification[]
|
|
collections Collection[]
|
|
articles Article[]
|
|
|
|
tokens APIToken[]
|
|
sessions Session[]
|
|
|
|
saves SaveSlot[]
|
|
screenshots Screenshot[]
|
|
playtime Playtime[]
|
|
|
|
// See content.prisma's Game model for why M5 (and future milestones) do
|
|
// NOT add a relation array here -- Mod/ModInstallation reference User.id
|
|
// as a plain, unenforced-by-FK column, same pattern as devices.prisma.
|
|
|
|
// --- M3: friends, presence, chat ---
|
|
friendshipsSent Friendship[] @relation("FriendshipRequester")
|
|
friendshipsReceived Friendship[] @relation("FriendshipAddressee")
|
|
chatRoomsCreated ChatRoom[] @relation("ChatRoomCreatedBy")
|
|
chatMessages ChatMessage[] @relation("ChatMessageSender")
|
|
chatReadStates ChatReadState[] @relation("ChatReadState")
|
|
}
|
|
|
|
model Notification {
|
|
id String @id @default(uuid())
|
|
|
|
nonce String?
|
|
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
acls String[]
|
|
|
|
created DateTime @default(now())
|
|
title String
|
|
description String
|
|
actions String[]
|
|
|
|
read Boolean @default(false)
|
|
|
|
@@unique([userId, nonce])
|
|
}
|