Files
Checkmate/server/src/repositories/monitors/IMonitorsRepository.ts
T
2026-01-13 20:20:00 +00:00

29 lines
810 B
TypeScript

import { type MonitorType, type Monitor } from "@/types/index.js";
export interface TeamQueryConfig {
limit?: number;
type?: MonitorType | MonitorType[];
page?: number;
rowsPerPage?: number;
filter?: string;
field?: string;
order?: "asc" | "desc";
}
export interface IMonitorsRepository {
// create
create(monitor: Monitor, teamId: string, userId: string): Promise<Monitor | null>;
// single fetch
findById(monitorId: string): Promise<Monitor | null>;
// collection fetch
findAll(): Promise<Monitor[] | null>;
findByTeamId(teamId: string, config: TeamQueryConfig): Promise<Monitor[] | null>;
// update
update(monitorId: string, updates: Partial<Monitor>): Promise<Monitor>;
// delete
// counts
findMonitorCountByTeamIdAndType(teamId: string, config: TeamQueryConfig): Promise<number>;
}