This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AE-1860: Add hallinto-oikeus specific attachment in the end of käskyp…
…äätös / varsinainen päätös document
- Loading branch information
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
etp-backend/src/main/clj/solita/etp/service/valvonta_kaytto/hallinto_oikeus_attachment.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(ns solita.etp.service.valvonta-kaytto.hallinto-oikeus-attachment | ||
(:require [solita.etp.db :as db] | ||
[clojure.java.io :as io])) | ||
|
||
(db/require-queries 'hallinto-oikeus) | ||
|
||
(def attachment-directory-path "pdf/hallinto-oikeudet/") | ||
|
||
(defn attachment-for-hallinto-oikeus-id [db hallinto-oikeus-id] | ||
(if-let [attachment-name (->> {:hallinto-oikeus-id hallinto-oikeus-id} | ||
(hallinto-oikeus-db/find-attachment-name-by-hallinto-oikeus-id db) | ||
first | ||
:attachment-name)] | ||
(io/input-stream (io/resource (str attachment-directory-path attachment-name))) | ||
(throw (Exception. (str "Attachment not found for hallinto-oikeus-id: " hallinto-oikeus-id))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- name: find-attachment-name-by-hallinto-oikeus-id | ||
select attachment_name | ||
from hallinto_oikeus | ||
where id = :hallinto-oikeus-id; |