Files
interfaces/ts/data/incident.ts

82 lines
1.8 KiB
TypeScript

import type { TIncidentSeverity, TIncidentStatus } from './types.js';
// ============================================
// Incident Update
// ============================================
/**
* A single update within an incident timeline.
*/
export interface IIncidentUpdate {
id: string;
incidentId: string;
status: TIncidentStatus;
message: string;
createdAt: number;
createdBy?: string;
type?: 'comment' | 'status_change' | 'automatic';
}
// ============================================
// Incident
// ============================================
/**
* Represents an incident affecting one or more services.
*/
export interface IIncident {
id: string;
title: string;
description: string;
severity: TIncidentSeverity;
status: TIncidentStatus;
// Affected services
affectedServiceIds: string[];
// Timeline
createdAt: number;
updatedAt: number;
resolvedAt?: number;
firstResponseAt?: number;
// Updates history
updates: IIncidentUpdate[];
// Metadata
createdBy?: string;
assignedUserId?: string;
creationMode?: 'monitor' | 'manual';
// Scheduled maintenance
isScheduled?: boolean;
scheduledStartTime?: number;
scheduledEndTime?: number;
// Post-incident
postMortemLink?: string;
}
// ============================================
// Legacy Interface (for backward compatibility)
// ============================================
/**
* @deprecated Use IIncident instead
*/
export interface IIncidentLegacy {
timestamp: number;
firstResponseTimestamp?: number;
status: 'discovered' | 'investigating' | 'fixing' | 'fixImplemented' | 'watching' | 'resolved';
creationMode: 'monitor' | 'manual';
assignedUserId?: string;
postMortemLink?: string;
updates: {
markdownText: string;
type: 'comment' | 'manualUpdate' | 'automaticUpdate';
}[];
justForLooks: {
isoTimestamp: string;
};
}