mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
add monitoring
This commit is contained in:
@@ -44,17 +44,28 @@ export class AgendaDataRepositoryService {
|
||||
return this.agendaLocalDataSourceService.createCalendar(currentUserCalendar)
|
||||
}
|
||||
|
||||
async getEventById(id: string) {
|
||||
async getEventById(id: string, tracing?: TracingType) {
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
console.log('Response', response.data)
|
||||
console.log('Output', EventMapper.toDomain(response.data))
|
||||
return EventMapper.toDomain(response.data)
|
||||
EventMapper.toDomain(response)
|
||||
return EventMapper.toDomain(response)
|
||||
})
|
||||
).toPromise()
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
if(isHttpError(e)) {
|
||||
tracing?.setAttribute('status.code', e.status.toString())
|
||||
if (e.status == 400) {
|
||||
tracing.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}
|
||||
} else {
|
||||
tracing.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
}
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
@@ -72,7 +83,13 @@ 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.bugFlag()
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing?.setAttribute('map.error', 'true')
|
||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import { SharedCalendarListOutputDTO, SharedCalendarListOutputDTOSchema } from '
|
||||
import { HttpService } from '../../http.service';
|
||||
import { APIReturn } from '../../decorator/api-validate-schema.decorator';
|
||||
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
||||
import { EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventListOutputDTO, EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
||||
import { EventOutputDTO } from './model/eventDTOOutput';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -48,7 +49,7 @@ export class AgendaDataService {
|
||||
}
|
||||
|
||||
// @APIReturn(EventListOutputDTOSchema, 'get/Events')
|
||||
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string, tracing?: TracingType): Observable<any> {
|
||||
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string, tracing?: TracingType): Observable<EventListOutputDTO> {
|
||||
let params = new HttpParams()
|
||||
.set('UserId', userId)
|
||||
|
||||
@@ -72,7 +73,7 @@ export class AgendaDataService {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||
}
|
||||
|
||||
getEvent(id: string): Observable<any> {
|
||||
getEvent(id: string): Observable<EventOutputDTO> {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ export class EventMapper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
"owner": dto.owner,
|
||||
"HasAttachments": dto.hasAttachments,
|
||||
"EventComunicationId": 1682,
|
||||
"EventId": dto.id,
|
||||
|
||||
@@ -28,6 +28,11 @@ export class EventToApproveDetailsMapper {
|
||||
}
|
||||
|
||||
let color;
|
||||
if(dto.ownerType == EEventOwnerType.PR) {
|
||||
color = 'PR'
|
||||
} else {
|
||||
color = 'MDGPR'
|
||||
}
|
||||
|
||||
// if(dto.ownerType != 'PR') {
|
||||
let ownerType;
|
||||
@@ -74,6 +79,7 @@ export class EventToApproveDetailsMapper {
|
||||
|
||||
|
||||
return {
|
||||
"owner": dto.owner,
|
||||
"serialNumber": dto.id,
|
||||
"taskStatus": taskStatus,
|
||||
"originator": {
|
||||
|
||||
Reference in New Issue
Block a user