2026-04-13 11:39:29 -07:00
|
|
|
import type { MonitorStats, CheckResultInput } from "@/types/index.js";
|
|
|
|
|
|
2026-01-14 19:28:17 +00:00
|
|
|
export interface IMonitorStatsRepository {
|
|
|
|
|
// create
|
2026-02-12 22:37:40 +00:00
|
|
|
create(data: Omit<MonitorStats, "id" | "createdAt" | "updatedAt">): Promise<MonitorStats>;
|
2026-01-14 19:28:17 +00:00
|
|
|
// single fetch
|
|
|
|
|
findByMonitorId(monitorId: string): Promise<MonitorStats>;
|
2026-04-13 11:39:29 -07:00
|
|
|
// Upsert must be atomic to prevent race conditions
|
|
|
|
|
updateByMonitorId(monitorId: string, result: CheckResultInput): Promise<MonitorStats>;
|
2026-01-14 19:28:17 +00:00
|
|
|
// delete
|
2026-01-15 19:36:41 +00:00
|
|
|
deleteByMonitorId(monitorId: string): Promise<MonitorStats>;
|
2026-02-17 19:03:17 +00:00
|
|
|
deleteByMonitorIds(monitorIds: string[]): Promise<number>;
|
|
|
|
|
deleteByMonitorIdsNotIn(monitorIds: string[]): Promise<number>;
|
2026-01-14 19:28:17 +00:00
|
|
|
// other
|
|
|
|
|
}
|