Refactor getChecksByUserId to getChecksByTeamId
This commit is contained in:
1 parent
c8c2dfe9ec
commit
eedc6bbed6
8 files changed
+27
-31
No files matched your search
@@ -3,8 +3,8 @@ const {
|
||||
createCheckBodyValidation,
|
||||
getChecksParamValidation,
|
||||
getChecksQueryValidation,
|
||||
getUserChecksParamValidation,
|
||||
getUserChecksQueryValidation,
|
||||
getTeamChecksParamValidation,
|
||||
getTeamChecksQueryValidation,
|
||||
deleteChecksParamValidation,
|
||||
} = require("../validation/joi");
|
||||
const { successMessages } = require("../utils/messages");
|
||||
@@ -62,10 +62,10 @@ const getChecks = async (req, res, next) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getUserChecks = async (req, res, next) => {
|
||||
const getTeamChecks = async (req, res, next) => {
|
||||
try {
|
||||
await getUserChecksParamValidation.validateAsync(req.params);
|
||||
await getUserChecksQueryValidation.validateAsync(req.query);
|
||||
await getTeamChecksParamValidation.validateAsync(req.params);
|
||||
await getTeamChecksQueryValidation.validateAsync(req.query);
|
||||
} catch (error) {
|
||||
error.status = 422;
|
||||
error.service = SERVICE_NAME;
|
||||
@@ -75,7 +75,7 @@ const getUserChecks = async (req, res, next) => {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const checkData = await req.db.getUserChecks(req);
|
||||
const checkData = await req.db.getTeamChecks(req);
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
msg: successMessages.CHECK_GET,
|
||||
@@ -115,6 +115,6 @@ const deleteChecks = async (req, res, next) => {
|
||||
module.exports = {
|
||||
createCheck,
|
||||
getChecks,
|
||||
getUserChecks,
|
||||
getTeamChecks,
|
||||
deleteChecks,
|
||||
};
|
||||
Reference in new issue
Block a user