Add controller method and validation for deleting check by team
This commit is contained in:
1 parent
22770cc343
commit
fd3985190b
2 files changed
+24
No files matched your search
@@ -6,6 +6,7 @@ const {
|
|||||||
getTeamChecksParamValidation,
|
getTeamChecksParamValidation,
|
||||||
getTeamChecksQueryValidation,
|
getTeamChecksQueryValidation,
|
||||||
deleteChecksParamValidation,
|
deleteChecksParamValidation,
|
||||||
|
deleteChecksByTeamParamValidation,
|
||||||
} = require("../validation/joi");
|
} = require("../validation/joi");
|
||||||
const { successMessages } = require("../utils/messages");
|
const { successMessages } = require("../utils/messages");
|
||||||
const SERVICE_NAME = "check";
|
const SERVICE_NAME = "check";
|
||||||
@@ -112,9 +113,27 @@ const deleteChecks = async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const deleteChecksByTeam = async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const res = await deleteChecksByTeamParamValidation.validateAsync(
|
||||||
|
req.params
|
||||||
|
);
|
||||||
|
return res.status(200).json({
|
||||||
|
success: true,
|
||||||
|
msg: successMessages.CHECK_DELETE,
|
||||||
|
data: { deletedCount: res },
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "deleteChecksByTeam";
|
||||||
|
error.status = 422;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createCheck,
|
createCheck,
|
||||||
getChecks,
|
getChecks,
|
||||||
getTeamChecks,
|
getTeamChecks,
|
||||||
deleteChecks,
|
deleteChecks,
|
||||||
|
deleteChecksByTeam,
|
||||||
};
|
};
|
||||||
@@ -292,6 +292,10 @@ const deleteChecksParamValidation = joi.object({
|
|||||||
monitorId: joi.string().required(),
|
monitorId: joi.string().required(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const deleteChecksByTeamParamValidation = joi.object({
|
||||||
|
teamId: joi.string().required(),
|
||||||
|
});
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// PageSpeedCheckValidation
|
// PageSpeedCheckValidation
|
||||||
//****************************************
|
//****************************************
|
||||||
@@ -372,6 +376,7 @@ module.exports = {
|
|||||||
getTeamChecksParamValidation,
|
getTeamChecksParamValidation,
|
||||||
getTeamChecksQueryValidation,
|
getTeamChecksQueryValidation,
|
||||||
deleteChecksParamValidation,
|
deleteChecksParamValidation,
|
||||||
|
deleteChecksByTeamParamValidation,
|
||||||
deleteUserParamValidation,
|
deleteUserParamValidation,
|
||||||
getPageSpeedCheckParamValidation,
|
getPageSpeedCheckParamValidation,
|
||||||
createPageSpeedCheckParamValidation,
|
createPageSpeedCheckParamValidation,
|
||||||
|
|||||||
Reference in new issue
Block a user