Fixes in the controllers
This commit is contained in:
1 parent
a9c1d131a5
commit
faa2a2d965
3 files changed
+4
-5
No files matched your search
@@ -142,11 +142,11 @@ class CheckController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { monitorId, teamId, target } = req.params;
|
const { monitorId, target } = req.params;
|
||||||
const { status } = req.body;
|
const { status } = req.body;
|
||||||
|
|
||||||
const updatedChecks = await this.db.updateAllChecksStatus(
|
const updatedChecks = await this.db.updateAllChecksStatus(
|
||||||
target === "monitor" ? monitorId : teamId,
|
monitorId,
|
||||||
status,
|
status,
|
||||||
target
|
target
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ const getChecksByTeam = async ({
|
|||||||
status,
|
status,
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
status = status === "true" ? true : false;
|
status = status === "true";
|
||||||
page = parseInt(page);
|
page = parseInt(page);
|
||||||
rowsPerPage = parseInt(rowsPerPage);
|
rowsPerPage = parseInt(rowsPerPage);
|
||||||
const matchStage = {
|
const matchStage = {
|
||||||
@@ -274,7 +274,7 @@ const updateAllChecksStatus = async (id, status, target) => {
|
|||||||
try {
|
try {
|
||||||
const updatedChecks = await Check.updateMany(
|
const updatedChecks = await Check.updateMany(
|
||||||
target === "monitor" ? { monitorId: id } : { teamId: id },
|
target === "monitor" ? { monitorId: id } : { teamId: id },
|
||||||
{ $set: { status: true } }
|
{ $set: { status } }
|
||||||
);
|
);
|
||||||
return updatedChecks.modifiedCount;
|
return updatedChecks.modifiedCount;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -295,7 +295,6 @@ const updateCheckStatusBodyValidation = joi.object({
|
|||||||
|
|
||||||
const updateCheckStatusParamValidation = joi.object({
|
const updateCheckStatusParamValidation = joi.object({
|
||||||
monitorId: joi.string(),
|
monitorId: joi.string(),
|
||||||
teamId: joi.string(),
|
|
||||||
target: joi.string().allow("monitor", "team"),
|
target: joi.string().allow("monitor", "team"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user