add controller method for getting status page by url, update delete controlelr method

This commit is contained in:
Alex Holliday
2025-02-07 14:47:22 -08:00
parent 65bc98ca2e
commit c352ca39b1

View File

@@ -62,7 +62,7 @@ class StatusPageController {
try {
const statusPage = await this.db.getStatusPage();
return res.success({
msg: successMessages.STATUS_PAGE_BY_URL,
msg: successMessages.STATUS_PAGE,
data: statusPage,
});
} catch (error) {
@@ -70,9 +70,21 @@ class StatusPageController {
}
};
getStatusPageByUrl = async (req, res, next) => {
try {
const statusPage = await this.db.getStatusPageByUrl(req.params.url);
return res.success({
msg: successMessages.STATUS_PAGE_BY_URL,
data: statusPage,
});
} catch (error) {
next(handleError(error, SERVICE_NAME, "getStatusPageByUrl"));
}
};
deleteStatusPage = async (req, res, next) => {
try {
await this.db.deleteStatusPage();
await this.db.deleteStatusPage(req.params.url);
return res.success({
msg: successMessages.STATUS_PAGE_DELETE,
});