jan/web-client/app/_models/ChatMessage.ts
hiento09 86f0ffc7d1
Chore/disable submodule (#56)
* Chore disable git submodule for web-client and app-backend

* Chore add newest source code of app-backend and web-client

---------

Co-authored-by: Hien To <tominhhien97@gmail.com>
2023-09-05 16:29:07 +07:00

36 lines
950 B
TypeScript

import { types } from "mobx-state-tree";
import { withSetPropAction } from "../_helpers/withSetPropAction";
export enum MessageType {
Text = "Text",
Image = "Image",
ImageWithText = "ImageWithText",
Error = "Error",
}
export enum MessageSenderType {
Ai = "Ai",
User = "User",
}
export enum MessageStatus {
Ready = "ready",
Pending = "pending",
}
export const ChatMessage = types
.model("ChatMessage", {
id: types.string,
conversationId: types.string,
messageType: types.enumeration(Object.values(MessageType)),
messageSenderType: types.enumeration(Object.values(MessageSenderType)),
senderUid: types.string,
senderName: types.string,
senderAvatarUrl: types.maybeNull(types.string),
text: types.maybe(types.string),
imageUrls: types.maybe(types.array(types.string)),
createdAt: types.number,
status: types.enumeration(Object.values(MessageStatus)),
})
.actions(withSetPropAction);