repository code added

This commit is contained in:
Eudes Inácio
2024-05-27 15:53:13 +01:00
parent caa11d6be7
commit 08303ef8cf
5 changed files with 185 additions and 75 deletions
@@ -1,103 +1,105 @@
import { z } from 'zod';
const AttachCommunicationInputModel = z.object({
export const AttachCommunicationInputDTOSchema = z.object({
attachmentId: z.string().uuid(),
description: z.string().nullable().optional(),
typeSharing: z.number().int(),
dateViewExpire: z.string().datetime().nullable().optional(),
}).strict();
const AttachmentInputModel = z.object({
export const AttachmentInputDTOSchema = z.object({
sourceId: z.string().nullable().optional(),
sourceName: z.string().nullable().optional(),
description: z.string().nullable().optional(),
applicationId: z.number().int(),
}).strict();
const AttendeeCommunicationInputModel = z.object({
export const AttendeeCommunicationInputDTOSchema = z.object({
attendeeId: z.string().uuid(),
message: z.string().nullable().optional(),
}).strict();
const AttendeeExternalInputModel = z.object({
export const AttendeeExternalInputDTOSchema = z.object({
name: z.string().min(1),
emailAddress: z.string().email().nullable().optional(),
message: z.string().nullable().optional(),
}).strict();
const AttendeeInputModel = z.object({
export const AttendeeInputDTOSchema = z.object({
name: z.string().min(1),
emailAddress: z.string().nullable().optional(),
attendeeType: z.enum(["0", "1", "2"]),
wxUserId: z.number().int(),
}).strict();
const EAttendeeType = z.enum(["0", "1", "2"]);
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
const EEventCategory = z.enum(["1", "2"]);
const EEventCategoryDTO = z.enum(["1", "2"]);
const EEventFilterCategory = z.enum(["1", "2", "3"]);
const EEventFilterCategoryDTO = z.enum(["1", "2", "3"]);
const EEventFilterStatus = z.enum(["0", "1", "2", "3", "4", "5"]);
const EEventFilterStatusDTO = z.enum(["0", "1", "2", "3", "4", "5"]);
const EEventFilterType = z.enum(["1", "2", "3", "4"]);
const EEventFilterTypeDTO = z.enum(["1", "2", "3", "4"]);
const EEventOwnerType = z.enum(["1", "2", "3"]);
const EEventOwnerTypeDTO = z.enum(["1", "2", "3"]);
const EEventStatus = z.enum(["0", "1", "2", "3", "4"]);
const EEventStatusDTO = z.enum(["0", "1", "2", "3", "4"]);
const EEventType = z.enum(["1", "2", "3"]);
const EEventTypeDTO = z.enum(["1", "2", "3"]);
const ERecurringType = z.enum(["0", "1", "2", "3", "4"]);
const ERecurringTypeDTO = z.enum(["0", "1", "2", "3", "4"]);
const EventAddAttachmentModel = z.object({
attachments: z.array(AttachmentInputModel),
const EventAddAttachmentDTOSchema = z.object({
attachments: z.array(AttachmentInputDTOSchema),
}).strict();
const EventAddAttendeeModel = z.object({
attendees: z.array(AttendeeInputModel),
const EventAddAttendeeDTOSchema = z.object({
attendees: z.array(AttendeeInputDTOSchema),
}).strict();
const EventCommunicationInputModel = z.object({
attachs: z.array(AttachCommunicationInputModel).nullable().optional(),
attendees: z.array(AttendeeCommunicationInputModel).nullable().optional(),
externalAttendees: z.array(AttendeeExternalInputModel).nullable().optional(),
export const EventCommunicationInputDTOSchema = z.object({
attachs: z.array(AttachCommunicationInputDTOSchema).nullable().optional(),
attendees: z.array(AttendeeCommunicationInputDTOSchema).nullable().optional(),
externalAttendees: z.array(AttendeeExternalInputDTOSchema).nullable().optional(),
}).strict();
const EventInputModel = z.object({
export const EventInputDTOSchema = z.object({
userId: z.number().int(),
ownerType: EEventOwnerType,
ownerType: EEventOwnerTypeDTO,
subject: z.string().min(1),
body: z.string().min(1),
location: z.string().nullable().optional(),
startDate: z.string().datetime(),
endDate: z.string().datetime(),
type: EEventType,
category: EEventCategory,
attendees: z.array(AttendeeInputModel).nullable().optional(),
attachments: z.array(AttachmentInputModel).nullable().optional(),
type: EEventTypeDTO,
category: EEventCategoryDTO,
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
attachments: z.array(AttachmentInputDTOSchema).nullable().optional(),
recurrence: z.object({
frequency: ERecurringType,
frequency: ERecurringTypeDTO,
occurrences: z.number().int(),
}),
organizerId: z.number().int(),
isAllDayEvent: z.boolean(),
}).strict();
const EventRecurrenceInputModel = z.object({
frequency: ERecurringType,
export const EventRecurrenceInputDTOSchema = z.object({
frequency: ERecurringTypeDTO,
occurrences: z.number().int(),
}).strict();
const EventRemoveAttachmentModel = z.object({
export const EventRemoveAttachmentDTOSchema = z.object({
attachments: z.array(z.string().uuid()),
}).strict();
const EventRemoveAttendeeModel = z.object({
export const EventRemoveAttendeeDTOSchema = z.object({
attendees: z.array(z.string().uuid()),
}).strict();
const EventUpdateModel = z.object({
export const EventUpdateDTOSchema = z.object({
subject: z.string().min(1),
body: z.string().min(1),
location: z.string().min(1),
@@ -106,17 +108,17 @@ const EventUpdateModel = z.object({
isAllDayEvent: z.boolean(),
updateAllEvents: z.boolean(),
recurrence: z.object({
frequency: ERecurringType,
frequency: ERecurringTypeDTO,
occurrences: z.number().int(),
}),
}).strict();
const EventUpdateStatusModel = z.object({
status: EEventStatus,
export const EventUpdateStatusDTOSchema = z.object({
status: EEventStatusDTO,
comment: z.string().nullable().optional(),
}).strict();
const ProblemDetails = z.object({
export const ProblemDetailsDTOSchema = z.object({
type: z.string().nullable().optional(),
title: z.string().nullable().optional(),
status: z.number().int().nullable().optional(),
@@ -124,43 +126,26 @@ const ProblemDetails = z.object({
instance: z.string().nullable().optional(),
}).strict();
const ResponseSimpleModel = z.object({
export const ResponseSimpleDTOSchema = z.object({
success: z.boolean(),
message: z.string().nullable().optional(),
data: z.any().nullable().optional(),
}).strict();
})
const Bearer = z.object({
type: z.literal('http'),
description: z.string().optional(),
scheme: z.literal('bearer'),
}).strict();
export {
AttachCommunicationInputModel,
AttachmentInputModel,
AttendeeCommunicationInputModel,
AttendeeExternalInputModel,
AttendeeInputModel,
EAttendeeType,
EEventCategory,
EEventFilterCategory,
EEventFilterStatus,
EEventFilterType,
EEventOwnerType,
EEventStatus,
EEventType,
ERecurringType,
EventAddAttachmentModel,
EventAddAttendeeModel,
EventCommunicationInputModel,
EventInputModel,
EventRecurrenceInputModel,
EventRemoveAttachmentModel,
EventRemoveAttendeeModel,
EventUpdateModel,
EventUpdateStatusModel,
ProblemDetails,
ResponseSimpleModel,
Bearer,
};
export type AttachCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type AttachmentInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type AttendeeCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type AttendeeExternalInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type AttendeeInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventAddAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventAddAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventInputDTO = z.infer<typeof EventInputDTOSchema>;
export type EventRecurrenceInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventRemoveAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventRemoveAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventUpdateDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type EventUpdateStatusDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type ProblemDetailsDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
export type ResponseSimpleDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;