remove server side normalization
This commit is contained in:
1 parent
093553f9ba
commit
8a608961e6
7 files changed
+3
-118
No files matched your search
@@ -168,10 +168,6 @@ export interface HasResponseTime {
|
||||
responseTime: number;
|
||||
}
|
||||
|
||||
export type NormalizedCheck<T extends HasResponseTime = Check> = T & {
|
||||
originalResponseTime: number;
|
||||
};
|
||||
|
||||
export type CheckSnapshot = Omit<Check, "metadata" | "updatedAt">;
|
||||
|
||||
export interface HardwareDiskStats {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { NormalizeData } from "@/utils/dataUtils.js";
|
||||
import { type Monitor } from "@/domain/monitors/monitor.type.js";
|
||||
import type {
|
||||
MonitorType,
|
||||
@@ -364,7 +363,7 @@ export class MonitorService implements IMonitorService {
|
||||
const monitorsWithChecks = monitors.map((monitor: Monitor) => {
|
||||
const rawChecks = monitor.recentChecks ?? [];
|
||||
const isSnapshotType = snapshotOnlyRequest || snapshotTypes.includes(monitor.type);
|
||||
const checks = isSnapshotType ? rawChecks.slice(0, 1) : NormalizeData(rawChecks, 10, 100);
|
||||
const checks = isSnapshotType ? rawChecks.slice(0, 1) : rawChecks;
|
||||
monitor.recentChecks = checks;
|
||||
return monitor;
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
import { AppError } from "@/utils/AppError.js";
|
||||
import { normalizeStatusPageDomain } from "@/utils/statusPageDomain.js";
|
||||
import { Monitor } from "@/domain/monitors/monitor.type.js";
|
||||
import { NormalizeData } from "@/utils/dataUtils.js";
|
||||
|
||||
export interface IStatusPageService {
|
||||
createStatusPage(userId: string, teamId: string, image: Express.Multer.File | undefined, data: Partial<StatusPage>): Promise<StatusPage>;
|
||||
@@ -79,7 +78,6 @@ export class StatusPageService implements IStatusPageService {
|
||||
status: monitor.status,
|
||||
uptimePercentage: monitor.uptimePercentage,
|
||||
recentChecks: monitor.recentChecks,
|
||||
checks: NormalizeData(monitor.recentChecks, 10, 100),
|
||||
};
|
||||
|
||||
if (showURL) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Monitor } from "@/domain/monitors/monitor.type.js";
|
||||
import type { NormalizedCheck, CheckSnapshot } from "@/domain/checks/check.type.js";
|
||||
export const StatusPageTypes = ["uptime", "infrastructure"] as const;
|
||||
export type StatusPageType = (typeof StatusPageTypes)[number];
|
||||
|
||||
@@ -48,7 +47,7 @@ export interface StatusPage {
|
||||
}
|
||||
|
||||
export type PublicStatusPageMonitor = Pick<Monitor, "id" | "name" | "type" | "status" | "uptimePercentage" | "recentChecks"> &
|
||||
Partial<Pick<Monitor, "url" | "port">> & { checks: NormalizedCheck<CheckSnapshot>[] };
|
||||
Partial<Pick<Monitor, "url" | "port">>;
|
||||
|
||||
export interface PublicStatusPagePayload {
|
||||
statusPage: StatusPage;
|
||||
|
||||
Reference in new issue
Block a user