mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
merge made with peter branch
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { z } from 'zod';
|
||||
import { EAttendeeType, EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
|
||||
|
||||
export const AttachmentInputDTOSchema = z.object({
|
||||
id: z.string().nullable(),
|
||||
@@ -7,7 +8,7 @@ export const AttachmentInputDTOSchema = z.object({
|
||||
description: z.string().nullable(),
|
||||
applicationId: z.number().int(),
|
||||
}).strict();
|
||||
const EAttendeeTypeDTO = z.enum(["Required", "Acknowledgment", "Optional"]);
|
||||
const EAttendeeTypeDTO = z.nativeEnum(EAttendeeType);
|
||||
|
||||
|
||||
const CommentSchema = z.object({
|
||||
@@ -18,7 +19,7 @@ const CommentSchema = z.object({
|
||||
const AttendeeSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
attendeeType: z.enum(["Required", "Acknowledgment", "Optional"]), // ["Required", "Acknowledgment", "Optional"] = [1,2,3]
|
||||
attendeeType: z.nativeEnum(EAttendeeType), // ["Required", "Acknowledgment", "Optional"] = [1,2,3]
|
||||
emailAddress: z.string(),
|
||||
wxUserId: z.number(),
|
||||
});
|
||||
@@ -47,27 +48,32 @@ const EventRecurrenceSchema = z.object({
|
||||
until: z.string()
|
||||
});
|
||||
|
||||
|
||||
export const EventOutputDTOSchema = z.object({
|
||||
id: z.string(),
|
||||
owner: OwnerSchema,
|
||||
ownerType: z.number(), // ["PR", "MD", "Other"] = [1,2,3],
|
||||
subject: z.string(),
|
||||
body: z.string(),
|
||||
location: z.string(),
|
||||
startDate: z.string(),
|
||||
endDate: z.string(),
|
||||
type: z.string(),
|
||||
category: z.number(), // ['Oficial', 'Pessoal'] = [1, 2]
|
||||
attendees: z.array(AttendeeSchema),
|
||||
isRecurring: z.boolean(),
|
||||
eventRecurrence: EventRecurrenceSchema,
|
||||
hasAttachments: z.boolean(),
|
||||
attachments: z.array(AttachmentInputDTOSchema),
|
||||
comments: z.array(CommentSchema),
|
||||
isPrivate: z.boolean(),
|
||||
isAllDayEvent: z.boolean(),
|
||||
organizer: OrganizerSchema,
|
||||
status: z.number(), // ['Pending', 'Revision', 'Approved', 'Declined', 'Communicated', 'ToCommunicate'] = [1, 2, 3, 4, 5, 6]
|
||||
});
|
||||
success: z.boolean(),
|
||||
message: z.string(),
|
||||
data: z.object({
|
||||
id: z.string(),
|
||||
owner: OwnerSchema,
|
||||
ownerType: z.nativeEnum(EEventOwnerType), // ["PR", "MD", "Other"] = [1,2,3],
|
||||
subject: z.string(),
|
||||
body: z.string(),
|
||||
location: z.string(),
|
||||
startDate: z.string(),
|
||||
endDate: z.string(),
|
||||
type: z.nativeEnum(EEventType),
|
||||
category: z.nativeEnum(EEventCategory), // ['Oficial', 'Pessoal'] = [1, 2]
|
||||
attendees: z.array(AttendeeSchema),
|
||||
isRecurring: z.boolean(),
|
||||
eventRecurrence: EventRecurrenceSchema,
|
||||
hasAttachments: z.boolean(),
|
||||
attachments: z.array(AttachmentInputDTOSchema),
|
||||
comments: z.array(CommentSchema),
|
||||
isPrivate: z.boolean(),
|
||||
isAllDayEvent: z.boolean(),
|
||||
organizer: OrganizerSchema,
|
||||
status: z.nativeEnum(EEventStatus), // ['Pending', 'Revision', 'Approved', 'Declined', 'Communicated', 'ToCommunicate'] = [1, 2, 3, 4, 5, 6]
|
||||
}),
|
||||
}).nullable();
|
||||
|
||||
export type EventOutputDTO = z.infer<typeof EventOutputDTOSchema>
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
import { z } from "zod";
|
||||
import { EEventOwnerType, EEventType, EEventCategory, EEventStatus } from "./enums";
|
||||
|
||||
const OwnerSchema = z.object({
|
||||
wxUserId: z.number(),
|
||||
wxFullName: z.string(),
|
||||
wxeMail: z.string(),
|
||||
userPhoto: z.string(),
|
||||
});
|
||||
|
||||
|
||||
|
||||
const EventToApproveList = z.array(z.object({
|
||||
id: z.string().uuid(),
|
||||
owner: z.string().nullable(),
|
||||
owner: OwnerSchema,
|
||||
ownerType: z.nativeEnum(EEventOwnerType),
|
||||
subject: z.string(),
|
||||
body: z.string(),
|
||||
location: z.string(),
|
||||
startDate: z.string().datetime(),
|
||||
endDate: z.string().datetime(),
|
||||
location: z.string().nullable(),
|
||||
startDate: z.string().datetime({ offset: true }),
|
||||
endDate: z.string().datetime({ offset: true }),
|
||||
type: z.nativeEnum(EEventType),
|
||||
category: z.nativeEnum(EEventCategory),
|
||||
isRecurring: z.boolean(),
|
||||
@@ -20,4 +29,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>;
|
||||
|
||||
Reference in New Issue
Block a user