fix ownertype and category type

This commit is contained in:
Peter Maquiran
2024-06-21 23:33:29 +01:00
parent 558810ab83
commit 0c14b9be97
13 changed files with 90 additions and 531 deletions
@@ -157,7 +157,7 @@ export class AgendaDataRepositoryService {
}
createEvent(eventData: Event, documents, calendar: TableSharedCalendar) {
console.log('create repository 1',eventData)
console.log('create repository 1',eventData, calendar)
let eventInput = {
userId: calendar.wxUserId,
@@ -211,6 +211,8 @@ export class AgendaDataRepositoryService {
}
}
console.log({eventData})
return this.agendaDataService.updateEvent(eventId, eventInput)
}
+14 -9
View File
@@ -26,13 +26,13 @@ export class Utils {
}
}
selectedCalendarOwner(CalendarName) {
let selectedCalendar = this.findRoleIdByUserId(this.eventService.calendarNamesAry, CalendarName);
console.log('selected', selectedCalendar )
if (selectedCalendar) {
if (selectedCalendar == "Presidente da República") {
selectedCalendarOwner(roleDescription) {
console.log('roleDescription', roleDescription)
if (roleDescription) {
if (roleDescription == "Presidente da República") {
return 1;
} else if (selectedCalendar == "Ministro e Director do Gabinete do PR") {
} else if (roleDescription == "Ministro e Director do Gabinete do PR") {
return 2
} else {
return 3
@@ -50,7 +50,7 @@ export class Utils {
return 'other';
}
}
}
@@ -60,6 +60,11 @@ export class Utils {
'Oficial': 1,
'Pessoal': 2
}
if(calendarName != 'Pessoal' && calendarName != 'Oficial') {
throw('bad logic')
}
return selectedCalendar[calendarName];
}
@@ -180,11 +185,11 @@ export class Utils {
addOneHourToIsoString(isoDateString) {
let date = new Date(isoDateString);
const tzOffset = -date.getTimezoneOffset(); // in minutes
const diff = tzOffset >= 0 ? '+' : '-';
const pad = (n: number) => (n < 10 ? '0' : '') + n;
return date.getFullYear() +
'-' + pad(date.getMonth() + 1) +
'-' + pad(date.getDate()) +
@@ -22,6 +22,7 @@ export function APIReturn(schema: z.ZodTypeAny, path: string) {
console.error('unexpected data structure', path)
// Capture the Zod validation error with additional context
console.error('Validation failed:', error.errors);
console.log(result.value)
} else {
// Throw any other unexpected errors
// throw error;
@@ -53,6 +54,7 @@ export function APINODReturn(schema: z.ZodTypeAny, data , path: string, tracing?
console.error('unexpected data structure', path)
// Capture the Zod validation error with additional context
console.error('Validation failed:', error.errors);
console.log(data)
tracing?.setAttribute('APIReturn.error', 'true')
+5 -11
View File
@@ -320,19 +320,13 @@ export class TaskService {
// PR dont have event to approve
/* if(this.SessionStore.user.Profile != 'PR') { */
try {
for(let calendar of this.eventService.calendarNamesAry) {
let userId;
const list = await this.AgendaDataRepositoryService.geCalendars()
if(calendar == 'Meu calendario') {
userId = SessionStore.user.UserId
} else {
userId = calendar.OwnerUserId
}
for(let calendar of list) {
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
userId,
userId: calendar.wxUserId,
status: EEventFilterStatus.Pending
}, tracing)
@@ -342,9 +336,9 @@ export class TaskService {
let eventsList = []
if(allEvents.value.length >= 1) {
eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
this.eventoaprovacaostore.save(userId, eventsList)
this.eventoaprovacaostore.save(calendar.wxUserId as any, eventsList)
} else {
this.eventoaprovacaostore.save(userId, [])
this.eventoaprovacaostore.save(calendar.wxUserId as any, [])
}
} else {