From d25bf27f1ff10e4f41042061254e3c0b4b7ac3c9 Mon Sep 17 00:00:00 2001 From: Juho Haapakoski Date: Wed, 16 Oct 2024 13:28:48 +0300 Subject: [PATCH] AE-2247: Fix retrieval of viestiketjut --- .../clj/solita/etp/service/energiatodistus_destruction.clj | 4 ++-- .../main/sql/solita/etp/db/energiatodistus-destruction.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etp-core/etp-backend/src/main/clj/solita/etp/service/energiatodistus_destruction.clj b/etp-core/etp-backend/src/main/clj/solita/etp/service/energiatodistus_destruction.clj index ba8d277b7..b1e6fdaac 100644 --- a/etp-core/etp-backend/src/main/clj/solita/etp/service/energiatodistus_destruction.clj +++ b/etp-core/etp-backend/src/main/clj/solita/etp/service/energiatodistus_destruction.clj @@ -100,8 +100,8 @@ (mapv (partial check-oikeellisuuden-valvonta-viestiketjut db) vo-toimenpide-ids))) (defn- destroy-energiatodistus-viestiketjut [db aws-s3-client energiatodistus-id] - (let [viestiketjut-ids (map :id (energiatodistus-destruction-db/select-vo-toimenpiteet-by-energiatodistus-id db {:energiatodistus_id energiatodistus-id}))] - (mapv #(destroy-viestiketju db aws-s3-client %) viestiketjut-ids) + (let [viestiketjut-ids (map :viestiketju-id (energiatodistus-destruction-db/select-viestiketjut-by-energiatodistus-id db {:energiatodistus_id energiatodistus-id}))] + (mapv #(destroy-viestiketju db aws-s3-client %) viestiketjut-ids) (check-oikeellisuuden-valvontojen-viestiketjut db energiatodistus-id))) (defn- destroy-expired-energiatodistus! [db aws-s3-client energiatodistus-id] diff --git a/etp-core/etp-backend/src/main/sql/solita/etp/db/energiatodistus-destruction.sql b/etp-core/etp-backend/src/main/sql/solita/etp/db/energiatodistus-destruction.sql index 518586a55..78757d184 100644 --- a/etp-core/etp-backend/src/main/sql/solita/etp/db/energiatodistus-destruction.sql +++ b/etp-core/etp-backend/src/main/sql/solita/etp/db/energiatodistus-destruction.sql @@ -89,7 +89,7 @@ delete from viesti where id = :viesti_id; --- name: select-viestiketjut-by-energiatodistus +-- name: select-viestiketjut-by-energiatodistus-id select id as viestiketju_id from viestiketju where energiatodistus_id = :energiatodistus_id;