mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
ITOTEAM-609 search event>
This commit is contained in:
@@ -15,7 +15,6 @@ import { EEventFilterStatus } from './model/enums';
|
||||
import { isHttpError } from '../../http.service';
|
||||
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
||||
import { APINODReturn } from '../../decorator/api-validate-schema.decorator';
|
||||
import { EventListDataOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventToApproveDataOutputDTOSchema } from './model/eventToApproveListOutputDTO';
|
||||
import { EventOutputDTOSchema } from './model/eventDTOOutput';
|
||||
import { SharedCalendarListDetectChanges } from './async/change/shareCalendarChangeDetector';
|
||||
@@ -23,6 +22,8 @@ import { SharedCalendarListItemOutputDTO } from './model/sharedCalendarOutputDTO
|
||||
import { EventInputDTOSchema } from './agendaDataModels';
|
||||
import { EventUpdateInputDTOSchema } from './model/eventUpdateInputDtO';
|
||||
import { AttachInputDTOSchema } from './model/addAttachmentDTOInput';
|
||||
import { EventListDataOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventSearchMapper } from './mapper/EventSearchMapper';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -107,6 +108,14 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
}
|
||||
|
||||
async searchEvent(queryParameters: {value}, tracing?: TracingType) {
|
||||
const result = await this.agendaDataService.searchEvent(queryParameters)
|
||||
return result.map( response => {
|
||||
APINODReturn(EventListDataOutputDTOSchema, response, 'get/Events', tracing)
|
||||
return EventSearchMapper.toDomain(response, "calendarOwnerName", "userId")
|
||||
})
|
||||
}
|
||||
|
||||
async EventList({ userId, startDate, endDate, status = EEventFilterStatus.Approved, category = null, type = null, calendarOwnerName = '' }, tracing?: TracingType) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -7,9 +7,9 @@ import { SharedCalendarListOutputDTO, SharedCalendarListOutputDTOSchema } from '
|
||||
import { HttpService } from '../../http.service';
|
||||
import { APIReturn } from '../../decorator/api-validate-schema.decorator';
|
||||
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
||||
import { EventListOutputDTO, EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventOutputDTO } from './model/eventDTOOutput';
|
||||
import { AttendeesRemoveInputDTO } from './model/attendeeRemoveInputDTO';
|
||||
import { EventListOutputDTO } from './model/eventListDTOOutput';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -74,6 +74,10 @@ export class AgendaDataService {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||
}
|
||||
|
||||
searchEvent(queryParameter: {value}) {
|
||||
return this.httpService.get<EventListOutputDTO>(`${this.baseUrl}/Events`, queryParameter);
|
||||
}
|
||||
|
||||
getEvent(id: string): Observable<EventOutputDTO> {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EventList } from "src/app/models/entiry/agenda/eventList"
|
||||
import { EventListOutputDTO } from "../model/eventListDTOOutput"
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from "../model/enums";
|
||||
import { XTracer } from "src/app/services/monitoring/opentelemetry/tracer";
|
||||
import { EventListOutputDTO } from "../model/eventListDTOOutput";
|
||||
|
||||
function getTextInsideParentheses(inputString): string {
|
||||
var startIndex = inputString.indexOf('(');
|
||||
@@ -60,16 +60,17 @@ export class ListEventMapper {
|
||||
"EventId": e.id,
|
||||
"Subject": e.subject,
|
||||
"Location": e.location,
|
||||
"CalendarId": userId,
|
||||
"CalendarId": (e.owner.wxUserId) as any,
|
||||
"CalendarName": category,
|
||||
"StartDate": new Date(e.startDate) + '',
|
||||
"EndDate": new Date(e.endDate)+ '',
|
||||
"Schedule": calendarOwnerName,
|
||||
"Schedule": (e.owner.wxFullName) as any,
|
||||
"RequiredAttendees": null as any,
|
||||
"OptionalAttendees": null as any,
|
||||
"HumanDate": "2 semanas atrás" as any,
|
||||
"TimeZone": getTextInsideParentheses(new Date(e.startDate)+ ''),
|
||||
"IsPrivate": false as any
|
||||
"IsPrivate": false as any,
|
||||
"createdAt": e.createdAt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { SearchList } from "src/app/models/search-document";
|
||||
import { EventListOutputDTO } from "../model/eventListDTOOutput";
|
||||
|
||||
function getTextInsideParentheses(inputString): string {
|
||||
var startIndex = inputString.indexOf('(');
|
||||
var endIndex = inputString.indexOf(')');
|
||||
if (startIndex !== -1 && endIndex !== -1) {
|
||||
return inputString.substring(startIndex + 1, endIndex);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class EventSearchMapper {
|
||||
// @XTracer({name:'ListEventMapper/toDomain', log: false, bugPrint: false})
|
||||
static toDomain(dto: EventListOutputDTO, calendarOwnerName: string, userId: string): SearchList[] {
|
||||
|
||||
return dto.data.map((e) => {
|
||||
|
||||
return {
|
||||
Id: e.id as any,
|
||||
subject: e.subject,
|
||||
dateEntry: e.createdAt as any,
|
||||
Data: e.createdAt as any,
|
||||
entity: (e.owner.wxFullName),
|
||||
ApplicationType: 0 as any,
|
||||
Assunto: e.subject,
|
||||
appName: "string",
|
||||
ApplicationName: "",
|
||||
docId: e.id as any,
|
||||
applicationId: 0 as any
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static toDTO() {}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
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";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from 'zod';
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from './enums';
|
||||
import { EEventCategory, EEventOwnerType, EEventStatus, EEventType } from '../model/enums';
|
||||
|
||||
|
||||
const OwnerSchema = z.object({
|
||||
@@ -29,6 +29,7 @@ export const EventListOutputDTOSchema = z.object({
|
||||
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({
|
||||
|
||||
@@ -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>;
|
||||
Reference in New Issue
Block a user