2024-06-04 16:21:11 +01:00
|
|
|
import { z } from "zod"
|
|
|
|
|
|
2024-08-08 10:07:25 +01:00
|
|
|
export enum MessageAttachmentSource {
|
|
|
|
|
Webtrix = 1,
|
|
|
|
|
Device,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum MessageAttachmentFileType {
|
|
|
|
|
Doc = 1,
|
|
|
|
|
Image ,
|
|
|
|
|
Audio ,
|
|
|
|
|
Video
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-08 11:44:41 +01:00
|
|
|
export const MessageOutPutDataDTOSchema = z.object({
|
2024-06-05 14:31:26 +01:00
|
|
|
id: z.string(),
|
2024-08-08 09:58:44 +01:00
|
|
|
roomId: z.string(),
|
2024-06-10 16:34:43 +01:00
|
|
|
sender: z.object({
|
|
|
|
|
wxUserId: z.number(),
|
|
|
|
|
wxFullName: z.string(),
|
|
|
|
|
wxeMail: z.string(),
|
|
|
|
|
userPhoto: z.string().optional()
|
2024-08-08 15:53:00 +01:00
|
|
|
}),
|
2024-08-08 11:44:41 +01:00
|
|
|
message: z.string().nullable(),
|
2024-06-05 14:31:26 +01:00
|
|
|
messageType: z.number(),
|
2024-06-10 16:34:43 +01:00
|
|
|
sentAt: z.string(),
|
2024-06-05 14:31:26 +01:00
|
|
|
deliverAt: z.string().datetime().nullable(),
|
|
|
|
|
canEdit: z.boolean(),
|
|
|
|
|
oneShot: z.boolean(),
|
2024-07-31 17:23:44 +01:00
|
|
|
requireUnlock: z.boolean(),
|
2024-08-08 11:44:41 +01:00
|
|
|
requestId: z.string().optional(),
|
2024-08-08 10:07:25 +01:00
|
|
|
reactions: z.object({
|
|
|
|
|
id: z.string(),
|
|
|
|
|
reactedAt: z.string(),
|
|
|
|
|
reaction: z.string(),
|
|
|
|
|
sender: z.object({}),
|
|
|
|
|
}).array(),
|
2024-08-08 09:58:44 +01:00
|
|
|
info: z.array(z.object({})),
|
2024-08-08 10:07:25 +01:00
|
|
|
attachments: z.array(z.object({
|
|
|
|
|
fileType: z.nativeEnum(MessageAttachmentFileType),
|
|
|
|
|
source: z.nativeEnum(MessageAttachmentSource),
|
|
|
|
|
file: z.string(),
|
|
|
|
|
fileName: z.string(),
|
2024-08-09 10:50:32 +01:00
|
|
|
applicationId: z.string().optional(),
|
|
|
|
|
docId: z.string().optional()
|
2024-08-08 10:07:25 +01:00
|
|
|
}))
|
2024-06-05 14:31:26 +01:00
|
|
|
});
|
|
|
|
|
|
2024-06-10 16:34:43 +01:00
|
|
|
export const MessageOutPutDTOSchema = z.object({
|
2024-06-05 10:28:38 +01:00
|
|
|
success: z.boolean(),
|
|
|
|
|
message: z.string(),
|
2024-08-08 11:44:41 +01:00
|
|
|
data: MessageOutPutDataDTOSchema.array()
|
2024-06-04 16:21:11 +01:00
|
|
|
});
|
|
|
|
|
|
2024-08-08 11:44:41 +01:00
|
|
|
export type MessageOutPutDataDTO = z.infer<typeof MessageOutPutDataDTOSchema>
|
2024-06-10 16:34:43 +01:00
|
|
|
export type MessageOutPutDTO = z.infer<typeof MessageOutPutDTOSchema>
|