Files
Checkmate/server/src/domain/incidents/incident.repository.interface.ts
T

29 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-06-09 12:34:15 -07:00
import type { Incident } from "@/domain/incidents/incident.type.js";
import type { IncidentSummary } from "@/domain/incidents/incident.type.js";
2026-01-19 23:41:24 +00:00
export interface IIncidentsRepository {
// create
create(incident: Partial<Incident>): Promise<Incident>;
// fetch
2026-01-22 21:28:28 +00:00
findById(incidentId: string, teamId: string): Promise<Incident>;
2026-01-19 23:41:24 +00:00
findActiveByIncidentId(incidentId: string, teamId: string): Promise<Incident | null>;
findActiveByMonitorId(monitorId: string, teamId: string): Promise<Incident | null>;
findByTeamId(
teamId: string,
2026-01-20 18:56:06 +00:00
startDate: Date | undefined,
2026-01-19 23:41:24 +00:00
page: number,
rowsPerPage: number,
sortOrder?: string,
2026-01-20 18:56:06 +00:00
status?: boolean,
2026-01-19 23:41:24 +00:00
monitorId?: string,
resolutionType?: string
): Promise<Incident[]>;
2026-01-20 18:56:06 +00:00
findSummaryByTeamId(teamId: string, limit?: number): Promise<IncidentSummary>;
countByTeamId(teamId: string, startDate: Date | undefined, status?: boolean, monitorId?: string, resolutionType?: string): Promise<number>;
2026-01-19 23:41:24 +00:00
// update
updateById(incidentId: string, teamId: string, updateData: Partial<Incident>): Promise<Incident>;
// delete
2026-02-17 18:30:22 +00:00
deleteByMonitorId(monitorId: string, teamId: string): Promise<number>;
2026-02-17 19:39:24 +00:00
deleteByMonitorIdsNotIn(monitorIds: string[]): Promise<number>;
2026-01-20 18:56:06 +00:00
// other
2026-01-19 23:41:24 +00:00
}