add message status

This commit is contained in:
Peter Maquiran
2024-08-06 12:01:59 +01:00
parent 2f214e0025
commit 0e71b27de5
3 changed files with 60 additions and 3 deletions
@@ -0,0 +1,51 @@
import { z } from "zod";
const MessageEntitySchema = z.object({
$id: z.any().optional(),
id: z.string().optional(),
roomId: z.string().uuid(),
message: z.string(),
messageType: z.number(),
canEdit: z.boolean(),
oneShot: z.boolean(),
sentAt: z.string().optional(),
requireUnlock: z.boolean(),
sender: z.object({
wxUserId: z.number(),
wxFullName: z.string(),
wxeMail: z.string(),
userPhoto: z.string(),
}),
sending: z.boolean().optional()
})
type Message = z.infer<typeof MessageEntitySchema>;
export class MessageEntity implements Message {
$id: number
id: string
roomId: string
message: string
messageType: number
canEdit: boolean
oneShot: boolean
sentAt: string
requireUnlock: boolean
sender: {
wxUserId: number,
wxFullName: string,
wxeMail: string,
userPhoto: string,
}
sending: boolean
constructor() {}
get messageStatus() {
if(this.id) {
return 'send'
}
}
}