mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add all enums
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { EAttendeeType, EEventCategory, EEventOwnerType, EEventStatus } from "../model/enums";
|
||||
import { EventOutputDTO } from "../model/eventDTOOutput"
|
||||
|
||||
function getTextInsideParentheses(inputString) {
|
||||
@@ -16,36 +17,36 @@ export class EventMapper {
|
||||
static toDomain(dto: EventOutputDTO) {
|
||||
|
||||
let category;
|
||||
if(dto.category == 1) {
|
||||
if(dto.category == EEventCategory.Oficial) {
|
||||
category = 'Oficial'
|
||||
} else {
|
||||
category = 'Pessoal'
|
||||
}
|
||||
|
||||
let ownerType;
|
||||
if(dto.ownerType == 1) {
|
||||
if(dto.ownerType == EEventOwnerType.PR) {
|
||||
ownerType = 'PR'
|
||||
} else if(dto.ownerType == 2) {
|
||||
} else if(dto.ownerType == EEventOwnerType.MD) {
|
||||
ownerType = 'MD'
|
||||
} else if(dto.ownerType == 3) {
|
||||
} else if(dto.ownerType == EEventOwnerType.Others) {
|
||||
ownerType = 'Other'
|
||||
}
|
||||
|
||||
let type;
|
||||
|
||||
let status;
|
||||
if(dto.status == 1) {
|
||||
if(dto.status == EEventStatus.Pending) {
|
||||
status = 'Pending'
|
||||
} else if(dto.status == 2) {
|
||||
} else if(dto.status == EEventStatus.Revision) {
|
||||
status = 'Revision'
|
||||
}
|
||||
|
||||
function EAttendeeType(num) {
|
||||
if(num == 1) {
|
||||
function FEAttendeeType(num) {
|
||||
if(num == EAttendeeType.Required) {
|
||||
return 'Required'
|
||||
} else if (num == 2) {
|
||||
} else if (num == EAttendeeType.Acknowledgment) {
|
||||
return 'Acknowledgment'
|
||||
} else if (num == 3) {
|
||||
} else if (num == EAttendeeType.Optional) {
|
||||
return 'Optional'
|
||||
}
|
||||
}
|
||||
@@ -70,10 +71,10 @@ export class EventMapper {
|
||||
wxUserId: e.wxUserId,
|
||||
EmailAddress: e.emailAddress,
|
||||
Name: e.name,
|
||||
IsRequired: EAttendeeType(e.attendeeType) == 'Required',
|
||||
IsRequired: FEAttendeeType(e.attendeeType) == 'Required',
|
||||
UserType: "GD",
|
||||
// "IsPR": false,
|
||||
attendeeType: EAttendeeType(e.attendeeType)
|
||||
attendeeType: FEAttendeeType(e.attendeeType)
|
||||
// "RoleDescription": null,
|
||||
// "RoleId": 0
|
||||
})),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { EventList } from "src/app/models/entiry/agenda/eventList"
|
||||
import { EventListOutputDTO } from "../model/eventListDTOOutput"
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from "../model/enums";
|
||||
|
||||
function getTextInsideParentheses(inputString): string {
|
||||
var startIndex = inputString.indexOf('(');
|
||||
@@ -17,33 +18,38 @@ export class ListEventMapper {
|
||||
return dto.map((e) => {
|
||||
|
||||
let category;
|
||||
if(e.category == 1) {
|
||||
if(e.category == EEventCategory.Oficial) {
|
||||
category = 'Oficial'
|
||||
} else {
|
||||
category = 'Pessoal'
|
||||
}
|
||||
|
||||
let ownerType;
|
||||
if(e.ownerType == 1) {
|
||||
if(e.ownerType == EEventOwnerType.PR) {
|
||||
ownerType = 'PR'
|
||||
} else if(e.ownerType == 2) {
|
||||
} else if(e.ownerType == EEventOwnerType.MD) {
|
||||
ownerType = 'MD'
|
||||
} else if(e.ownerType == 3) {
|
||||
} else if(e.ownerType == EEventOwnerType.Others) {
|
||||
ownerType = 'Other'
|
||||
}
|
||||
|
||||
|
||||
let type;
|
||||
if(e.type == 1) {
|
||||
if(e.type == EEventType.Meeting) {
|
||||
type = 'Meeting'
|
||||
} else {
|
||||
} else if (e.type == EEventType.Travel) {
|
||||
type = 'Travel'
|
||||
}
|
||||
|
||||
let status;
|
||||
if(e.status == 1) {
|
||||
if(e.status == EEventStatus.Pending) {
|
||||
status = 'Pending'
|
||||
} else if(e.status == 2) {
|
||||
} else if(e.status == EEventStatus.Revision) {
|
||||
status = 'Revision'
|
||||
} else if(e.status == EEventStatus.Approved) {
|
||||
status = 'Approved'
|
||||
} else if(e.status == EEventStatus.Declined) {
|
||||
status = 'Declined'
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { EventToApproveDetails } from "src/app/models/entiry/agenda/eventToApproveDetails"
|
||||
import { EventOutputDTO } from "../model/eventDTOOutput"
|
||||
import { EAttendeeType, EEventCategory, EEventOwnerType, EEventStatus } from "../model/enums";
|
||||
|
||||
function getTextInsideParentheses(inputString) {
|
||||
var startIndex = inputString.indexOf('(');
|
||||
@@ -18,7 +19,7 @@ export class EventToApproveDetailsMapper {
|
||||
static toDomain(dto: EventOutputDTO): EventToApproveDetails {
|
||||
|
||||
let category;
|
||||
if(dto.category == 1) {
|
||||
if(dto.category == EEventCategory.Oficial) {
|
||||
category = 'Oficial'
|
||||
} else {
|
||||
category = 'Pessoal'
|
||||
@@ -27,40 +28,44 @@ export class EventToApproveDetailsMapper {
|
||||
let color;
|
||||
|
||||
// if(dto.ownerType != 'PR') {
|
||||
if(dto.ownerType == 2) {
|
||||
color = 'MDGPR'
|
||||
} else {
|
||||
color = 'PR'
|
||||
let ownerType;
|
||||
if(dto.ownerType == EEventOwnerType.PR) {
|
||||
ownerType = 'PR'
|
||||
} else if(dto.ownerType == EEventOwnerType.MD) {
|
||||
ownerType = 'MD'
|
||||
} else if(dto.ownerType == EEventOwnerType.Others) {
|
||||
ownerType = 'Other'
|
||||
}
|
||||
|
||||
let activityInstanceName;
|
||||
let taskStatus;
|
||||
|
||||
if(dto.status == 1) {
|
||||
if(dto.status == EEventStatus.Pending) {
|
||||
activityInstanceName = 'Aprovar evento'
|
||||
taskStatus = 'Pending' //////
|
||||
} else if(dto.status == 2) {
|
||||
} else if(dto.status == EEventStatus.Revision) {
|
||||
activityInstanceName = 'Editar evento'
|
||||
taskStatus = 'Revision' //////
|
||||
} else if (dto.status == 3) {
|
||||
} else if (dto.status == EEventStatus.Approved) {
|
||||
activityInstanceName = 'Evento Aprovado'
|
||||
taskStatus = 'Approved' //////
|
||||
} else if (dto.status == 4) {
|
||||
} else if (dto.status == EEventStatus.Declined) {
|
||||
activityInstanceName = 'Declined'
|
||||
taskStatus = 'Declined' //////
|
||||
} else if (dto.status == 5) {
|
||||
} else if (dto.status == EEventStatus.Communicated) {
|
||||
activityInstanceName = 'Communicated'
|
||||
taskStatus = 'Communicated' //////
|
||||
} else if (dto.status == 6) {
|
||||
} else if (dto.status == EEventStatus.ToCommunicate) {
|
||||
activityInstanceName = 'ToCommunicate'
|
||||
taskStatus = 'ToCommunicate' //////
|
||||
}
|
||||
|
||||
function EAttendeeType(num) {
|
||||
if(num == 1) {
|
||||
function FEAttendeeType(num) {
|
||||
if(num == EAttendeeType.Required) {
|
||||
return 'Required'
|
||||
} else if (num == 2) {
|
||||
} else if (num == EAttendeeType.Acknowledgment) {
|
||||
return 'Acknowledgment'
|
||||
} else if (num == 3) {
|
||||
} else if (num == EAttendeeType.Optional) {
|
||||
return 'Optional'
|
||||
}
|
||||
}
|
||||
@@ -115,10 +120,10 @@ export class EventToApproveDetailsMapper {
|
||||
...dto.attendees.map( e => ({
|
||||
Name: e.name,
|
||||
EmailAddress: e.emailAddress,
|
||||
IsRequired: EAttendeeType(e.attendeeType) == 'Required',
|
||||
IsRequired: FEAttendeeType(e.attendeeType) == 'Required',
|
||||
UserType: "GD",
|
||||
wxUserId: e.wxUserId,
|
||||
attendeeType: EAttendeeType(e.attendeeType)
|
||||
attendeeType: FEAttendeeType(e.attendeeType)
|
||||
}))
|
||||
],
|
||||
//"EventOrganizer": "{\"$type\":\"GabineteDigital.k2RESTidentifier_EventPerson, GabineteDigital, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"EmailAddress\":\"agenda.mdgpr@gabinetedigital.local\",\"Name\":\"Agenda do Ministro e Director do Gabinete do PR\",\"IsRequired\":true}",
|
||||
|
||||
@@ -2,6 +2,7 @@ import { EventList } from "src/app/models/entiry/agenda/eventList"
|
||||
import { EventListOutputDTO } from "../model/eventListDTOOutput"
|
||||
import { EventToApproveListOutputDTO } from "../model/eventToApproveListOutputDTO";
|
||||
import { EventToApproveList } from "src/app/models/entiry/agenda/eventToApproveList";
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus } from "../model/enums";
|
||||
|
||||
|
||||
function getTextInsideParentheses(inputString): string {
|
||||
@@ -19,11 +20,18 @@ export class EventListToApproveMapper {
|
||||
|
||||
|
||||
return dtoList.map((dto) => {
|
||||
const category = dto.category
|
||||
|
||||
let category;
|
||||
if(dto.category == EEventCategory.Oficial) {
|
||||
category = 'Oficial'
|
||||
} else {
|
||||
category = 'Pessoal'
|
||||
}
|
||||
|
||||
let color;
|
||||
let workflowDisplayName;
|
||||
|
||||
if(dto.ownerType == 'PR') {
|
||||
if(dto.ownerType == EEventOwnerType.PR) {
|
||||
color = 'PR'
|
||||
workflowDisplayName = `Agenda ${category} ${color}`
|
||||
} else {
|
||||
@@ -35,25 +43,31 @@ export class EventListToApproveMapper {
|
||||
// }
|
||||
|
||||
let activityInstanceName;
|
||||
let taskStatus;
|
||||
|
||||
if(dto.status == 'Pending') {
|
||||
if(dto.status == EEventStatus.Pending) {
|
||||
activityInstanceName = 'Aprovar evento'
|
||||
} else if(dto.status == 'Revision') {
|
||||
taskStatus = 'Pending' //////
|
||||
} else if(dto.status == EEventStatus.Revision) {
|
||||
activityInstanceName = 'Editar evento'
|
||||
} else if (dto.status == 'Approved') {
|
||||
taskStatus = 'Revision' //////
|
||||
} else if (dto.status == EEventStatus.Approved) {
|
||||
activityInstanceName = 'Evento Aprovado'
|
||||
} else if (dto.status == 'Evento Rejeitado') {
|
||||
taskStatus = 'Approved' //////
|
||||
} else if (dto.status == EEventStatus.Declined) {
|
||||
activityInstanceName = 'Declined'
|
||||
} else if (dto.status == 'Evento comunicado') {
|
||||
taskStatus = 'Declined' //////
|
||||
} else if (dto.status == EEventStatus.Communicated) {
|
||||
activityInstanceName = 'Communicated'
|
||||
} else if (dto.status == 'Comunicar evento') {
|
||||
taskStatus = 'Communicated' //////
|
||||
} else if (dto.status == EEventStatus.ToCommunicate) {
|
||||
activityInstanceName = 'ToCommunicate'
|
||||
taskStatus = 'ToCommunicate' //////
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
serialNumber: dto.id,
|
||||
taskStatus: dto.status,
|
||||
taskStatus: taskStatus,
|
||||
taskStartDate: dto.startDate,
|
||||
taskReceiveDate: dto.startDate,
|
||||
deadline: null,
|
||||
@@ -61,12 +75,12 @@ export class EventListToApproveMapper {
|
||||
activityInstanceName,
|
||||
totalDocuments: 0,
|
||||
workflowInstanceDataFields: {
|
||||
Agenda: dto.category,
|
||||
Agenda: category,
|
||||
EndDate: dto.endDate,
|
||||
StartDate: dto.startDate,
|
||||
Subject: dto.subject,
|
||||
Location: dto.location,
|
||||
Status: dto.status,
|
||||
Status: "Active",
|
||||
IsAllDayEvent: dto.isAllDayEvent,
|
||||
InstanceId: "",
|
||||
originator: ""
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
export enum EEventFilterStatus {
|
||||
All = -1,
|
||||
Pending = 1,
|
||||
Revision,
|
||||
Approved,
|
||||
Declined,
|
||||
Communicated,
|
||||
ToCommunicate,
|
||||
AllToCommunicate,
|
||||
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,
|
||||
Acknowledgment,
|
||||
Optional
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
import { z } from 'zod';
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
|
||||
|
||||
const EventSchema = z.array(z.object({
|
||||
id: z.string(),
|
||||
owner: z.string().nullable(),
|
||||
ownerType: z.number(),// ['MD','PR', 'Other'] // Assuming "MD" is the only valid option based on provided data
|
||||
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(),
|
||||
startDate: z.string().datetime({ offset: true }),
|
||||
endDate: z.string().datetime({ offset: true }),
|
||||
type: z.number(), // ['Meeting', 'Travel'] = [1,2 ]
|
||||
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.number(),
|
||||
category: z.nativeEnum(EEventCategory),
|
||||
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
|
||||
status: z.number(), // 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>;
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
import { z } from "zod";
|
||||
import { EEventOwnerType, EEventType, EEventCategory, EEventStatus } from "./enums";
|
||||
|
||||
const EventToApproveList = z.array(z.object({
|
||||
id: z.string().uuid(),
|
||||
owner: z.string().nullable(),
|
||||
ownerType: z.enum(["PR", "MD", "Other"]),
|
||||
ownerType: z.nativeEnum(EEventOwnerType),
|
||||
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"]),
|
||||
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.enum(["Pending"])
|
||||
status: z.nativeEnum(EEventStatus)
|
||||
}))
|
||||
|
||||
export type EventToApproveListOutputDTO = z.infer<typeof EventToApproveList>;
|
||||
|
||||
Reference in New Issue
Block a user