change folder path

This commit is contained in:
Peter Maquiran
2024-07-31 11:29:26 +01:00
parent 2d2f00cb4c
commit ba5de9e6d7
52 changed files with 191 additions and 263 deletions
@@ -0,0 +1,13 @@
import { z } from 'zod';
export const AttachInputDTOSchema = z.object({
attachments: z.array(z.object({
docId: z.any(),
sourceName: z.any(),
description: z.any().nullable(),
applicationId: z.any(),
}))
})
export type AttachInputDTO = z.infer<typeof AttachInputDTOSchema>
@@ -0,0 +1,14 @@
import { z } from 'zod';
export const AttendeeInputDTOSchema = z.array(z.object({
name: z.string(),
emailAddress: z.string(),
attendeeType: z.number(),
wxUserId: z.number(),
userType: z.enum(['GD','External', 'Internal']),
entity: z.string()
}))
export type AttendeeInputDTO = z.infer<typeof AttendeeInputDTOSchema>
@@ -0,0 +1,8 @@
import { z } from "zod"
export const AttendeesRemoveInputDTOSchema = z.object({
attendees: z.array(z.string()),
})
export type AttendeesRemoveInputDTO = z.infer<typeof AttendeesRemoveInputDTOSchema>
+50
View File
@@ -0,0 +1,50 @@
export enum EEventFilterStatus {
All = -1,
Pending = 1,
Revision,
Approved,
Declined,
Communicated,
ToCommunicate,
AllToCommunicate, // approvado e to communicate
PendingEvents,
}
// Define your TypeScript enum
export enum EEventStatus {
Pending = 1,
Revision,
Approved,
Declined,
Communicated,
ToCommunicate,
}
export enum EEventCategory
{
Oficial = 1,
Pessoal
}
export enum EEventOwnerType {
PR = 1,
MD,
Others
}
export enum EEventType
{
Meeting = 1,
Travel,
Conference,
}
export enum EAttendeeType {
Required = 1,
Acknowledgment,
Optional
}
@@ -0,0 +1,79 @@
import { z } from 'zod';
import { EAttendeeType, EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
export const AttachmentInputDTOSchema = z.object({
id: z.string().nullable(),
docId: z.number().nullable(),
sourceName: z.string().nullable(),
description: z.string().nullable(),
applicationId: z.number().int(),
}).strict();
const EAttendeeTypeDTO = z.nativeEnum(EAttendeeType);
const CommentSchema = z.object({
message: z.string(),
createdAt: z.string(),
});
const AttendeeSchema = z.object({
id: z.string(),
name: z.string(),
attendeeType: z.nativeEnum(EAttendeeType), // ["Required", "Acknowledgment", "Optional"] = [1,2,3]
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(),
});
const EventRecurrenceSchema = z.object({
Type: z.number().optional(),
Day: z.any().optional(),
DayOfWeek: z.any(),
Month: z.any(),
LastOccurrence: z.any().optional(),
frequency: z.number().optional(),
until: z.string().optional()
}).nullable()
export const EventOutputDTOSchema = z.object({
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]
}),
})
export type EventOutputDTO = z.infer<typeof EventOutputDTOSchema>
@@ -0,0 +1,42 @@
import { z } from 'zod';
import { EEventCategory, EEventOwnerType, EEventType } from './enums';
const attendeeSchema = z.object({
name: z.string(),
emailAddress: z.string(),
attendeeType: z.number(),
wxUserId: z.number(),
userType: z.enum(['GD','External', 'Internal']),
entity: z.string()
});
const attachmentSchema = z.object({
docId: z.number(),
sourceName: z.string(),
description: z.string(),
applicationId: z.number()
});
const recurrenceSchema = z.object({
frequency: z.number(),
until: z.string().nullable().optional()
});
export const EventInputDTOSchema = z.object({
userId: z.number(),
ownerType: z.nativeEnum(EEventOwnerType),
subject: z.string(),
body: z.string(),
location: z.string(),
startDate: z.string(),
endDate: z.string(),
type: z.nativeEnum(EEventType),
category: z.nativeEnum(EEventCategory),
attendees: z.array(attendeeSchema),
attachments: z.array(attachmentSchema),
recurrence: recurrenceSchema,
organizerId: z.number(),
isAllDayEvent: z.boolean()
});
export type EventInputDTO = z.infer<typeof EventInputDTOSchema>
@@ -0,0 +1,40 @@
import { z } from 'zod';
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
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: 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().optional(),
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.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
createdAt: z.string().datetime({ offset: true }),
})
export const EventListDataOutputDTOSchema = z.object({
success: z.boolean(),
message: z.string(),
data: z.array(EventListOutputDTOSchema),
}).nullable();
export type EventListOutputDTO = z.infer<typeof EventListDataOutputDTOSchema>;
@@ -0,0 +1,12 @@
import { z } from 'zod';
import { EEventOwnerType } from './enums';
export const EventSearchOutputDTOSchema = z.object({
Id: z.string(),
subject: z.string(),
dateEntry: z.string(),
Data: z.string(),
entity: z.string().optional()
}).nullable();
export type EventSearchOutput = z.infer<typeof EventSearchOutputDTOSchema>;
@@ -0,0 +1,39 @@
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: OwnerSchema,
ownerType: z.nativeEnum(EEventOwnerType),
subject: z.string(),
body: z.string().nullable().optional(),
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(),
eventRecurrence: z.any().nullable(),
hasAttachments: z.boolean(),
isPrivate: z.boolean(),
isAllDayEvent: z.boolean(),
status: z.nativeEnum(EEventStatus)
}))
export const EventToApproveDataOutputDTOSchema = z.object({
success: z.boolean(),
message: z.string(),
data: EventToApproveList,
}).nullable();
export type EventToApproveListOutputDTO = z.infer<typeof EventToApproveDataOutputDTOSchema>;
@@ -0,0 +1,25 @@
import { z } from 'zod';
import { EEventCategory, EEventOwnerType, EEventType } from './enums';
const recurrenceSchema = z.object({
frequency: z.number(),
until: z.string().nullable().optional()
});
export const EventUpdateInputDTOSchema = z.object({
userId: z.number(),
ownerType: z.nativeEnum(EEventOwnerType),
subject: z.string(),
body: z.string().optional(),
location: z.string(),
startDate: z.string(),
endDate: z.string(),
type: z.nativeEnum(EEventType),
category: z.nativeEnum(EEventCategory),
recurrence: recurrenceSchema,
isAllDayEvent: z.boolean(),
updateAllEvents: z.boolean()
});
export type EventUpdateInputDTO = z.infer<typeof EventUpdateInputDTOSchema>
@@ -0,0 +1,20 @@
import { z } from "zod";
const SharedCalendarListItemOutputDTOSchema = z.object({
wxUserId: z.number(),
wxFullName: z.string(),
wxeMail: z.string().email(),
role: z.string(),
roleId: z.number(),
shareType: z.number(),
date: z.string(),
})
export const SharedCalendarListOutputDTOSchema = z.object({
success: z.boolean(),
message: z.string(),
data: z.array(SharedCalendarListItemOutputDTOSchema),
}).nullable();
export type SharedCalendarListItemOutputDTO = z.infer<typeof SharedCalendarListItemOutputDTOSchema>;
export type SharedCalendarListOutputDTO = z.infer<typeof SharedCalendarListOutputDTOSchema>;