remove old expiry field, remove vestigal checks
This commit is contained in:
1 parent
6ad0a6a29d
commit
cadf68740a
5 files changed
+9
-21
No files matched your search
@@ -127,7 +127,6 @@ export interface Check {
|
|||||||
timings?: CheckTimings;
|
timings?: CheckTimings;
|
||||||
statusCode: number;
|
statusCode: number;
|
||||||
message: string;
|
message: string;
|
||||||
expiry: string;
|
|
||||||
cpu?: CheckCpuInfo;
|
cpu?: CheckCpuInfo;
|
||||||
memory?: CheckMemoryInfo;
|
memory?: CheckMemoryInfo;
|
||||||
disk?: CheckDiskInfo[];
|
disk?: CheckDiskInfo[];
|
||||||
@@ -243,7 +242,7 @@ export interface ChecksSummary {
|
|||||||
downChecks: number;
|
downChecks: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CheckSnapshot = Omit<Check, "metadata" | "expiry" | "__v" | "updatedAt"> & {
|
export type CheckSnapshot = Omit<Check, "metadata" | "__v" | "updatedAt"> & {
|
||||||
originalResponseTime: number;
|
originalResponseTime: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ type CheckMetadataDocument = Omit<CheckMetadata, "monitorId" | "teamId"> & {
|
|||||||
type: MonitorType;
|
type: MonitorType;
|
||||||
};
|
};
|
||||||
|
|
||||||
type CheckDocumentBase = Omit<Check, "id" | "metadata" | "expiry" | "createdAt" | "updatedAt"> & {
|
type CheckDocumentBase = Omit<Check, "id" | "metadata" | "createdAt" | "updatedAt"> & {
|
||||||
metadata: CheckMetadataDocument;
|
metadata: CheckMetadataDocument;
|
||||||
expiry: Date;
|
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
updatedAt: Date;
|
updatedAt: Date;
|
||||||
};
|
};
|
||||||
@@ -223,10 +222,7 @@ const CheckSchema = new Schema<CheckDocument>(
|
|||||||
message: {
|
message: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
expiry: {
|
|
||||||
type: Date,
|
|
||||||
default: Date.now,
|
|
||||||
},
|
|
||||||
cpu: {
|
cpu: {
|
||||||
type: cpuSchema,
|
type: cpuSchema,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import type {
|
|||||||
} from "@/types/index.js";
|
} from "@/types/index.js";
|
||||||
import type { HardwareStatusPayload, PageSpeedStatusPayload } from "@/types/network.js";
|
import type { HardwareStatusPayload, PageSpeedStatusPayload } from "@/types/network.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { ParseBoolean } from "@/utils/utils.js";
|
|
||||||
import { ILogger } from "@/utils/logger.js";
|
import { ILogger } from "@/utils/logger.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "checkService";
|
const SERVICE_NAME = "checkService";
|
||||||
@@ -168,11 +167,10 @@ export class CheckService implements ICheckService {
|
|||||||
// For verification, throws an error if monitor doesn't belong to team
|
// For verification, throws an error if monitor doesn't belong to team
|
||||||
await this.monitorsRepository.findById(monitorId, teamId);
|
await this.monitorsRepository.findById(monitorId, teamId);
|
||||||
|
|
||||||
const parsedStatus = typeof status === "undefined" ? status : ParseBoolean(status);
|
const parsedPage = page ?? 0;
|
||||||
const parsedPage = page ? page : 0;
|
const parsedRowsPerPage = rowsPerPage ?? 5;
|
||||||
const parsedRowsPerPage = rowsPerPage ? rowsPerPage : 5;
|
|
||||||
|
|
||||||
const result = await this.checksRepository.findByMonitorId(monitorId, sortOrder, dateRange, filter, parsedPage, parsedRowsPerPage, parsedStatus);
|
const result = await this.checksRepository.findByMonitorId(monitorId, sortOrder, dateRange, filter, parsedPage, parsedRowsPerPage, status);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -192,8 +190,8 @@ export class CheckService implements ICheckService {
|
|||||||
rowsPerPage: number;
|
rowsPerPage: number;
|
||||||
filter?: string;
|
filter?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const parsedPage = page ? page : 0;
|
const parsedPage = page ?? 0;
|
||||||
const parsedRowsPerPage = rowsPerPage ? rowsPerPage : 5;
|
const parsedRowsPerPage = rowsPerPage ?? 5;
|
||||||
|
|
||||||
const checkData = await this.checksRepository.findByTeamId(sortOrder, dateRange, filter, parsedPage, parsedRowsPerPage, teamId);
|
const checkData = await this.checksRepository.findByTeamId(sortOrder, dateRange, filter, parsedPage, parsedRowsPerPage, teamId);
|
||||||
return checkData;
|
return checkData;
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ export interface Check {
|
|||||||
timings?: GotTimings;
|
timings?: GotTimings;
|
||||||
statusCode: number;
|
statusCode: number;
|
||||||
message: string;
|
message: string;
|
||||||
expiry: string;
|
|
||||||
cpu?: CheckCpuInfo;
|
cpu?: CheckCpuInfo;
|
||||||
memory?: CheckMemoryInfo;
|
memory?: CheckMemoryInfo;
|
||||||
disk?: CheckDiskInfo[];
|
disk?: CheckDiskInfo[];
|
||||||
@@ -205,4 +204,4 @@ export type NormalizedUptimeCheck<T extends GroupedCheck = GroupedCheck> = T & {
|
|||||||
originalAvgResponseTime: number;
|
originalAvgResponseTime: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CheckSnapshot = Omit<Check, "metadata" | "expiry" | "updatedAt">;
|
export type CheckSnapshot = Omit<Check, "metadata" | "updatedAt">;
|
||||||
@@ -40,7 +40,3 @@ export const deleteChecksParamValidation = z.object({
|
|||||||
export const getChecksSummaryByTeamIdQueryValidation = z.object({
|
export const getChecksSummaryByTeamIdQueryValidation = z.object({
|
||||||
dateRange: z.enum(["recent", "hour", "day", "week", "month", "all"]).optional(),
|
dateRange: z.enum(["recent", "hour", "day", "week", "month", "all"]).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateChecksTTLBodyValidation = z.object({
|
|
||||||
ttl: z.number().min(1, "TTL is required"),
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user