mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix mapper error
This commit is contained in:
@@ -78,9 +78,9 @@ export class AgendaDataRepositoryService {
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
APINODReturn(EventOutputDTOSchema, response, 'get/Events/${id}', tracing)
|
||||
console.log('response',response)
|
||||
console.log('ToDomain',EventToApproveDetailsMapper.toDomain(response))
|
||||
APINODReturn(EventOutputDTOSchema, response, 'get/Events/${id}', tracing)
|
||||
return EventToApproveDetailsMapper.toDomain(response)
|
||||
})
|
||||
).toPromise()
|
||||
@@ -116,7 +116,12 @@ export class AgendaDataRepositoryService {
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
if(isHttpError(e)) {
|
||||
alert(e.status)
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing?.bugFlag()
|
||||
tracing?.setAttribute('outcome', 'failed')
|
||||
}
|
||||
} else {
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
@@ -139,6 +144,10 @@ export class AgendaDataRepositoryService {
|
||||
} catch (e) {
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing?.bugFlag()
|
||||
tracing?.setAttribute('outcome', 'failed')
|
||||
}
|
||||
} else {
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
|
||||
@@ -76,7 +76,7 @@ export class EventToApproveDetailsMapper {
|
||||
return 'Optional'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
@@ -170,8 +170,8 @@ export class EventToApproveDetailsMapper {
|
||||
ApplicationId: e.applicationId,
|
||||
})),
|
||||
eventRecurrence: {
|
||||
frequency: dto.eventRecurrence.frequency,
|
||||
until: dto.eventRecurrence.until
|
||||
frequency: dto.eventRecurrence?.frequency,
|
||||
until: dto.eventRecurrence?.until
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,6 @@ export const EventOutputDTOSchema = z.object({
|
||||
organizer: OrganizerSchema,
|
||||
status: z.nativeEnum(EEventStatus), // ['Pending', 'Revision', 'Approved', 'Declined', 'Communicated', 'ToCommunicate'] = [1, 2, 3, 4, 5, 6]
|
||||
}),
|
||||
}).nullable();
|
||||
})
|
||||
|
||||
export type EventOutputDTO = z.infer<typeof EventOutputDTOSchema>
|
||||
|
||||
@@ -24,9 +24,9 @@ export function APIReturn(schema: z.ZodTypeAny, path: string) {
|
||||
// Capture the Zod validation error with additional context
|
||||
console.error('Validation failed:', error.errors);
|
||||
} else {
|
||||
console.log('failed to setup the connection successful')
|
||||
// Throw any other unexpected errors
|
||||
throw error;
|
||||
// throw error;
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -45,6 +45,7 @@ export function APINODReturn(schema: z.ZodTypeAny, data , path: string, tracing?
|
||||
|
||||
try {
|
||||
// Validate the result using the provided schema
|
||||
console.log({schema, data})
|
||||
schema.parse(data);
|
||||
|
||||
} catch (error) {
|
||||
@@ -63,8 +64,9 @@ export function APINODReturn(schema: z.ZodTypeAny, data , path: string, tracing?
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log(error)
|
||||
// Throw any other unexpected errors
|
||||
throw error;
|
||||
// throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +172,7 @@ export class EventListPage implements OnInit {
|
||||
|
||||
this.showLoader = false;
|
||||
} else {
|
||||
tracing.setAttribute('run', 'to early')
|
||||
console.warn('calling to early eventlistpageshared/loadtoapproveevents')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user