fix: i18n rebase
This commit is contained in:
1 parent
7b6eed96f4
commit
4c92922d40
5 files changed
+26
-10
No files matched your search
@@ -5,7 +5,6 @@ import {
|
|||||||
getStatusPageQueryValidation,
|
getStatusPageQueryValidation,
|
||||||
imageValidation,
|
imageValidation,
|
||||||
} from "../validation/joi.js";
|
} from "../validation/joi.js";
|
||||||
import { successMessages, errorMessages } from "../utils/messages.js";
|
|
||||||
|
|
||||||
const SERVICE_NAME = "statusPageController";
|
const SERVICE_NAME = "statusPageController";
|
||||||
|
|
||||||
@@ -47,12 +46,12 @@ class StatusPageController {
|
|||||||
try {
|
try {
|
||||||
const statusPage = await this.db.updateStatusPage(req.body, req.file);
|
const statusPage = await this.db.updateStatusPage(req.body, req.file);
|
||||||
if (statusPage === null) {
|
if (statusPage === null) {
|
||||||
const error = new Error(errorMessages.STATUS_PAGE_NOT_FOUND);
|
const error = new Error(this.stringService.statusPageNotFound);
|
||||||
error.status = 404;
|
error.status = 404;
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
return res.success({
|
return res.success({
|
||||||
msg: successMessages.STATUS_PAGE_UPDATE,
|
msg: this.stringService.statusPageUpdate,
|
||||||
data: statusPage,
|
data: statusPage,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -109,7 +108,7 @@ class StatusPageController {
|
|||||||
try {
|
try {
|
||||||
await this.db.deleteStatusPage(req.params.url);
|
await this.db.deleteStatusPage(req.params.url);
|
||||||
return res.success({
|
return res.success({
|
||||||
msg: successMessages.STATUS_PAGE_DELETE,
|
msg: this.stringService.statusPageDelete,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(handleError(error, SERVICE_NAME, "deleteStatusPage"));
|
next(handleError(error, SERVICE_NAME, "deleteStatusPage"));
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import Check from "../../models/Check.js";
|
|||||||
import PageSpeedCheck from "../../models/PageSpeedCheck.js";
|
import PageSpeedCheck from "../../models/PageSpeedCheck.js";
|
||||||
import HardwareCheck from "../../models/HardwareCheck.js";
|
import HardwareCheck from "../../models/HardwareCheck.js";
|
||||||
import DistributedUptimeCheck from "../../models/DistributedUptimeCheck.js";
|
import DistributedUptimeCheck from "../../models/DistributedUptimeCheck.js";
|
||||||
import { errorMessages } from "../../../utils/messages.js";
|
|
||||||
import Notification from "../../models/Notification.js";
|
import Notification from "../../models/Notification.js";
|
||||||
import { NormalizeData, NormalizeDataUptimeDetails } from "../../../utils/dataUtils.js";
|
import { NormalizeData, NormalizeDataUptimeDetails } from "../../../utils/dataUtils.js";
|
||||||
import ServiceRegistry from "../../../service/serviceRegistry.js";
|
import ServiceRegistry from "../../../service/serviceRegistry.js";
|
||||||
@@ -376,7 +375,7 @@ const getDistributedUptimeDetailsById = async (req) => {
|
|||||||
const { monitorId } = req.params;
|
const { monitorId } = req.params;
|
||||||
const monitor = await Monitor.findById(monitorId);
|
const monitor = await Monitor.findById(monitorId);
|
||||||
if (monitor === null || monitor === undefined) {
|
if (monitor === null || monitor === undefined) {
|
||||||
throw new Error(errorMessages.DB_FIND_MONITOR_BY_ID(monitorId));
|
throw new Error(this.stringService.dbFindMonitorById(monitorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dateRange, normalize } = req.query;
|
const { dateRange, normalize } = req.query;
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import StatusPage from "../../models/StatusPage.js";
|
import StatusPage from "../../models/StatusPage.js";
|
||||||
import { errorMessages } from "../../../utils/messages.js";
|
|
||||||
import { NormalizeData } from "../../../utils/dataUtils.js";
|
import { NormalizeData } from "../../../utils/dataUtils.js";
|
||||||
|
import ServiceRegistry from "../../../service/serviceRegistry.js";
|
||||||
|
import StringService from "../../../service/stringService.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "statusPageModule";
|
const SERVICE_NAME = "statusPageModule";
|
||||||
|
|
||||||
const createStatusPage = async (statusPageData, image) => {
|
const createStatusPage = async (statusPageData, image) => {
|
||||||
|
const stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statusPage = new StatusPage({ ...statusPageData });
|
const statusPage = new StatusPage({ ...statusPageData });
|
||||||
if (image) {
|
if (image) {
|
||||||
@@ -67,10 +70,12 @@ const getStatusPageByUrl = async (url, type) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getStatusPagesByTeamId = async (teamId) => {
|
const getStatusPagesByTeamId = async (teamId) => {
|
||||||
|
const stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statusPages = await StatusPage.find({ teamId });
|
const statusPages = await StatusPage.find({ teamId });
|
||||||
if (statusPages.length === 0) {
|
if (statusPages.length === 0) {
|
||||||
const error = new Error(errorMessages.STATUS_PAGE_NOT_FOUND);
|
const error = new Error(stringService.statusPageNotFound);
|
||||||
error.status = 404;
|
error.status = 404;
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -83,6 +88,8 @@ const getStatusPagesByTeamId = async (teamId) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getStatusPage = async (url) => {
|
const getStatusPage = async (url) => {
|
||||||
|
const stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statusPageQuery = await StatusPage.aggregate([
|
const statusPageQuery = await StatusPage.aggregate([
|
||||||
{ $match: { url: url } },
|
{ $match: { url: url } },
|
||||||
@@ -156,7 +163,7 @@ const getStatusPage = async (url) => {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
if (!statusPageQuery.length) {
|
if (!statusPageQuery.length) {
|
||||||
const error = new Error(errorMessages.STATUS_PAGE_NOT_FOUND);
|
const error = new Error(stringService.statusPageNotFound);
|
||||||
error.status = 404;
|
error.status = 404;
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,5 +141,7 @@
|
|||||||
"dockerSuccess": "Docker container status fetched successfully",
|
"dockerSuccess": "Docker container status fetched successfully",
|
||||||
"portSuccess": "Port connected successfully",
|
"portSuccess": "Port connected successfully",
|
||||||
"monitorPause": "Monitor paused successfully",
|
"monitorPause": "Monitor paused successfully",
|
||||||
"monitorResume": "Monitor resumed successfully"
|
"monitorResume": "Monitor resumed successfully",
|
||||||
|
"statusPageDelete": "Status page deleted successfully",
|
||||||
|
"statusPageUpdate": "Status page updated successfully"
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,15 @@ class StringService {
|
|||||||
return this.translationService.getTranslation('statusPageCreate');
|
return this.translationService.getTranslation('statusPageCreate');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get statusPageDelete() {
|
||||||
|
return this.translationService.getTranslation('statusPageDelete');
|
||||||
|
}
|
||||||
|
|
||||||
|
get statusPageUpdate() {
|
||||||
|
return this.translationService.getTranslation('statusPageUpdate');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
get statusPageNotFound() {
|
get statusPageNotFound() {
|
||||||
return this.translationService.getTranslation('statusPageNotFound');
|
return this.translationService.getTranslation('statusPageNotFound');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user