merge with eudes branch

This commit is contained in:
Peter Maquiran
2024-05-31 12:54:07 +01:00
9 changed files with 256 additions and 145 deletions
@@ -3,7 +3,7 @@ import { AgendaDataService } from './agenda-data.service';
import { catchError, map } from 'rxjs/operators';
import { ListEventMapper } from './mapper/EventListMapper';
import { EventMapper } from './mapper/EventDetailsMapper';
import { Utils } from './utils';
import { Utils } from './utils';
import { EventInputDTO } from './agendaDataModels';
import { Event } from 'src/app/models/event.model';
import { SessionStore } from 'src/app/store/session.service';
@@ -79,11 +79,11 @@ export class AgendaDataRepositoryService {
}
}
createEvent(eventData: Event,CalendarName,documents) {
createEvent(eventData: Event, CalendarName, documents) {
console.log(eventData)
let eventInput = {
userId: this.utils.selectedCalendarUserId(CalendarName,eventData) as any,
userId: this.utils.selectedCalendarUserId(CalendarName, eventData) as any,
ownerType: this.utils.selectedCalendarOwner(CalendarName),
subject: eventData.Subject,
body: eventData.Body.Text,
@@ -102,49 +102,43 @@ export class AgendaDataRepositoryService {
isAllDayEvent: eventData.IsAllDayEvent,
}
this.agendaDataService.createEvent(eventInput).subscribe((value) => {
console.log(value)
},((error) => {
console.log('create event',error)
}));
return this.agendaDataService.createEvent(eventInput)
}
updateEvent(eventId,eventData: Event,CalendarName,documents) {
console.log(this.utils.editeEventCalendarUserId(CalendarName,eventData));
updateEvent(eventId, eventData) {
console.log(eventData.StartDate)
console.log(eventData.EndDate)
let eventInput = {
userId: this.utils.selectedCalendarUserId(CalendarName,eventData),
ownerType: this.utils.selectedCalendarOwner(CalendarName),
subject: eventData.Subject,
body: eventData.Body.Text,
body: eventData.Body.Text || eventData.Body,
location: eventData.Location,
startDate: JSON.stringify(eventData.StartDate),
endDate: JSON.stringify(eventData.EndDate),
type: this.utils.calendarTypeSeleted(eventData.Category),
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
attendees: this.utils.attendeesAdded(eventData.Attendees),
attachments: this.utils.documentAdded(documents),
startDate: eventData.StartDate,
endDate: eventData.EndDate,
isAllDayEvent: eventData.IsAllDayEvent,
updateAllEvents: false,
recurrence: {
frequency: 0,
occurrences: 0,
},
organizerId: SessionStore.user.UserId,
isAllDayEvent: eventData.IsAllDayEvent,
occurrences: 0
}
}
return this.agendaDataService.updateEvent(eventId, eventInput)
}
this.agendaDataService.updateEvent(eventId, eventInput).subscribe((value) => {
console.log(value)
},((error) => {
console.log(error)
}));
addEventAttendee(id,attendeeData) {
return this.agendaDataService.addEventAttendee(id,attendeeData);
}
addEventAttachment(id,attachmentData) {
return this.agendaDataService.addEventAttachment(id,attachmentData);
}
deleteEvent(eventId) {
this.agendaDataService.deleteEvent(eventId,false).subscribe(() => {
console.log()
},((error) => {
console.log(error)
}))
return this.agendaDataService.deleteEvent(eventId, false)
}
removeEventAttachment(eventId,attachmentData) {
return this.agendaDataService.removeEventAttachment(eventId,attachmentData);
}
async deleteEvent1(eventId) {
@@ -157,4 +151,8 @@ export class AgendaDataRepositoryService {
}
}
eventToaprovalStatus(eventId, status) {
return this.agendaDataService.updateEventStatus(eventId,this.utils.statusEventAproval(status))
}
}
@@ -58,10 +58,10 @@ export class EventMapper {
"LastOccurrence": null
},
"Attachments": dto.attachments.map( e => ({
"Id": e.sourceId,
"Id": e.id,
// "ParentId": "AAMkADVhOGY3ZDQzLTg4ZGEtNDYxMC1iMzc5LTJkMDgwNjMxOWFlZQBGAAAAAABEDW9nKs69TKQcVqQURj8YBwBR2HR2eO7pSpNdD9cc70l+AAAAAAFKAABR2HR2eO7pSpNdD9cc70l+AACK2OeJAAA=",
// "Source": 1,
"SourceId": e.sourceId,
"SourceId": e.docId,
// "Description": "teste pp",
"SourceName": e.sourceName,
// "CreateDate": "2024-05-24 16:41",
@@ -1,7 +1,8 @@
import { z } from 'zod';
export const AttachmentInputDTOSchema = z.object({
sourceId: z.string().nullable(),
id: z.string().nullable(),
docId: z.number().nullable(),
sourceName: z.string().nullable(),
description: z.string().nullable(),
applicationId: z.number().int(),
+17 -23
View File
@@ -26,24 +26,6 @@ export class Utils {
}
}
editeEventCalendarUserId(CalendarName,postEvent) {
let CalendarNameOwnerName = this.eventService.detectCalendarNameByCalendarId(postEvent.CalendarId)
if(this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial'] && this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial']) {
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
} else {
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
}
}
selectedCalendarOwner(CalendarName) {
let selectedCalendar = this.eventService.calendarNamesType[CalendarName]?.['RoleId'];
@@ -79,12 +61,13 @@ export class Utils {
}
documentAdded(documents:any[]) {
console.log('added doc create event',documents)
return documents.map((e) => {
return {
sourceId: e.Id,
docId: parseInt(e.Id),
sourceName: e.Assunto,
description: "",
applicationId: parseInt(e.ApplicationType.toString())
applicationId: parseInt(JSON.stringify(e.ApplicationType))
};
});
@@ -93,9 +76,9 @@ export class Utils {
atendeesSeletedType(type) {
var selectedType = {
'true': 1,
'false':2,
'other':3,
'true': 0,
'false':1,
'other':2,
}
return selectedType[type];
}
@@ -111,4 +94,15 @@ export class Utils {
}
});
}
statusEventAproval(type) {
var selectedType = {
'Pending': 0,
'Revision':1,
'Approved':2,
"Declined":3,
"Communicated":4
}
return selectedType[type];
}
}