Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
AE-1977: Add endpoint for fetching hao-liite in toimenpide for person
Browse files Browse the repository at this point in the history
- Currently just returns 200, no document yet
  • Loading branch information
Juholei committed Nov 9, 2023
1 parent 17ebc6d commit 8140f97
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,38 +82,52 @@
(valvonta-service/update-toimenpide!
db toimenpide-id body)
(toimenpide-404-msg id toimenpide-id)))}}]
;; TODO: Lisää näiden alle hallinto-oikeuden liitteen hakemista varten olevat routet
["/henkilot"
["/:henkilo-id/document/:filename"
{:get {:summary "Henkilö-osapuolen toimenpiteen dokumentin lataus"
:parameters {:path {:id common-schema/Key
:toimenpide-id common-schema/Key
:henkilo-id common-schema/Key
:filename schema/Str}}
:access rooli-service/paakayttaja?
:responses {200 {:body nil}
404 {:body schema/Str}}
:handler (fn [{{{:keys [id toimenpide-id henkilo-id filename]} :path}
:parameters :keys [db aws-s3-client]}]
(api-response/pdf-response
(valvonta-service/find-toimenpide-henkilo-document
db aws-s3-client id toimenpide-id henkilo-id)
filename
(api-response/msg-404 "henkilo" id toimenpide-id henkilo-id)))}}]]
["/:henkilo-id"
["/document/:filename"
{:get {:summary "Henkilö-osapuolen toimenpiteen dokumentin lataus"
:parameters {:path {:id common-schema/Key
:toimenpide-id common-schema/Key
:henkilo-id common-schema/Key
:filename schema/Str}}
:access rooli-service/paakayttaja?
:responses {200 {:body nil}
404 {:body schema/Str}}
:handler (fn [{{{:keys [id toimenpide-id henkilo-id filename]} :path}
:parameters :keys [db aws-s3-client]}]
(api-response/pdf-response
(valvonta-service/find-toimenpide-henkilo-document
db aws-s3-client id toimenpide-id henkilo-id)
filename
(api-response/msg-404 "henkilo" id toimenpide-id henkilo-id)))}}]
["/attachment"
["/hallinto-oikeus.pdf"
{:get {:summary "Henkilö-osapuolen toimenpiteeseen liittyvän hallinto-oikeus-liitteen lataus"
:parameters {:path {:id common-schema/Key
:toimenpide-id common-schema/Key
:henkilo-id common-schema/Key}}
:access rooli-service/paakayttaja?
:responses {200 {:body nil}
404 {:body schema/Str}}
:handler (fn [{{{:keys [id toimenpide-id henkilo-id filename]} :path}
:parameters :keys [db aws-s3-client]}]
{:status 200})}}]]]]
["/yritykset"
["/:yritys-id/document/:filename"
{:get {:summary "Yritys-osapuolen toimenpiteen esikatselu tai lataus"
:parameters {:path {:id common-schema/Key
:toimenpide-id common-schema/Key
:yritys-id common-schema/Key
:filename schema/Str}}
:access rooli-service/paakayttaja?
:responses {200 {:body nil}
404 {:body schema/Str}}
:handler (fn [{{{:keys [id toimenpide-id yritys-id filename]} :path}
:parameters :keys [db aws-s3-client]}]
(api-response/pdf-response
(valvonta-service/find-toimenpide-yritys-document
db aws-s3-client id toimenpide-id yritys-id)
filename
(api-response/msg-404 "yritys " id toimenpide-id yritys-id)))}}]]]])
["/:yritys-id"
;; TODO: Hallinto-oikeus-liitteen hakeminen yritysosapuolelle
["/document/:filename"
{:get {:summary "Yritys-osapuolen toimenpiteen esikatselu tai lataus"
:parameters {:path {:id common-schema/Key
:toimenpide-id common-schema/Key
:yritys-id common-schema/Key
:filename schema/Str}}
:access rooli-service/paakayttaja?
:responses {200 {:body nil}
404 {:body schema/Str}}
:handler (fn [{{{:keys [id toimenpide-id yritys-id filename]} :path}
:parameters :keys [db aws-s3-client]}]
(api-response/pdf-response
(valvonta-service/find-toimenpide-yritys-document
db aws-s3-client id toimenpide-id yritys-id)
filename
(api-response/msg-404 "yritys " id toimenpide-id yritys-id)))}}]]]]])
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@
(test-kayttajat/with-virtu-user)
(mock/header "Accept" "application/pdf")))]
(t/is (= (-> response :headers (get "Content-Type")) "application/pdf"))
(t/is (= (:status response) 200))))

(t/testing "hallinto-oikeus-liite can be downloaded through the api"
(let [response (ts/handler (-> (mock/request :get (format "/api/private/valvonta/kaytto/%s/toimenpiteet/%s/henkilot/%s/attachment/hallinto-oikeus.pdf" valvonta-id 4 osapuoli-id))
(test-kayttajat/with-virtu-user)
(mock/header "Accept" "application/pdf")))]
#_(t/is (= (-> response :headers (get "Content-Type")) "application/pdf"))
(t/is (= (:status response) 200))))))

(t/testing "Käskypäätös / varsinainen päätös toimenpide is created successfully for yritys and document is generated with correct information"
Expand Down Expand Up @@ -249,7 +256,9 @@
(test-kayttajat/with-virtu-user)
(mock/header "Accept" "application/pdf")))]
(t/is (= (-> response :headers (get "Content-Type")) "application/pdf"))
(t/is (= (:status response) 200))))))))
(t/is (= (:status response) 200))))

(t/testing "hallinto-oikeus-liite can be downloaded through the api")))))

(t/testing "Käskypäätös / varsinainen päätös toimenpide is created successfully when there are multiple osapuolis but one lives abroad and will not receive the document because of being outside court jurisdiction"
;; Add the valvonta and previous toimenpides
Expand Down

0 comments on commit 8140f97

Please sign in to comment.