Skip to content

Commit

Permalink
Try fixing dialog service update
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen committed Nov 28, 2024
1 parent 1061fe2 commit d161939
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions webapp/src/clj/lipas/backend/ptv/handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
(defn localized-string-schema [string-props]
[:map
{:closed true}
[:fi [:string string-props]]
[:se [:string string-props]]
[:en [:string string-props]]])
[:fi {:optional true} [:string string-props]]
[:se {:optional true} [:string string-props]]
[:en {:optional true} [:string string-props]]])

(def integration-enum
[:enum "lipas-managed" "manual"])
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/clj/lipas/backend/ptv/integration.clj
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
[ptv service-location]
(let [org-id (-> service-location :organizationId)
params {:url (make-url ptv "/v11/ServiceChannel/ServiceLocation")
:auth-org-id org-id
:method :post
:form-params service-location}]
(log/info "Create PTV service location" service-location)
Expand Down Expand Up @@ -286,6 +285,9 @@

(get-org-service-channels ptv* org-id*)

(http ptv* org-id* {:url (make-url ptv* "/v11/ServiceChannel/b4abd13e-0d36-4ff9-a6c9-94f2f5aee036")
:method :get})

;; Delete all org service locations
(doseq [x (:itemList (get-org-service-channels ptv* org-id*))]
(update-service-location ptv* (:id x) {:organizationId org-id*
Expand Down
7 changes: 7 additions & 0 deletions webapp/src/cljs/lipas/ui/ptv/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
:service-name service-name
:service-modified (:modified service)
:service-channels (->> service :serviceChannels (map :serviceChannel))
:city-codes (->> service
:areas
(mapcat (fn [{:keys [type municipalities]}]
(when (= "Municipality" type)
municipalities)))
(map (comp parse-long :code))
vec)
:ontology-terms (->> service
:ontologyTerms
(map (fn [m]
Expand Down
13 changes: 4 additions & 9 deletions webapp/src/cljs/lipas/ui/ptv/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -695,17 +695,12 @@
org-languages (ptv-data/org-id->languages org-id)
;; Turn the PTV Service data structure back to Lipas API call for save!
data {:org-id org-id
:city-codes (->> service
:areas
(some (fn [{:keys [type municipalities]}]
(when (= "Municipality" type)
municipalities)))
vals
(map :code))
:source-id source-id
:city-codes (:city-codes service)
:sub-category-id (ptv-data/parse-service-source-id (:source-id service))
:languages org-languages
:summary (:summary descriptions)
:description (:description descriptions)}]
:summary (or (:summary descriptions) (:summary service))
:description (or (:description descriptions) (:description service))}]
[lui/expansion-panel {:label (:label service)}
[mui/stack {:spacing 2}
[mui/stack {:direction "row" :spacing 2}
Expand Down

0 comments on commit d161939

Please sign in to comment.