Browse Source

feat(api): create interface for BetterStack update SLA response

pull/7328/head
KenTandrian 1 day ago
parent
commit
e44ecfeb5f
  1. 7
      apps/api/src/services/queues/statistics-gathering/interfaces/interfaces.ts
  2. 4
      apps/api/src/services/queues/statistics-gathering/statistics-gathering.processor.ts

7
apps/api/src/services/queues/statistics-gathering/interfaces/interfaces.ts

@ -0,0 +1,7 @@
export interface BetterStackUptimeSlaResponse {
data: {
attributes: {
availability: number;
};
};
}

4
apps/api/src/services/queues/statistics-gathering/statistics-gathering.processor.ts

@ -25,6 +25,8 @@ import { Injectable, Logger } from '@nestjs/common';
import * as cheerio from 'cheerio';
import { format, subDays } from 'date-fns';
import { BetterStackUptimeSlaResponse } from './interfaces/interfaces';
@Injectable()
@Processor(STATISTICS_GATHERING_QUEUE)
export class StatisticsGatheringProcessor {
@ -225,7 +227,7 @@ export class StatisticsGatheringProcessor {
)
}
)
.then((res) => res.json());
.then<BetterStackUptimeSlaResponse>((res) => res.json());
return data.attributes.availability / 100;
} catch (error) {

Loading…
Cancel
Save