mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
ITOTEAM-597 remove atendess from list
This commit is contained in:
@@ -160,7 +160,6 @@ export class AgendaDataRepositoryService {
|
||||
}
|
||||
|
||||
createEvent(eventData: Event, documents, calendar: TableSharedCalendar, tracing: TracingType) {
|
||||
console.log('create repository 1',eventData, calendar)
|
||||
|
||||
let eventInput = {
|
||||
userId: calendar.wxUserId,
|
||||
@@ -182,8 +181,6 @@ export class AgendaDataRepositoryService {
|
||||
isAllDayEvent: eventData.IsAllDayEvent,
|
||||
}
|
||||
|
||||
console.log('create repository 2',eventInput)
|
||||
|
||||
APINODReturn(EventInputDTOSchema, eventInput, 'post/Events', tracing)
|
||||
return this.agendaDataService.createEvent(eventInput)
|
||||
}
|
||||
@@ -230,12 +227,15 @@ export class AgendaDataRepositoryService {
|
||||
return this.agendaDataService.addEventAttendee(id, { attendees: this.utils.attendeesAdded(attendeeData) });
|
||||
}
|
||||
|
||||
removeEventAttendee(id, attendeeData: {Id : string}[]) {
|
||||
|
||||
return this.agendaDataService.removeEventAttendee(id, { attendees: attendeeData.map(e => e.Id || e['id']) } );
|
||||
}
|
||||
|
||||
addEventAttachment(id, attachmentData, tracing: TracingType) {
|
||||
console.log(attachmentData)
|
||||
|
||||
const attachments = { attachments: this.utils.documentAdded(attachmentData) }
|
||||
console.log('post attachment', attachments)
|
||||
|
||||
APINODReturn(AttachInputDTOSchema, attachments, `POST/${id}/Attendee`, tracing)
|
||||
return this.agendaDataService.addEventAttachment(id, attachments);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ 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';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -98,7 +99,8 @@ export class AgendaDataService {
|
||||
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Attendee`, attendeeData);
|
||||
}
|
||||
|
||||
removeEventAttendee(id: string, attendeeData: any): Observable<any> {
|
||||
|
||||
removeEventAttendee(id: string, attendeeData: AttendeesRemoveInputDTO): Observable<any> {
|
||||
return this.http.delete<any>(`${this.baseUrl}/Events/${id}/Attendee`, { body: attendeeData });
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
interface attendees {
|
||||
|
||||
EmailAddress : string
|
||||
Name: string
|
||||
UserType: string
|
||||
attendeeType: string
|
||||
wxUserId: string
|
||||
Id: string
|
||||
}
|
||||
|
||||
type Changes = {
|
||||
insert: attendees[];
|
||||
remove: attendees[];
|
||||
};
|
||||
|
||||
export function AttendeesLIstChangeDetector(
|
||||
localList: attendees[],
|
||||
serverList: attendees[]
|
||||
): Changes {
|
||||
const changes: Changes = { insert: [], remove: [] };
|
||||
|
||||
const localMap = new Map(localList.map(item => [item.wxUserId, item]));
|
||||
const serverMap = new Map(serverList.map(item => [item.wxUserId, item]));
|
||||
|
||||
// Detect new or updated items
|
||||
for (const [id, serverItem] of serverMap) {
|
||||
const localItem = localMap.get(id);
|
||||
if (!localItem) {
|
||||
changes.insert.push(serverItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Detect deleted items
|
||||
for (const [id, localItem] of localMap) {
|
||||
if (!serverMap.has(id)) {
|
||||
changes.remove.push(localItem);
|
||||
}
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class EventMapper {
|
||||
"EndDate": dto.endDate,
|
||||
"EventType": "Single",
|
||||
"Attendees": dto.attendees.map((e) => ({
|
||||
//Id: e.id,
|
||||
Id: e.id,
|
||||
wxUserId: e.wxUserId,
|
||||
EmailAddress: e.emailAddress,
|
||||
Name: e.name,
|
||||
|
||||
@@ -127,6 +127,7 @@ export class EventToApproveDetailsMapper {
|
||||
//"HasAttachments": true,
|
||||
"ParticipantsList": [
|
||||
...dto.attendees.map( e => ({
|
||||
Id: e.id,
|
||||
Name: e.name,
|
||||
EmailAddress: e.emailAddress,
|
||||
IsRequired: FEAttendeeType(e.attendeeType) == 'Required',
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user