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