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;
|
||||
statusCode: number;
|
||||
message: string;
|
||||
expiry: string;
|
||||
cpu?: CheckCpuInfo;
|
||||
memory?: CheckMemoryInfo;
|
||||
disk?: CheckDiskInfo[];
|
||||
@@ -243,7 +242,7 @@ export interface ChecksSummary {
|
||||
downChecks: number;
|
||||
}
|
||||
|
||||
export type CheckSnapshot = Omit<Check, "metadata" | "expiry" | "__v" | "updatedAt"> & {
|
||||
export type CheckSnapshot = Omit<Check, "metadata" | "__v" | "updatedAt"> & {
|
||||
originalResponseTime: number;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,9 +21,8 @@ type CheckMetadataDocument = Omit<CheckMetadata, "monitorId" | "teamId"> & {
|
||||
type: MonitorType;
|
||||
};
|
||||
|
||||
type CheckDocumentBase = Omit<Check, "id" | "metadata" | "expiry" | "createdAt" | "updatedAt"> & {
|
||||
type CheckDocumentBase = Omit<Check, "id" | "metadata" | "createdAt" | "updatedAt"> & {
|
||||
metadata: CheckMetadataDocument;
|
||||
expiry: Date;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
};
|
||||
@@ -223,10 +222,7 @@ const CheckSchema = new Schema<CheckDocument>(
|
||||
message: {
|
||||
type: String,
|
||||
},
|
||||
expiry: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
|
||||
cpu: {
|
||||
type: cpuSchema,
|
||||
default: () => ({}),
|
||||
|
||||
@@ -11,7 +11,6 @@ import type {
|
||||
} from "@/types/index.js";
|
||||
import type { HardwareStatusPayload, PageSpeedStatusPayload } from "@/types/network.js";
|
||||
import { AppError } from "@/utils/AppError.js";
|
||||
import { ParseBoolean } from "@/utils/utils.js";
|
||||
import { ILogger } from "@/utils/logger.js";
|
||||
|
||||
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
|
||||
await this.monitorsRepository.findById(monitorId, teamId);
|
||||
|
||||
const parsedStatus = typeof status === "undefined" ? status : ParseBoolean(status);
|
||||
const parsedPage = page ? page : 0;
|
||||
const parsedRowsPerPage = rowsPerPage ? rowsPerPage : 5;
|
||||
const parsedPage = page ?? 0;
|
||||
const parsedRowsPerPage = 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;
|
||||
};
|
||||
@@ -192,8 +190,8 @@ export class CheckService implements ICheckService {
|
||||
rowsPerPage: number;
|
||||
filter?: string;
|
||||
}) => {
|
||||
const parsedPage = page ? page : 0;
|
||||
const parsedRowsPerPage = rowsPerPage ? rowsPerPage : 5;
|
||||
const parsedPage = page ?? 0;
|
||||
const parsedRowsPerPage = rowsPerPage ?? 5;
|
||||
|
||||
const checkData = await this.checksRepository.findByTeamId(sortOrder, dateRange, filter, parsedPage, parsedRowsPerPage, teamId);
|
||||
return checkData;
|
||||
|
||||
@@ -101,7 +101,6 @@ export interface Check {
|
||||
timings?: GotTimings;
|
||||
statusCode: number;
|
||||
message: string;
|
||||
expiry: string;
|
||||
cpu?: CheckCpuInfo;
|
||||
memory?: CheckMemoryInfo;
|
||||
disk?: CheckDiskInfo[];
|
||||
@@ -205,4 +204,4 @@ export type NormalizedUptimeCheck<T extends GroupedCheck = GroupedCheck> = T & {
|
||||
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({
|
||||
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