Skip to content

Commit

Permalink
release 1.12.0 (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminDNUM authored Nov 8, 2024
2 parents 8c88c63 + 7a79849 commit 81ff981
Show file tree
Hide file tree
Showing 118 changed files with 3,798 additions and 1,540 deletions.
1 change: 1 addition & 0 deletions .env.dev.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ BACKEND_URL="http://localhost:3010"
BACKEND_CRON_REQUEST_DS8J15J_NOTIFY_CRON="0 22 * * *"
BACKEND_CRON_REQUEST_DS8J15J_DEADLINE_REMIND="15"
BACKEND_CRON_UPDATE_STATUT_DS_CRON="* * * * *"
BACKEND_CRON_REQUEST_ACTIONS_BO_CRON="0 9,12 * * 1-5"

# Tokens
TOKEN_SECRET="-----BEGIN EC PRIVATE KEY-----\nMIHcAgEBBEIAobMQpD5H2nAL7LrYLsxTxmE70HB6F3sWeAeq3DXdLQ/5zGFcV36e\nI9VdYyed8fzYq6t+RP42M7fDUzLAKpn46cKgBwYFK4EEACOhgYkDgYYABAFcZNGM\nL+ba9RXURG9yEUKzZsVt19jN+1xbjL1EIRC6IsvZeK58yd/Y924WtpklMSqMI6Fx\nSmGOpELXEe9BICNJHAG1x3KH0SUWN+gKC1mRbriSFd9HhrtRY7AgUdD6TR7H7un0\nxrJnFvr9iC1K+E6linASudSivbUhP8QzHt2k5JsTsQ==\n-----END EC PRIVATE KEY-----"
Expand Down
1 change: 1 addition & 0 deletions .kontinuous/env/dev/templates/backend.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ data:
BACKEND_CRON_REQUEST_DS8J15J_NOTIFY_CRON: "*/15 * * * *"
BACKEND_CRON_REQUEST_DS8J15J_DEADLINE_REMIND: "90"
BACKEND_CRON_UPDATE_STATUT_DS_CRON: "*/15 * * * *"
BACKEND_CRON_REQUEST_ACTIONS_BO_CRON: "0 9,12 * * 1-5"
3 changes: 2 additions & 1 deletion .kontinuous/env/preprod/templates/backend.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ data:
TMP_DIRECTORY: "/tmp"
BACKEND_CRON_REQUEST_DS8J15J_NOTIFY_CRON: "*/15 * * * *"
BACKEND_CRON_REQUEST_DS8J15J_DEADLINE_REMIND: "90"
BACKEND_CRON_UPDATE_STATUT_DS_CRON: "*/15 * * * *"
BACKEND_CRON_UPDATE_STATUT_DS_CRON: "*/15 * * * *"
BACKEND_CRON_REQUEST_ACTIONS_BO_CRON: "0 9,12 * * 1-5"
3 changes: 2 additions & 1 deletion .kontinuous/env/prod/templates/backend.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ data:
TMP_DIRECTORY: "/tmp"
BACKEND_CRON_REQUEST_DS8J15J_NOTIFY_CRON: "0 22 * * *"
BACKEND_CRON_REQUEST_DS8J15J_DEADLINE_REMIND: "15"
BACKEND_CRON_UPDATE_STATUT_DS_CRON: "0 02 * * *"
BACKEND_CRON_UPDATE_STATUT_DS_CRON: "0 02 * * *"
BACKEND_CRON_REQUEST_ACTIONS_BO_CRON: "0 8 * * 1"
16 changes: 13 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fileignoreconfig:
- filename: packages/backend/src/services/Document.js
checksum: 59b5abe13b265c61dc6df8bbb92a3f989199dafaef0170d361f49e760d2ac385
- filename: packages/backend/src/services/User.js
checksum: 6f3bcdcbe1d0e813fb032939778cd11cf0acf3ba7f2e25ca4707f114f31cfae0
checksum: 78ddae12d185c4111aa837a178b75e6bda4083d06783ee6382503262298eefbc
- filename: packages/backend/src/services/geo/Commune.js
checksum: 40213f6529d1282e73f0201199e28b66f9c99c76d16651d88aac0b59fb722ae2
- filename: packages/backend/src/services/geo/Departement.js
Expand Down Expand Up @@ -210,7 +210,7 @@ fileignoreconfig:
- filename: packages/frontend-usagers/src/components/organisme/personne-morale-read-only.vue
checksum: 2b3e374044b3d7142a81fd3a6720e197e7839c281d74b594755d0df9035c3576
- filename: packages/frontend-usagers/src/components/organisme/personne-morale.vue
checksum: 09bb8f48bab74bdf812ba50fe7723a22c8c1facbba76a4f6b02ca3ad36f3920b
checksum: 9b94b8a97eb6a2e9cea8c696ab32371c259112298147ae81f3c461463d04afa0
- filename: packages/frontend-usagers/src/components/organisme/synthese.vue
checksum: c9d27cea7175d829b78e524c08dd744b097f08a2fae2dffddab01f6703f3055c
- filename: packages/frontend-usagers/src/components/personnes-read-only.vue
Expand All @@ -220,7 +220,7 @@ fileignoreconfig:
- filename: packages/frontend-usagers/src/components/utils/TableFull.vue
checksum: 05743cc5c3dfd946e8ee41cb11571b1e505bbdb5260e9c59a53e4ca16cb11f08
- filename: packages/frontend-usagers/src/pages/connexion/enregistrement.vue
checksum: ff1ceabb68d5c3bd637717235e78cbe7b82e626a5f1c8bbf233c58d5acaa2bc9
checksum: dd393d7c31566dfa3864bb9a63fe98f9bf040cc8321e8cad0f74e8634e8365f8
- filename: packages/frontend-usagers/src/pages/connexion/index.vue
checksum: e8dab7814ed9effec5c8630f2e1cd061416d254a131ebc88dbae61f99327436e
- filename: packages/frontend-usagers/src/pages/connexion/mot-de-passe-oublie.vue
Expand Down Expand Up @@ -251,8 +251,18 @@ fileignoreconfig:
checksum: e22a659aca296659bcd27ea22fd6919938327d3a4ad17eaab229e55724d94dce
- filename: packages/shared/src/components/Chat.vue
checksum: f2dbbf72bf098c7abd2c3aee230d220f5a5a106952883c0e116eb49f4f9d4db7
- filename: packages/shared/src/components/DsfrMultiSelect.vue
checksum: 90a7d72295ca0fb55d312f9608cbbe5475183936d21286952357b3961d1bd6fb
- filename: packages/shared/src/components/DsfrTabsV2.vue
checksum: 960c18a7ad76a91c74e5535240ae6ac4f87bb8aff10155096cd35afe5609cff8
- filename: packages/shared/src/components/PasswordInput.vue
checksum: af4fe62dc455e943fcfacaa6ee0495e1ab20f9ed2094ad70c457b7a27ab46759
- filename: packages/shared/src/components/Table/DsfrDataTableV2.vue
checksum: 31aa309ec71678dff0c509d1d2ba35340b1da2caae40b3b2f5148aad83d3a410
- filename: packages/shared/src/type.ts
checksum: 8c75e8784ded25a61d6e14cd682bfe67e4ecdde5a6582fb83035fcae39a87b98
- filename: packages/shared/src/types/DsfrDataTableV2.type.ts
checksum: 1a97906b8d2d4c66febb1aceb3344696ef780480ab0711a93dd49780b66c20ab
- filename: pg/scripts/01-init.sql
checksum: 20dd5b8d36b1b0517fe185d30003af7866ef5678eed4e7571a6d9797ec3b2a46
- filename: pg/scripts/02/02-1-geo-init.sql
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ module.exports = {
process.env.BACKEND_CRON_REQUEST_DS8J15J_DEADLINE_REMIND,
name: "REQUEST_DS8J15J",
},
notifyactionsbo: {
cron: process.env.BACKEND_CRON_REQUEST_ACTIONS_BO_CRON,
name: "REQUEST_ACTIONS_BO",
},
update: {
cron: process.env.BACKEND_CRON_UPDATE_STATUT_DS_CRON,
name: "UPDATE_STATUT_DS",
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/controllers/bo-user/getExtract.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ module.exports = async function getExtract(req, res, next) {
{ key: "nom", label: "Nom" },
{ key: "prenom", label: "Prenom" },
{ key: "email", label: "Courriel" },
{ key: "territoire", label: "Territoire" },
{ key: "competence", label: "Compétence" },
{ key: "region", label: "Région" },
{ key: "departement", label: "Département" },
{ key: "validated", label: "Compte validé" },
{ key: "deleted", label: "Compte actif" },
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const DemandeSejour = require("../../services/DemandeSejour");
const logger = require("../../utils/logger");
const dayjs = require("dayjs");

const log = logger(module.filename);

const escapeCsvField = (field) => {
if (typeof field !== "string") {
return `${field}`;
}

if (field.includes('"') || field.includes(";") || field.includes("\n")) {
const fieldEscaped = field.replace(/"/g, '""');
return `"${fieldEscaped}"`;
}
return field;
};

module.exports = async function get(req, res, next) {
log.i("IN");
res.setHeader("Content-Type", "text/csv");
res.setHeader("Content-Disposition", 'attachment; filename="data.csv"');
const departements = req.departements.map((d) => d.value);
try {
const result = await DemandeSejour.getHebergementsByDepartementCodes(
departements,
{
limit: 20,
offset: 0,
order: "ASC",
search: "",
sort: "nom",
},
);
const titles = [
{ key: "nom", label: "Nom de l’hébergement" },
{ key: "dateDebut", label: "Date de début de séjour" },
{ key: "dateFin", label: "Date de fin de séjour" },
{ key: "departement", label: "Département" },
{ key: "adresse", label: "Adresse" },
{ key: "telephone", label: "Téléphone" },
{ key: "email", label: "Adresse courriel" },
{ key: "dateVisite", label: "Date de visite préalable" },
{ key: "reglementationErp", label: "Réglementation ERP" },
];
const csv = [
titles.map(({ label }) => label).join(";"),
...result.data.hebergements.map((item) => {
const newItem = { ...item };
newItem.reglementationErp = newItem.reglementationErp ? "Oui" : "Non";
newItem.dateDebut = dayjs(newItem.dateDebut).format("DD/MM/YYYY");
newItem.dateFin = dayjs(newItem.dateFin).format("DD/MM/YYYY");
newItem.adresse = newItem.adresse.label;
newItem.dateVisite = newItem.dateVisite
? dayjs(newItem.dateVisite).format("DD/MM/YYYY")
: "";
return [
...titles.map(({ key }) => escapeCsvField(newItem[key] ?? "")),
].join(";");
}),
].join("\n");

return res.status(200).send(csv);
} catch (error) {
log.w("DONE with error");
return next(error);
}
};
1 change: 1 addition & 0 deletions packages/backend/src/controllers/demandeSejour/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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");
Expand Down
61 changes: 61 additions & 0 deletions packages/backend/src/controllers/fo-user/getExtract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const FoUser = require("../../services/FoUser");
const logger = require("../../utils/logger");
const dayjs = require("dayjs");

const log = logger(module.filename);

const escapeCsvField = (field) => {
if (typeof field !== "string") {
return `${field}`;
}

if (field.includes('"') || field.includes(";") || field.includes("\n")) {
const fieldEscaped = field.replace(/"/g, '""');
return `"${fieldEscaped}"`;
}
return field;
};

module.exports = async function getExtract(req, res, next) {
log.i("getExtract IN", req);

res.setHeader("Content-Type", "text/csv");
res.setHeader("Content-Disposition", 'attachment; filename="data.csv"');

try {
const result = await FoUser.read({
search: { organisme_id: req.params.organismeId },
});
const titles = [
{ key: "nom", label: "Nom" },
{ key: "prenom", label: "Prenom" },
{ key: "email", label: "Courriel" },
{ key: "raisonSociale", label: "Raison sociale" },
{ key: "statut", label: "Statut" },
{ key: "dateCreation", label: "Date de création" },
{ key: "lastConnectionAt", label: "Date dernière connexion" },
{ key: "nombreDeclarations", label: "Nombre de déclaration" },
];

const csv = [
titles.map(({ label }) => label).join(";"),
...result.users.map((item) => {
const newItem = { ...item };
newItem.statut =
newItem.statut === "VALIDATED" ? "Validé" : "Non validé";
newItem.dateCreation = dayjs(newItem.dateCreation).format("DD/MM/YYYY");
newItem.lastConnectionAt = newItem.lastConnectionAt
? dayjs(newItem.lastConnectionAt).format("DD/MM/YYYY")
: "";
return [
...titles.map(({ key }) => escapeCsvField(newItem[key] ?? "")),
].join(";");
}),
].join("\n");

return res.status(200).send(csv);
} catch (error) {
log.w("DONE with error");
return next(error);
}
};
1 change: 1 addition & 0 deletions packages/backend/src/controllers/fo-user/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
module.exports.list = require("./list");
module.exports.getExtract = require("./getExtract");
4 changes: 0 additions & 4 deletions packages/backend/src/controllers/fo-user/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ const log = logger(module.filename);

module.exports = async function list(req, res, next) {
log.i("IN");
const { decoded } = req;
const { id: adminId } = decoded ?? {};
log.d("userId", { adminId });

let params;
try {
const search = req.query.search ? JSON.parse(req.query.search) : {};
Expand Down
62 changes: 62 additions & 0 deletions packages/backend/src/controllers/hebergement/getExtract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const Hebergement = require("../../services/Hebergement");
const logger = require("../../utils/logger");
const dayjs = require("dayjs");

const log = logger(module.filename);

const escapeCsvField = (field) => {
if (typeof field !== "string") {
return `${field}`;
}

if (field.includes('"') || field.includes(";") || field.includes("\n")) {
const fieldEscaped = field.replace(/"/g, '""');
return `"${fieldEscaped}"`;
}
return field;
};

module.exports = async function getExtract(req, res, next) {
log.i("IN");
res.setHeader("Content-Type", "text/csv");
res.setHeader("Content-Disposition", 'attachment; filename="data.csv"');
const departements = req.departements.map((d) => d.value);
try {
const result = await Hebergement.getByDepartementCodes(departements, {
limit: 20,
offset: 0,
order: "ASC",
search: "",
sort: "nom",
});
const titles = [
{ key: "nom", label: "Nom de l’hébergement" },
{ key: "departement", label: "Département" },
{ key: "adresse", label: "Adresse" },
{ key: "telephone", label: "Téléphone" },
{ key: "email", label: "Adresse courriel" },
{ key: "dateVisite", label: "Date de visite préalable" },
{ key: "reglementationErp", label: "Réglementation ERP" },
];

const csv = [
titles.map(({ label }) => label).join(";"),
...result.data.hebergements.map((item) => {
const newItem = { ...item };
newItem.reglementationErp = newItem.reglementationErp ? "oui" : "non";
newItem.adresse = newItem.adresse.label;
newItem.dateVisite = newItem.dateVisite
? dayjs(newItem.dateVisite).format("DD/MM/YYYY")
: "";
return [
...titles.map(({ key }) => escapeCsvField(newItem[key] ?? "")),
].join(";");
}),
].join("\n");

return res.status(200).send(csv);
} catch (error) {
log.w("DONE with error");
return next(error);
}
};
1 change: 1 addition & 0 deletions packages/backend/src/controllers/hebergement/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports.get = require("./get");
module.exports.getByDepartements = require("./getByDepartements");
module.exports.getById = require("./getById");
module.exports.getExtract = require("./getExtract");
module.exports.post = require("./post");
module.exports.update = require("./update");
Loading

0 comments on commit 81ff981

Please sign in to comment.