-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove legacy api #129
base: master
Are you sure you want to change the base?
Remove legacy api #129
Conversation
:body (core/save-ptv-integration-definitions db search identity body-params)})}}]] | ||
|
||
;; legacy routes | ||
["/v1/api" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's currently a top-level endpoint /rest
that nginx captures and proxies to the legacy-api. I think we could just swap in this thing with the path /rest/api
once it's ready and remove the nginx rule. https://github.com/lipas-liikuntapaikat/lipas/blob/master/nginx/proxy.conf#L141
(defn fill-properties [m] | ||
(reduce (fn [acc k] (assoc-in acc [:props k] (prop-types/all k))) | ||
m | ||
(-> m :props keys))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could just (assoc m :props (select-keys prop-types/all (keys (:props m))))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. or (update m :props #(select-keys prop-types/all (keys %)))
(-> m | ||
(select-keys keys-vec) | ||
(localize lang) | ||
utils/->camel-case-keywords)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if it was this simple. ;) However, the differences between lipas and legacy-api are not 1:1 kebab-case -> camelCase... there are a few edge-cases and exceptions that are covered in this mapping: https://github.com/lipas-liikuntapaikat/lipas/blob/master/webapp/src/clj/lipas/integration/old_lipas/sports_site.clj#L13
...and it's inverted version https://github.com/lipas-liikuntapaikat/lipas/blob/master/webapp/src/clj/lipas/integration/old_lipas/sports_site.clj#L203
You can use rename-keys to change "new keys" to "old keys" with the hardcoded map.
|
||
(defn collect-sport-place-types [sub-category-type-code] | ||
(->> (vals types/all) | ||
(filter #(= (% :sub-category) sub-category-type-code)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing, but you can change filter
to just a map lookup. We already have types indexed by sub-category (and also by main-category) here https://github.com/lipas-liikuntapaikat/lipas/blob/remove-legacy-api-v2/webapp/src/cljc/lipas/data/types.cljc#L23-L24
(defn- collect-subcategories [type-code locale] | ||
(->> | ||
(vals types/sub-categories) | ||
(filter #(= (% :main-category) (str type-code))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above :)
@@ -791,7 +791,7 @@ | |||
(let [locale (or (-> req :parameters :query :lang keyword) :en)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legacy-api defaults to :fi
, let's not change that. :)
5177de1
to
a68127e
Compare
No description provided.