diff --git a/client/src/Pages/Incidents/Components/CardDetails.tsx b/client/src/Pages/Incidents/Components/CardDetails.tsx
index 4c6545428..c1a0c1dd2 100644
--- a/client/src/Pages/Incidents/Components/CardDetails.tsx
+++ b/client/src/Pages/Incidents/Components/CardDetails.tsx
@@ -171,7 +171,7 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
- {incident.resolvedBy}
+ {incident.resolvedByEmail ?? incident.resolvedBy}
>
)}
diff --git a/client/src/Types/Incident.ts b/client/src/Types/Incident.ts
index 90a7a54b0..5a57342f1 100644
--- a/client/src/Types/Incident.ts
+++ b/client/src/Types/Incident.ts
@@ -9,6 +9,7 @@ export interface Incident {
statusCode?: number | null;
resolutionType: "automatic" | "manual" | null;
resolvedBy?: string | null;
+ resolvedByEmail?: string | null;
comment?: string | null;
createdAt: string;
updatedAt: string;
diff --git a/server/src/controllers/controllerUtils.ts b/server/src/controllers/controllerUtils.ts
index e6c8767fa..592c58fc3 100755
--- a/server/src/controllers/controllerUtils.ts
+++ b/server/src/controllers/controllerUtils.ts
@@ -105,6 +105,12 @@ const requireUserId = (userId?: string): string => {
}
return userId;
};
+const requireUserEmail = (userEmail?: string): string => {
+ if (!userEmail) {
+ throw new AppError({ message: "User email is required", status: 400 });
+ }
+ return userEmail;
+};
export {
fetchMonitorCertificate,
@@ -116,4 +122,5 @@ export {
parseSortOrder,
requireTeamId,
requireUserId,
+ requireUserEmail,
};
diff --git a/server/src/controllers/incidentController.ts b/server/src/controllers/incidentController.ts
index 5f2b6d154..cd38b287f 100644
--- a/server/src/controllers/incidentController.ts
+++ b/server/src/controllers/incidentController.ts
@@ -1,6 +1,6 @@
import { AppError } from "@/utils/AppError.js";
import { Request, Response, NextFunction } from "express";
-import { requireTeamId } from "./controllerUtils.js";
+import { requireTeamId, requireUserId, requireUserEmail } from "./controllerUtils.js";
const SERVICE_NAME = "incidentController";
@@ -86,12 +86,15 @@ class IncidentController {
resolveIncidentManually = async (req: Request, res: Response, next: NextFunction) => {
try {
- const resolvedIncident = await this.incidentService.resolveIncident(
- req?.params?.incidentId,
- req?.user?.id,
- req?.user?.teamId,
- req?.body?.comment
- );
+ const teamId = requireTeamId(req.user?.teamId);
+ const userId = requireUserId(req.user?.id);
+ const userEmail = requireUserEmail(req.user?.email);
+ const incidentId = req.params?.incidentId;
+ if (!incidentId) {
+ throw new AppError({ message: "Incident ID is required", service: SERVICE_NAME, status: 400 });
+ }
+
+ const resolvedIncident = await this.incidentService.resolveIncident(incidentId, userId, teamId, req?.body?.comment, userEmail);
return res.status(200).json({
success: true,
diff --git a/server/src/db/models/Incident.ts b/server/src/db/models/Incident.ts
index 8de1c7c2c..82e2b5eb2 100644
--- a/server/src/db/models/Incident.ts
+++ b/server/src/db/models/Incident.ts
@@ -64,6 +64,10 @@ const IncidentSchema = new Schema(
ref: "User",
default: null,
},
+ resolvedByEmail: {
+ type: String,
+ default: null,
+ },
comment: {
type: String,
default: null,
diff --git a/server/src/repositories/incidents/MongoIncidentRepository.ts b/server/src/repositories/incidents/MongoIncidentRepository.ts
index b029953ca..9746471a9 100644
--- a/server/src/repositories/incidents/MongoIncidentRepository.ts
+++ b/server/src/repositories/incidents/MongoIncidentRepository.ts
@@ -58,6 +58,7 @@ class MongoIncidentRepository implements IIncidentsRepository {
statusCode: doc.statusCode ?? null,
resolutionType: doc.resolutionType ?? null,
resolvedBy: doc.resolvedBy ? this.toStringId(doc.resolvedBy) : null,
+ resolvedByEmail: doc.resolvedByEmail ?? null,
comment: doc.comment ?? null,
createdAt: this.toDateString(doc.createdAt),
updatedAt: this.toDateString(doc.updatedAt),
diff --git a/server/src/service/business/incidentService.ts b/server/src/service/business/incidentService.ts
index b5add7703..8116c893a 100644
--- a/server/src/service/business/incidentService.ts
+++ b/server/src/service/business/incidentService.ts
@@ -71,7 +71,7 @@ class IncidentService {
return await this.incidentsRepository.updateById(activeIncident.id, activeIncident.teamId, activeIncident);
};
- resolveIncident = async (incidentId: string, userId: string, teamId: string, comment?: string) => {
+ resolveIncident = async (incidentId: string, userId: string, teamId: string, comment?: string, userEmail?: string) => {
try {
if (!incidentId) {
throw new AppError({ message: "No incident ID in request", service: SERVICE_NAME, method: "resolveIncident" });
@@ -98,6 +98,7 @@ class IncidentService {
incident.resolutionType = "manual";
incident.status = false;
incident.resolvedBy = userId;
+ incident.resolvedByEmail = userEmail || null;
incident.comment = comment || null;
incident.endTime = Date.now().toString();
diff --git a/server/src/types/incident.ts b/server/src/types/incident.ts
index 39dfb3d0d..6b076ff83 100644
--- a/server/src/types/incident.ts
+++ b/server/src/types/incident.ts
@@ -14,6 +14,7 @@ export interface Incident {
statusCode?: number | null;
resolutionType: IncidentResolutionType;
resolvedBy?: string | null;
+ resolvedByEmail?: string | null;
comment?: string | null;
createdAt: string;
updatedAt: string;