Files
doneit-web/src/app/module/chat/data/dto/message/messageOutputDTO.ts
T

57 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-06-04 16:21:11 +01:00
import { z } from "zod"
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
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(),
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({})),
attachments: z.array(z.object({
fileType: z.nativeEnum(MessageAttachmentFileType),
source: z.nativeEnum(MessageAttachmentSource),
2024-08-13 10:52:35 +01:00
file: z.string().optional(),
fileName: z.string().optional(),
2024-08-09 10:50:32 +01:00
applicationId: z.string().optional(),
2024-08-13 10:52:35 +01:00
docId: z.string().optional(),
id: z.string()
}))
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>