mirror of
https://bitbucket.org/tagfer_team/tagfer-server.git
synced 2025-12-25 03:37:38 +00:00
T-954157790482088: add isProfileNumberValid utility function
This commit is contained in:
parent
5a5bda6bb3
commit
50b6f9b0fa
@ -21,4 +21,5 @@ module.exports = {
|
||||
MISSING_BODY_ATTRIBUTES: 'request/missing-body-attributes',
|
||||
//Profile Errors
|
||||
MAX_NUMBER_OF_PROFILES_REACHED: 'profile/max-number-of-profiles-are-being-used',
|
||||
NO_PROFILE_FOUND_FOR_NUMBER: 'profile/no-profile-found-for-number'
|
||||
};
|
||||
@ -43,8 +43,18 @@ function isBodyValid(isValid, response) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function isProfileNumberValid(profileNumber, response) {
|
||||
if (profileNumber > 4 || profileNumber < 1) {
|
||||
response.status(http.BAD_REQUEST).json({error: errors.NO_PROFILE_FOUND_FOR_NUMBER});
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isAppSecretValid,
|
||||
isBodyValid,
|
||||
getSessionIdFromAuthHeader
|
||||
getSessionIdFromAuthHeader,
|
||||
isProfileNumberValid
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user