-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
234 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 19 additions & 9 deletions
28
packages/backend/src/controllers/bo-user/service-competence.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
const logger = require("../../utils/logger"); | ||
const { competence } = require("../../helpers/bo-competence") | ||
const { competence } = require("../../helpers/bo-competence"); | ||
|
||
const log = logger(module.filename); | ||
|
||
module.exports = async function serviceCompetence(territoireCode) { | ||
try { | ||
log.i("IN"),territoireCode; | ||
log.i("IN"), territoireCode; | ||
log.i("DONE"); | ||
return (territoireCode === "FRA") ? 'NAT' : (/^[0-9]+$/.test(territoireCode)) ? 'DEP' : 'REG'; | ||
return territoireCode === "FRA" | ||
? "NAT" | ||
: /^[0-9]+$/.test(territoireCode) | ||
? "DEP" | ||
: "REG"; | ||
} catch (error) { | ||
log.w("DONE with error"); | ||
return error; | ||
} | ||
}; | ||
|
||
module.exports = async function verifyCompetence(serviceCompetentUserConnected,serviceCompetentUtilisateurCreateOrUpdate) { | ||
return (serviceCompetentUserConnected === competence.NATIONALE || (serviceCompetentUtilisateurCreateOrUpdate != competence.NATIONALE && serviceCompetentUserConnected === competence.REGIONALE) || (serviceCompetentUtilisateurCreateOrUpdate === competence.DEPARTEMENTALE && serviceCompetentUserConnected === competence.DEPARTEMENTALE)) | ||
}; | ||
|
||
|
||
|
||
module.exports = async function verifyCompetence( | ||
serviceCompetentUserConnected, | ||
serviceCompetentUtilisateurCreateOrUpdate, | ||
) { | ||
return ( | ||
serviceCompetentUserConnected === competence.NATIONALE || | ||
(serviceCompetentUtilisateurCreateOrUpdate != competence.NATIONALE && | ||
serviceCompetentUserConnected === competence.REGIONALE) || | ||
(serviceCompetentUtilisateurCreateOrUpdate === competence.DEPARTEMENTALE && | ||
serviceCompetentUserConnected === competence.DEPARTEMENTALE) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,4 +59,4 @@ module.exports = async function post(req, res, next) { | |
}), | ||
); | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.