owner type bug solved

This commit is contained in:
Eudes Inácio
2024-06-08 00:47:52 +01:00
parent 0a898538a4
commit e0a7323bb0
4 changed files with 37 additions and 50 deletions
@@ -97,10 +97,9 @@ export class AgendaDataRepositoryService {
}
createEvent(eventData: Event, CalendarName, documents) {
console.log('create evetn v2',eventData)
let eventInput = {
userId: this.utils.selectedCalendarUserId(CalendarName, eventData) as any,
userId: CalendarName,
ownerType: this.utils.selectedCalendarOwner(CalendarName),
subject: eventData.Subject,
body: eventData.Body.Text,
+17 -4
View File
@@ -27,12 +27,12 @@ export class Utils {
}
selectedCalendarOwner(CalendarName) {
let selectedCalendar = this.eventService.calendarNamesType[CalendarName]?.['RoleId'];
let selectedCalendar = this.findRoleIdByUserId(this.eventService.calendarNamesAry, CalendarName);
console.log('selected', selectedCalendar )
if (selectedCalendar) {
if (selectedCalendar.Role == 100000014) {
if (selectedCalendar == "Presidente da República") {
return 1;
} else if (selectedCalendar.Role == 100000011) {
} else if (selectedCalendar == "Ministro e Director do Gabinete do PR") {
return 2
} else {
return 3
@@ -40,6 +40,19 @@ export class Utils {
}
}
findRoleIdByUserId(array, userId) {
for (let item of array) {
console.log('each item before',item)
if (typeof item === 'object' && item !== null && item.OwnerUserId === parseInt(userId)) {
console.log('each item after',item)
return item.Role;
} else {
return 'other';
}
}
}
calendarCategorySeleted(calendarName) {