parse query

This commit is contained in:
Alex Holliday committed 2026-01-21 10:15:13 -08:00
1 parent 3fa370765e
commit ef61a63da0
2 files changed
+24 -7

No files matched your search

+14 -5
View File
@@ -1,5 +1,6 @@
import { AppError } from "@/utils/AppError.js";
import { Request, Response, NextFunction } from "express";
import { requireTeamId } from "./controllerUtils.js";
const SERVICE_NAME = "incidentController";
@@ -17,10 +18,19 @@ class IncidentController {
getIncidentsByTeam = async (req: Request, res: Response, next: NextFunction) => {
try {
const result = await this.incidentService.getIncidentsByTeam({
teamId: req?.user?.teamId,
query: req?.query,
});
const { sortOrder, dateRange, page, rowsPerPage, status, monitorId, resolutionType } = req.query || {};
const teamId = requireTeamId(req.user?.teamId);
const result = await this.incidentService.getIncidentsByTeam(
teamId,
sortOrder,
dateRange,
page,
rowsPerPage,
status,
monitorId,
resolutionType
);
return res.status(200).json({
success: true,
@@ -73,7 +83,6 @@ class IncidentController {
resolveIncidentManually = async (req: Request, res: Response, next: NextFunction) => {
try {
console.log({ user: req.user });
const resolvedIncident = await this.incidentService.resolveIncident(
req?.params?.incidentId,
req?.user?.id,