Files
doneit-web/src/app/services/Repositorys/Agenda/agendaDataModels.ts
T
2024-06-07 14:10:17 +01:00

152 lines
5.2 KiB
TypeScript

import { z } from 'zod';
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();
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();
export const AttendeeCommunicationInputDTOSchema = z.object({
attendeeId: z.string().uuid(),
message: z.string().nullable().optional(),
}).strict();
export const AttendeeExternalInputDTOSchema = z.object({
name: z.string().min(1),
emailAddress: z.string().email().nullable().optional(),
message: z.string().nullable().optional(),
}).strict();
export const AttendeeInputDTOSchema = z.object({
name: z.string().min(1),
emailAddress: z.string().nullable().optional(),
attendeeType: z.number(),
wxUserId: z.number().int(),
}).strict();
const EAttendeeTypeDTO = z.number();
const EEventCategoryDTO = z.number();
const EEventFilterCategoryDTO = z.number();
const EEventFilterStatusDTO = z.number();
const EEventFilterTypeDTO = z.number();
const EEventOwnerTypeDTO = z.number();
const EEventStatusDTO = z.number();
const EEventTypeDTO = z.number();
const ERecurringTypeDTO = z.number();
const EventAddAttachmentDTOSchema = z.object({
attachments: z.array(AttachmentInputDTOSchema),
}).strict();
const EventAddAttendeeDTOSchema = z.object({
attendees: z.array(AttendeeInputDTOSchema),
}).strict();
export const EventCommunicationInputDTOSchema = z.object({
attachs: z.array(AttachCommunicationInputDTOSchema).nullable().optional(),
attendees: z.array(AttendeeCommunicationInputDTOSchema).nullable().optional(),
externalAttendees: z.array(AttendeeExternalInputDTOSchema).nullable().optional(),
}).strict();
export const EventInputDTOSchema = z.object({
userId: z.number().int(),
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: EEventTypeDTO,
category: EEventCategoryDTO,
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
attachments: z.array(AttachmentInputDTOSchema).nullable().optional(),
recurrence: z.object({
frequency: z.number().int(),
until: z.string(),
}),
organizerId: z.number().int(),
isAllDayEvent: z.boolean(),
}).strict();
export const EventRecurrenceInputDTOSchema = z.object({
frequency: z.number().int(),
occurrences: z.number().int(),
}).strict();
export const EventRemoveAttachmentDTOSchema = z.object({
attachments: z.array(z.string().uuid()),
}).strict();
export const EventRemoveAttendeeDTOSchema = z.object({
attendees: z.array(z.string().uuid()),
}).strict();
export const EventUpdateDTOSchema = z.object({
subject: z.string().min(1),
body: z.string().min(1),
location: z.string().min(1),
startDate: z.string().datetime(),
endDate: z.string().datetime(),
isAllDayEvent: z.boolean(),
updateAllEvents: z.boolean(),
recurrence: z.object({
frequency: z.number().int(),
occurrences: z.number().int(),
}),
}).strict();
export const EventUpdateStatusDTOSchema = z.object({
status: EEventStatusDTO,
comment: z.string().nullable().optional(),
}).strict();
export const ProblemDetailsDTOSchema = z.object({
type: z.string().nullable().optional(),
title: z.string().nullable().optional(),
status: z.number().int().nullable().optional(),
detail: z.string().nullable().optional(),
instance: z.string().nullable().optional(),
}).strict();
export const ResponseSimpleDTOSchema = z.object({
success: z.boolean(),
message: z.string().nullable().optional(),
data: z.any().nullable().optional(),
})
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>;