mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
remove unsude code
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export enum RoleId {
|
||||
/**
|
||||
* @description President role id
|
||||
*/
|
||||
PV = 100000011,
|
||||
MD = 100000011,
|
||||
|
||||
/**
|
||||
* @description Vice president role id
|
||||
*/
|
||||
PRES = 100000014,
|
||||
|
||||
/**
|
||||
* @description Consultant role id
|
||||
*/
|
||||
Consultant = 99999872
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Observable } from "rxjs";
|
||||
import { AttendeesRemoveInputDTO } from "src/app/module/agenda/data/dto/attendeeRemoveInputDTO";
|
||||
import { EventOutputDTO } from "src/app/module/agenda/data/dto/eventDTOOutput";
|
||||
import { EventInputDTO } from "src/app/module/agenda/data/dto/eventInputDTO";
|
||||
import { EventListOutputDTO } from "src/app/module/agenda/data/dto/eventListDTOOutput";
|
||||
import { SharedCalendarListOutputDTO } from "src/app/module/agenda/data/dto/sharedCalendarOutputDTO";
|
||||
import { IDraftSaveByIdInput } from "src/app/module/agenda/domain/usecase/draft-save-by-id-use-case.service";
|
||||
import { IGetDraftListByProcessIdSchema, IGetDraftListByProcessIdOutput } from "src/app/module/agenda/domain/usecase/getDraft-list-by-process-id.service";
|
||||
import { TracingType } from "src/app/services/monitoring/opentelemetry/tracer";
|
||||
|
||||
export abstract class IAgendaRepository {
|
||||
// Documents Endpoints
|
||||
abstract getAttachments(subject: string, applicationType: number): Observable<any>;
|
||||
abstract viewDocument(userId: number, docId: number, applicationId: number): Observable<any>;
|
||||
|
||||
// Events Endpoints
|
||||
abstract createEvent(eventData: EventInputDTO): Observable<any>;
|
||||
abstract getEvents(params: { userId: number, startDate?: string, endDate?: string, status?: string, category?: string, type?: string }, tracing?: TracingType): Observable<EventListOutputDTO>;
|
||||
abstract searchEvent(queryParameter: {value: string, status: string}): Observable<EventListOutputDTO>;
|
||||
abstract getEvent(id: string, tracing?: TracingType): Observable<EventOutputDTO>;
|
||||
abstract updateEvent(id: string, eventData: any): Observable<any>;
|
||||
abstract approveEvent(id: string): Observable<any>;
|
||||
abstract deleteEvent(id: string, deleteAllEvents: boolean): Promise<any>;
|
||||
abstract updateEventStatus(id: string, statusData: Object): Observable<any>;
|
||||
abstract addEventAttendee(id: string, attendeeData: any): Observable<any>;
|
||||
abstract removeEventAttendee(id: string, attendeeData: AttendeesRemoveInputDTO): Observable<any>;
|
||||
abstract addEventAttachment(id: string, attachmentData: any): Observable<any>;
|
||||
abstract removeEventAttachment(id: string, attachmentData: any): Observable<any>;
|
||||
|
||||
// Other Endpoints
|
||||
abstract getDocumentAttachment(aplicationId: string, userId: string, value: string, pageNumber: number, pageSize: number): Observable<any>;
|
||||
abstract getSharedCalendar(): Promise<SharedCalendarListOutputDTO>;
|
||||
abstract getDraftListByProcessId(input: IGetDraftListByProcessIdSchema): Promise<IGetDraftListByProcessIdOutput>;
|
||||
abstract draftSaveById(input: IDraftSaveByIdInput): Promise<IGetDraftListByProcessIdOutput>;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { EEventOwnerType, EEventType, EEventCategory } from 'src/app/module/agenda/data/dto/enums';
|
||||
import { z } from 'zod';
|
||||
import { IAgendaRepository } from '../repository/agenda-repository';
|
||||
import { zodSafeValidation } from 'src/app/utils/zodValidation';
|
||||
|
||||
|
||||
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 recurrenceSchema = z.object({
|
||||
frequency: z.number(),
|
||||
until: z.string().nullable().optional()
|
||||
});
|
||||
|
||||
const attachmentSchema = z.object({
|
||||
docId: z.number(),
|
||||
sourceName: z.string(),
|
||||
description: z.string(),
|
||||
applicationId: z.number()
|
||||
});
|
||||
|
||||
const EventCreateInputSchema = 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 EventCreateInput= z.infer<typeof EventCreateInputSchema>
|
||||
|
||||
|
||||
const EventCreateUseCaseInputSchema = 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 EventCreateUseCaseInput= z.infer<typeof EventCreateUseCaseInputSchema>
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EventCreateService {
|
||||
|
||||
constructor(
|
||||
private agendaRepository: IAgendaRepository
|
||||
) { }
|
||||
|
||||
|
||||
async execute(input: EventCreateInput) {
|
||||
const validation = zodSafeValidation<EventCreateInput>(EventCreateInputSchema, input)
|
||||
|
||||
this.agendaRepository
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { UserList } from "src/app/models/entiry/agenda/contact";
|
||||
import { err, ok, Result } from 'neverthrow';
|
||||
import { XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
|
||||
|
||||
export enum RoleId {
|
||||
/**
|
||||
* @description President role id
|
||||
*/
|
||||
PV = 100000011,
|
||||
MD = 100000011,
|
||||
|
||||
/**
|
||||
* @description Vice president role id
|
||||
*/
|
||||
PRES = 100000014,
|
||||
|
||||
/**
|
||||
* @description Consultant role id
|
||||
*/
|
||||
Consultant = 99999872
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EventSetDefaultParticipantsService {
|
||||
|
||||
constructor(
|
||||
private ContactRepositoryService: ContactRepositoryService
|
||||
) { }
|
||||
|
||||
@XTracerAsync({name:'Event-Set-Default-Participants', module:'chat', bugPrint: true})
|
||||
async execute(): Promise<Result<UserList|null, any>> {
|
||||
|
||||
if (SessionStore.user.Profile == 'PR') {
|
||||
|
||||
const RequestResult = await this.ContactRepositoryService.getUsersMap();
|
||||
if(RequestResult.isOk()) {
|
||||
const result = RequestResult.value
|
||||
|
||||
let filterLoggedUserEmail = result.filter(item => item.RoleId == RoleId.MD)
|
||||
|
||||
if(filterLoggedUserEmail.length >= 1) {
|
||||
filterLoggedUserEmail[0].IsRequired = true
|
||||
}
|
||||
|
||||
return ok(filterLoggedUserEmail)
|
||||
|
||||
} else {
|
||||
return err(null)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user