@waylis/core / ChatDatabase
Interface: ChatDatabase
Defined in: src/chat/chat.ts:18
Abstraction for chat persistence operations.
Extended by
Methods
addChat()
addChat(chat: Chat): Promise<void>;
Defined in: src/chat/chat.ts:23
Add a new chat to the database.
Parameters
chat
Chat object to store.
Returns
Promise
<void
>
countChatsByCreatorID()
countChatsByCreatorID(creatorID: string): Promise<number>;
Defined in: src/chat/chat.ts:44
Count how many chats were created by a user.
Parameters
creatorID
string
User identifier.
Returns
Promise
<number
>
deleteChatByID()
deleteChatByID(id: string): Promise<null | Chat>;
Defined in: src/chat/chat.ts:59
Remove a chat by ID.
Parameters
id
string
Chat identifier.
Returns
Promise
<null
| Chat
>
Deleted chat or null if not found.
editChatByID()
editChatByID(id: string, updated: Partial<Chat>): Promise<null | Chat>;
Defined in: src/chat/chat.ts:52
Update a chat by ID.
Parameters
id
string
Chat identifier.
updated
Partial
<Chat
>
Partial fields to update.
Returns
Promise
<null
| Chat
>
Updated chat or null if not found.
getChatByID()
getChatByID(id: string): Promise<null | Chat>;
Defined in: src/chat/chat.ts:30
Retrieve a chat by its ID.
Parameters
id
string
Chat identifier.
Returns
Promise
<null
| Chat
>
Chat if found, otherwise null.
getChatsByCreatorID()
getChatsByCreatorID(
creatorID: string,
offset: number,
limit: number): Promise<Chat[]>;
Defined in: src/chat/chat.ts:38
Retrieve chats created by a specific user.
Parameters
creatorID
string
User identifier.
offset
number
Skip this many results.
limit
number
Maximum number of results.
Returns
Promise
<Chat
[]>