Skip to content

Commit d501466

Browse files
authored
chore: rappatriement preprod -> main fix in V1.17 (#779)
MEP V1.17 Rappatriement des fix effectués sur PreProd.
2 parents b7c3f27 + 5d8d321 commit d501466

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/backend/src/services/Organisme.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ const query = {
128128
THEN
129129
(
130130
SELECT
131-
json_build_object(
131+
JSON_AGG(json_build_object(
132132
'numero', numero,
133133
'regionObtention', region_obtention,
134134
'dateObtention', date_obtention,
135135
'file', file,
136136
'createdAt', a.created_at
137-
) as "agrement"
137+
)) as "agrement"
138138
FROM front.agrements a
139139
JOIN front.organismes o2 ON o2.id = a.organisme_id
140140
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
@@ -172,13 +172,13 @@ const query = {
172172
THEN
173173
(
174174
SELECT
175-
json_build_object(
175+
JSON_AGG(json_build_object(
176176
'numero', numero,
177177
'regionObtention', region_obtention,
178178
'dateObtention', date_obtention,
179179
'file', file,
180180
'createdAt', a.created_at
181-
) as "agrement"
181+
)) as "agrement"
182182
FROM front.agrements a
183183
JOIN front.organismes o2 ON o2.id = a.organisme_id
184184
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
@@ -236,11 +236,11 @@ const query = {
236236
SELECT o.id AS "organismeId",
237237
CASE
238238
WHEN o.type_organisme = 'personne_morale' AND (pm.porteur_agrement)::BOOLEAN IS FALSE THEN (
239-
SELECT JSON_BUILD_OBJECT(
239+
SELECT JSON_AGG(JSON_BUILD_OBJECT(
240240
'numero', numero,
241241
'regionObtention', region_obtention,
242242
'dateObtention', date_obtention
243-
)
243+
))
244244
FROM front.agrements a
245245
JOIN front.organismes o2 ON o2.id = a.organisme_id
246246
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
@@ -315,8 +315,8 @@ const query = {
315315
SELECT o.id AS "organismeId",
316316
CASE
317317
WHEN o.type_organisme = 'personne_morale' AND (pm.porteur_agrement)::BOOLEAN IS FALSE THEN (
318-
SELECT JSON_BUILD_OBJECT('numero', numero, 'regionObtention', region_obtention, 'dateObtention', date_obtention,
319-
'file', file, 'yearObtention', EXTRACT(YEAR FROM a.date_obtention)) AS "agrement"
318+
SELECT JSON_AGG(JSON_BUILD_OBJECT('numero', numero, 'regionObtention', region_obtention, 'dateObtention', date_obtention,
319+
'file', file, 'yearObtention', EXTRACT(YEAR FROM a.date_obtention))) AS "agrement"
320320
FROM front.agrements a
321321
JOIN front.organismes o2 ON o2.id = a.organisme_id
322322
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
@@ -391,13 +391,13 @@ FROM back.organisme_non_agree ona
391391
THEN
392392
(
393393
SELECT
394-
json_build_object(
394+
JSON_AGG(json_build_object(
395395
'numero', numero,
396396
'regionObtention', region_obtention,
397397
'dateObtention', date_obtention,
398398
'file', file,
399399
'createdAt', a.created_at
400-
) as "agrement"
400+
)) as "agrement"
401401
FROM front.agrements a
402402
JOIN front.organismes o2 ON o2.id = a.organisme_id
403403
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id

0 commit comments

Comments
 (0)