2024-05-29 15:45:34 +01:00
|
|
|
import { z } from 'zod';
|
2024-07-31 11:29:26 +01:00
|
|
|
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
|
2024-06-17 12:00:07 +01:00
|
|
|
|
|
|
|
|
const OwnerSchema = z.object({
|
|
|
|
|
wxUserId: z.number(),
|
|
|
|
|
wxFullName: z.string(),
|
|
|
|
|
wxeMail: z.string(),
|
2025-09-05 11:42:36 +01:00
|
|
|
userPhoto: z.string().nullable(),
|
2024-06-17 12:00:07 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const EventListOutputDTOSchema = z.object({
|
2024-05-29 15:45:34 +01:00
|
|
|
id: z.string(),
|
2024-06-17 12:00:07 +01:00
|
|
|
owner: OwnerSchema,
|
2024-06-13 16:47:51 +01:00
|
|
|
ownerType: z.nativeEnum(EEventOwnerType),// ['MD','PR', 'Other'] // Assuming "MD" is the only valid option based on provided data
|
2024-05-29 15:45:34 +01:00
|
|
|
subject: z.string(),
|
2024-06-22 13:28:14 +01:00
|
|
|
body: z.string().optional(),
|
2024-06-17 12:00:07 +01:00
|
|
|
location: z.string().nullable(),
|
2024-05-29 15:45:34 +01:00
|
|
|
startDate: z.string().datetime({ offset: true }),
|
|
|
|
|
endDate: z.string().datetime({ offset: true }),
|
2024-06-13 16:47:51 +01:00
|
|
|
type: z.nativeEnum(EEventType), // ['Meeting', 'Travel'] = [1,2 ]
|
2024-06-13 16:01:33 +01:00
|
|
|
// category: z.enum(['Oficial', 'Pessoal']), // Assuming "Oficial" is the only valid option based on provided data
|
2024-06-13 16:47:51 +01:00
|
|
|
category: z.nativeEnum(EEventCategory),
|
2024-05-29 15:45:34 +01:00
|
|
|
isRecurring: z.boolean(),
|
2024-06-17 12:00:07 +01:00
|
|
|
eventRecurrence: z.any().nullable(),
|
2024-05-29 15:45:34 +01:00
|
|
|
hasAttachments: z.boolean(),
|
|
|
|
|
isPrivate: z.boolean(),
|
|
|
|
|
isAllDayEvent: z.boolean(),
|
2024-06-13 16:01:33 +01:00
|
|
|
// status: z.enum(['Approved']), // Assuming "Approved" is the only valid option based on provided data
|
2024-06-13 16:47:51 +01:00
|
|
|
status: z.nativeEnum(EEventStatus), // Assuming "Approved" is the only valid option based on provided data
|
2024-06-26 13:45:25 +01:00
|
|
|
createdAt: z.string().datetime({ offset: true }),
|
2024-06-17 12:00:07 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export const EventListDataOutputDTOSchema = z.object({
|
|
|
|
|
success: z.boolean(),
|
|
|
|
|
message: z.string(),
|
|
|
|
|
data: z.array(EventListOutputDTOSchema),
|
|
|
|
|
}).nullable();
|
2024-05-29 15:45:34 +01:00
|
|
|
|
2024-06-17 12:00:07 +01:00
|
|
|
export type EventListOutputDTO = z.infer<typeof EventListDataOutputDTOSchema>;
|