Files
Checkmate/server/src/repositories/monitors/IMonitorsRepository.ts
T

30 lines
978 B
TypeScript
Raw Normal View History

2026-01-12 22:58:46 +00:00
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";
}
2026-01-12 19:32:23 +00:00
export interface IMonitorsRepository {
// create
2026-01-13 20:20:00 +00:00
create(monitor: Monitor, teamId: string, userId: string): Promise<Monitor | null>;
2026-01-13 22:56:51 +00:00
createBulkMonitors(monitors: Monitor[]): Promise<Monitor[]>;
2026-01-12 19:32:23 +00:00
// single fetch
2026-01-13 23:59:09 +00:00
findById(monitorId: string, teamId?: string): Promise<Monitor | null>;
2026-01-13 20:20:00 +00:00
2026-01-12 19:32:23 +00:00
// collection fetch
findAll(): Promise<Monitor[] | null>;
2026-01-12 22:58:46 +00:00
findByTeamId(teamId: string, config: TeamQueryConfig): Promise<Monitor[] | null>;
2026-01-12 19:32:23 +00:00
// update
2026-01-13 20:20:00 +00:00
update(monitorId: string, updates: Partial<Monitor>): Promise<Monitor>;
2026-01-12 19:32:23 +00:00
// delete
2026-01-13 23:22:34 +00:00
deleteByTeamId(teamId: string): Promise<{ monitors: Monitor[]; deletedCount: number }>;
2026-01-12 22:58:46 +00:00
// counts
findMonitorCountByTeamIdAndType(teamId: string, config: TeamQueryConfig): Promise<number>;
2026-01-12 19:32:23 +00:00
}