-
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
134 changed files
with
5,314 additions
and
1,007 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
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
38 changes: 0 additions & 38 deletions
38
packages/backend/src/controllers/demandeSejour/getHebergement.js
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const logger = require("../../utils/logger"); | ||
const eigService = require("../../services/eig"); | ||
const Organisme = require("../../services/Organisme"); | ||
|
||
const log = logger(module.filename); | ||
|
||
module.exports = async function getAvailableDs(req, res, next) { | ||
log.i("IN"); | ||
const { decoded } = req; | ||
const { id: userId } = decoded; | ||
log.d("userId", { userId }); | ||
|
||
let organismesId; | ||
|
||
try { | ||
const organisme = await Organisme.getOne({ | ||
use_id: userId, | ||
}); | ||
if (organisme.personneMorale?.porteurAgrement) { | ||
const organismes = await Organisme.getBySiren( | ||
organisme.personneMorale.siren, | ||
); | ||
organismesId = organismes.map((o) => o.organismeId); | ||
} else { | ||
organismesId = [organisme.organismeId]; | ||
} | ||
} catch (error) { | ||
log.w("DONE with error"); | ||
return next(error); | ||
} | ||
|
||
const { search } = req.query; | ||
|
||
if (!search || search === "") { | ||
return res.status(200).json([]); | ||
} | ||
|
||
try { | ||
const ds = await eigService.getAvailableDs(organismesId, search); | ||
return res.status(200).json(ds); | ||
} catch (error) { | ||
log.w("DONE with error"); | ||
return next(error); | ||
} finally { | ||
log.i("OUT"); | ||
} | ||
}; |
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.