resolve conflicts

This commit is contained in:
Alex Holliday committed 2026-04-29 11:39:08 -07:00
commit 3dbad1743a
55 files changed
+4387 -953

No files matched your search

+6 -14
View File
@@ -12,7 +12,6 @@ import { IStatusPageService } from "@/service/business/statusPageService.js";
import { IMonitorsRepository } from "@/repositories/index.js";
import { ISettingsService } from "@/service/system/settingsService.js";
import { NormalizeData } from "@/utils/dataUtils.js";
import { applyDefaultTheme, withoutThemeFields } from "@/controllers/statusPageThemeFlag.js";
const SERVICE_NAME = "statusPageController";
@@ -47,16 +46,14 @@ class StatusPageController implements IStatusPageController {
imageValidation.parse(req.file);
}
const themesEnabled = this.settingsService.areStatusPageThemesEnabled();
const body = themesEnabled ? req.body : withoutThemeFields(req.body);
const teamId = requireTeamId(req?.user?.teamId);
const userId = requireUserId(req?.user?.id);
const statusPage = await this.statusPageService.createStatusPage(userId, teamId, req.file, body);
const statusPage = await this.statusPageService.createStatusPage(userId, teamId, req.file, req.body);
return res.status(200).json({
success: true,
msg: "Status page created successfully",
data: themesEnabled ? statusPage : applyDefaultTheme(statusPage),
data: statusPage,
});
} catch (error) {
next(error);
@@ -70,21 +67,19 @@ class StatusPageController implements IStatusPageController {
imageValidation.parse(req.file);
}
const themesEnabled = this.settingsService.areStatusPageThemesEnabled();
const body = themesEnabled ? req.body : withoutThemeFields(req.body);
const teamId = requireTeamId(req?.user?.teamId);
const statusPageId = req.params.id as string;
if (!statusPageId) {
throw new AppError({ message: "Status page ID is required", status: 400 });
}
const statusPage = await this.statusPageService.updateStatusPage(statusPageId, teamId, req.file, body);
const statusPage = await this.statusPageService.updateStatusPage(statusPageId, teamId, req.file, req.body);
if (statusPage === null) {
throw new AppError({ message: "Status page not found", status: 404 });
}
res.status(200).json({
success: true,
msg: "Status page updated successfully",
data: themesEnabled ? statusPage : applyDefaultTheme(statusPage),
data: statusPage,
});
} catch (error) {
next(error);
@@ -130,13 +125,11 @@ class StatusPageController implements IStatusPageController {
}
return { ...monitor, checks: normalizedChecks };
});
const themesEnabled = this.settingsService.areStatusPageThemesEnabled();
return res.status(200).json({
success: true,
msg: "Status page retrieved successfully",
data: {
statusPage: themesEnabled ? statusPage : applyDefaultTheme(statusPage),
statusPage,
monitors: normalizedMonitors,
},
});
@@ -149,11 +142,10 @@ class StatusPageController implements IStatusPageController {
const teamId = requireTeamId(req.user?.teamId);
const statusPages = await this.statusPageService.getStatusPagesByTeamId(teamId);
const themesEnabled = this.settingsService.areStatusPageThemesEnabled();
return res.status(200).json({
success: true,
msg: "Status pages retrieved successfully",
data: themesEnabled ? statusPages : statusPages.map((sp) => applyDefaultTheme(sp)),
data: statusPages,
});
} catch (error) {
next(error);