31 lines
978 B
TypeScript
31 lines
978 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>;
|
|
createBulkMonitors(monitors: Monitor[]): Promise<Monitor[]>;
|
|
// single fetch
|
|
findById(monitorId: string, teamId?: 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
|
|
deleteByTeamId(teamId: string): Promise<{ monitors: Monitor[]; deletedCount: number }>;
|
|
|
|
// counts
|
|
findMonitorCountByTeamIdAndType(teamId: string, config: TeamQueryConfig): Promise<number>;
|
|
}
|