list events

This commit is contained in:
Peter Maquiran
2024-05-29 15:45:34 +01:00
parent caa11d6be7
commit 38d36a6e49
22 changed files with 629 additions and 198 deletions
@@ -0,0 +1,62 @@
import { z } from 'zod';
export const AttachmentInputDTOSchema = z.object({
sourceId: z.string().nullable(),
sourceName: z.string().nullable(),
description: z.string().nullable(),
applicationId: z.number().int(),
}).strict();
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
const CommentSchema = z.object({
message: z.string(),
createdAt: z.string(),
});
const AttendeeSchema = z.object({
id: z.string(),
name: z.string(),
attendeeType: EAttendeeTypeDTO,
emailAddress: z.string(),
wxUserId: z.number(),
});
const OwnerSchema = z.object({
wxUserId: z.number(),
wxFullName: z.string(),
wxeMail: z.string(),
userPhoto: z.string(),
});
const OrganizerSchema = z.object({
wxUserId: z.number(),
wxFullName: z.string(),
wxeMail: z.string(),
userPhoto: z.string(),
});
export const EventOutputDTOSchema = z.object({
id: z.string(),
owner: OwnerSchema,
ownerType: z.string(),
subject: z.string(),
body: z.string(),
location: z.string(),
startDate: z.string(),
endDate: z.string(),
type: z.string(),
category: z.string(),
attendees: z.array(AttendeeSchema),
isRecurring: z.boolean(),
eventRecurrence: z.null(),
hasAttachments: z.boolean(),
attachments:z.array(AttachmentInputDTOSchema),
comments: z.array(CommentSchema),
isPrivate: z.boolean(),
isAllDayEvent: z.boolean(),
organizer: OrganizerSchema,
status: z.string(),
});
export type EventOutputDTO = z.infer<typeof EventOutputDTOSchema>
@@ -0,0 +1,22 @@
import { z } from 'zod';
const EventSchema = z.array(z.object({
id: z.string(),
owner: z.string().nullable(),
ownerType: z.enum(['MD','PR', 'Other']), // Assuming "MD" is the only valid option based on provided data
subject: z.string(),
body: z.string(),
location: z.string(),
startDate: z.string().datetime({ offset: true }),
endDate: z.string().datetime({ offset: true }),
type: z.enum(['Meeting', 'Travel']),
category: z.enum(['Oficial', 'Pessoal']), // Assuming "Oficial" is the only valid option based on provided data
isRecurring: z.boolean(),
eventRecurrence: z.null(),
hasAttachments: z.boolean(),
isPrivate: z.boolean(),
isAllDayEvent: z.boolean(),
status: z.enum(['Approved']), // Assuming "Approved" is the only valid option based on provided data
}))
export type EventListOutputDTO = z.infer<typeof EventSchema>;
@@ -0,0 +1,20 @@
import { z } from "zod";
const EventToApproveList = z.object({
id: z.string().uuid(),
owner: z.string().nullable(),
ownerType: z.enum(["PR", "MD", "Other"]),
subject: z.string(),
body: z.string(),
location: z.string(),
startDate: z.string().datetime(),
endDate: z.string().datetime(),
type: z.enum(["Meeting"]),
category: z.enum(["Oficial", "Pessoal"]),
isRecurring: z.boolean(),
eventRecurrence: z.any().nullable(),
hasAttachments: z.boolean(),
isPrivate: z.boolean(),
isAllDayEvent: z.boolean(),
status: z.enum(["Pending"])
});