Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/backend/src/services/Organisme.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ const query = {
THEN
(
SELECT
json_build_object(
JSON_AGG(json_build_object(
'numero', numero,
'regionObtention', region_obtention,
'dateObtention', date_obtention,
'dateFinValidite', date_fin_validite,
'file', file,
'createdAt', a.created_at
) as "agrement"
)) as "agrement"
FROM front.agrements a
JOIN front.organismes o2 ON o2.id = a.organisme_id
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
Expand Down Expand Up @@ -128,13 +128,13 @@ const query = {
THEN
(
SELECT
json_build_object(
JSON_AGG(json_build_object(
'numero', numero,
'regionObtention', region_obtention,
'dateObtention', date_obtention,
'file', file,
'createdAt', a.created_at
) as "agrement"
)) as "agrement"
FROM front.agrements a
JOIN front.organismes o2 ON o2.id = a.organisme_id
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
Expand Down Expand Up @@ -172,13 +172,13 @@ const query = {
THEN
(
SELECT
json_build_object(
JSON_AGG(json_build_object(
'numero', numero,
'regionObtention', region_obtention,
'dateObtention', date_obtention,
'file', file,
'createdAt', a.created_at
) as "agrement"
)) as "agrement"
FROM front.agrements a
JOIN front.organismes o2 ON o2.id = a.organisme_id
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
Expand Down Expand Up @@ -236,11 +236,11 @@ const query = {
SELECT o.id AS "organismeId",
CASE
WHEN o.type_organisme = 'personne_morale' AND (pm.porteur_agrement)::BOOLEAN IS FALSE THEN (
SELECT JSON_BUILD_OBJECT(
SELECT JSON_AGG(JSON_BUILD_OBJECT(
'numero', numero,
'regionObtention', region_obtention,
'dateObtention', date_obtention
)
))
FROM front.agrements a
JOIN front.organismes o2 ON o2.id = a.organisme_id
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
Expand Down Expand Up @@ -315,8 +315,8 @@ const query = {
SELECT o.id AS "organismeId",
CASE
WHEN o.type_organisme = 'personne_morale' AND (pm.porteur_agrement)::BOOLEAN IS FALSE THEN (
SELECT JSON_BUILD_OBJECT('numero', numero, 'regionObtention', region_obtention, 'dateObtention', date_obtention,
'file', file, 'yearObtention', EXTRACT(YEAR FROM a.date_obtention)) AS "agrement"
SELECT JSON_AGG(JSON_BUILD_OBJECT('numero', numero, 'regionObtention', region_obtention, 'dateObtention', date_obtention,
'file', file, 'yearObtention', EXTRACT(YEAR FROM a.date_obtention))) AS "agrement"
FROM front.agrements a
JOIN front.organismes o2 ON o2.id = a.organisme_id
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
Expand Down Expand Up @@ -391,13 +391,13 @@ FROM back.organisme_non_agree ona
THEN
(
SELECT
json_build_object(
JSON_AGG(json_build_object(
'numero', numero,
'regionObtention', region_obtention,
'dateObtention', date_obtention,
'file', file,
'createdAt', a.created_at
) as "agrement"
)) as "agrement"
FROM front.agrements a
JOIN front.organismes o2 ON o2.id = a.organisme_id
INNER JOIN front.personne_morale pm2 ON pm2.organisme_id = o2.id
Expand Down
Loading