integrate list event with opentelemetry

This commit is contained in:
Peter Maquiran
2024-06-17 12:00:07 +01:00
parent 768dc10308
commit 2665bf3f96
9 changed files with 89 additions and 35 deletions
@@ -1,25 +1,40 @@
import { z } from 'zod';
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
const EventSchema = z.array(z.object({
const OwnerSchema = z.object({
wxUserId: z.number(),
wxFullName: z.string(),
wxeMail: z.string(),
userPhoto: z.string(),
});
export const EventListOutputDTOSchema = z.object({
id: z.string(),
owner: z.string().nullable(),
owner: OwnerSchema,
ownerType: z.nativeEnum(EEventOwnerType),// ['MD','PR', 'Other'] // Assuming "MD" is the only valid option based on provided data
subject: z.string(),
body: z.string(),
location: z.string(),
location: z.string().nullable(),
startDate: z.string().datetime({ offset: true }),
endDate: z.string().datetime({ offset: true }),
type: z.nativeEnum(EEventType), // ['Meeting', 'Travel'] = [1,2 ]
// category: z.enum(['Oficial', 'Pessoal']), // Assuming "Oficial" is the only valid option based on provided data
category: z.nativeEnum(EEventCategory),
isRecurring: z.boolean(),
eventRecurrence: z.null(),
eventRecurrence: z.any().nullable(),
hasAttachments: z.boolean(),
isPrivate: z.boolean(),
isAllDayEvent: z.boolean(),
// status: z.enum(['Approved']), // Assuming "Approved" is the only valid option based on provided data
status: z.nativeEnum(EEventStatus), // Assuming "Approved" is the only valid option based on provided data
}))
})
export type EventListOutputDTO = z.infer<typeof EventSchema>;
export const EventListDataOutputDTOSchema = z.object({
success: z.boolean(),
message: z.string(),
data: z.array(EventListOutputDTOSchema),
}).nullable();
export type EventListOutputDTO = z.infer<typeof EventListDataOutputDTOSchema>;
@@ -7,7 +7,7 @@ const EventToApproveList = z.array(z.object({
ownerType: z.nativeEnum(EEventOwnerType),
subject: z.string(),
body: z.string(),
location: z.string(),
location: z.string().nullable(),
startDate: z.string().datetime(),
endDate: z.string().datetime(),
type: z.nativeEnum(EEventType),
@@ -20,4 +20,11 @@ const EventToApproveList = z.array(z.object({
status: z.nativeEnum(EEventStatus)
}))
export type EventToApproveListOutputDTO = z.infer<typeof EventToApproveList>;
export const EventToApproveDataOutputDTOSchema = z.object({
success: z.boolean(),
message: z.string(),
data: EventToApproveList,
}).nullable();
export type EventToApproveListOutputDTO = z.infer<typeof EventToApproveDataOutputDTOSchema>;