Assign defaults on serializers instead on api

For make the operations more efficient
This commit is contained in:
Andrey Antukh 2025-08-12 10:33:08 +02:00
parent 761a0a7009
commit f32b92a5b0
2 changed files with 19 additions and 14 deletions

View File

@ -390,11 +390,11 @@
row-gap (get gap :row-gap 0)
column-gap (get gap :column-gap 0)
align-items (-> (get shape :layout-align-items :start) sr/translate-layout-align-items)
align-content (-> (get shape :layout-align-content :stretch) sr/translate-layout-align-content)
justify-items (-> (get shape :layout-justify-items :start) sr/translate-layout-justify-items)
justify-content (-> (get shape :layout-justify-content :stretch) sr/translate-layout-justify-content)
wrap-type (-> (get shape :layout-wrap-type :nowrap) sr/translate-layout-wrap-type)
align-items (-> (get shape :layout-align-items) sr/translate-layout-align-items)
align-content (-> (get shape :layout-align-content) sr/translate-layout-align-content)
justify-items (-> (get shape :layout-justify-items) sr/translate-layout-justify-items)
justify-content (-> (get shape :layout-justify-content) sr/translate-layout-justify-content)
wrap-type (-> (get shape :layout-wrap-type) sr/translate-layout-wrap-type)
padding (get shape :layout-padding)
padding-top (get padding :p1 0)
@ -425,10 +425,10 @@
row-gap (get gap :row-gap 0)
column-gap (get gap :column-gap 0)
align-items (-> (get shape :layout-align-items :start) sr/translate-layout-align-items)
align-content (-> (get shape :layout-align-content :stretch) sr/translate-layout-align-content)
justify-items (-> (get shape :layout-justify-items :start) sr/translate-layout-justify-items)
justify-content (-> (get shape :layout-justify-content :stretch) sr/translate-layout-justify-content)
align-items (-> (get shape :layout-align-items) sr/translate-layout-align-items)
align-content (-> (get shape :layout-align-content) sr/translate-layout-align-content)
justify-items (-> (get shape :layout-justify-items) sr/translate-layout-justify-items)
justify-content (-> (get shape :layout-justify-content) sr/translate-layout-justify-content)
padding (get shape :layout-padding)
padding-top (get padding :p1 0)

View File

@ -212,7 +212,8 @@
:start 0
:end 1
:center 2
:stretch 3))
:stretch 3
0))
(defn translate-layout-align-content
[align-content]
@ -223,7 +224,8 @@
:space-between 3
:space-around 4
:space-evenly 5
:stretch 6))
:stretch 6
6))
(defn translate-layout-justify-items
[justify-items]
@ -231,7 +233,8 @@
:start 0
:end 1
:center 2
:stretch 3))
:stretch 3
0))
(defn translate-layout-justify-content
[justify-content]
@ -242,13 +245,15 @@
:space-between 3
:space-around 4
:space-evenly 5
:stretch 6))
:stretch 6
6))
(defn translate-layout-wrap-type
[wrap-type]
(case wrap-type
:wrap 0
:nowrap 1))
:nowrap 1
1))
(defn translate-grid-track-type
[type]