Skip to content

Commit

Permalink
fix(hebergement): refacto getters
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminDNUM committed Nov 20, 2024
1 parent 078537f commit 7c1d9ed
Show file tree
Hide file tree
Showing 21 changed files with 506 additions and 230 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/controllers/demandeSejour/depose.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const dayjs = require("dayjs");
const yup = require("yup");

const DemandeSejour = require("../../services/DemandeSejour");
const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");
const Send = require("../../services/mail").mailService.send;
const PdfDeclaration2Mois = require("../../services/pdf/declaration2mois/generate");
const PdfDeclaration8jours = require("../../services/pdf/declaration8jours/generate");
Expand Down
38 changes: 0 additions & 38 deletions packages/backend/src/controllers/demandeSejour/getHebergement.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = async function get(req, res) {
sort: titleSorted ?? "nom",
},
);

return res.status(200).json({
count: data.total_count,
hebergements: data.hebergements || [],
Expand Down
1 change: 0 additions & 1 deletion packages/backend/src/controllers/demandeSejour/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports.get = require("./get");
module.exports.getAdminStats = require("./getAdminStats");
module.exports.getExtract = require("./getExtract");
module.exports.getExtractHebergement = require("./getExtractHebergement");
module.exports.getHebergement = require("./getHebergement");
module.exports.getHebergementsByDepartementCodes = require("./getHebergementsByDepartementCodes");
module.exports.getById = require("./getById");
module.exports.getByIdBo = require("./getByIdBo");
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/controllers/hebergement/get.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");

const logger = require("../../utils/logger");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");

const logger = require("../../utils/logger");
const Sentry = require("@sentry/node");
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/controllers/hebergement/getById.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");
const AppError = require("../../utils/error");

const logger = require("../../utils/logger");
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/controllers/hebergement/getExtract.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");
const logger = require("../../utils/logger");
const dayjs = require("dayjs");

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/controllers/hebergement/post.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const yup = require("yup");
const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");
const HebergementSchema = require("../../schemas/hebergement");
const logger = require("../../utils/logger");
const ValidationAppError = require("../../utils/validation-error");
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/controllers/hebergement/update.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const yup = require("yup");

const Hebergement = require("../../services/Hebergement");
const Hebergement = require("../../services/hebergement/Hebergement");
const logger = require("../../utils/logger");
const ValidationAppError = require("../../utils/validation-error");
const HebergementSchema = require("../../schemas/hebergement");
Expand Down
7 changes: 0 additions & 7 deletions packages/backend/src/routes/sejour.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ router.get(
getDepartements,
demandeSejourController.getHebergementsByDepartementCodes,
);
router.get(
"/admin/hebergement/:sejourId/:hebergementId",
boCheckJWT,
boCheckRoleDS,
getDepartements,
demandeSejourController.getHebergement,
);
router.get(
"/admin/historique/:declarationId",
boCheckJWT,
Expand Down
Loading

0 comments on commit 7c1d9ed

Please sign in to comment.