@@ -176,12 +176,15 @@ defmodule Kaffy.ResourceSchema do
176
176
value . ( schema )
177
177
178
178
is_map ( value ) && Map . has_key? ( value , :__struct__ ) ->
179
- if value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] do
180
- value
181
- else
182
- Map . from_struct ( value )
183
- |> Map . drop ( [ :__meta__ ] )
184
- |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
179
+ cond do
180
+ value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] ->
181
+ value
182
+ value . __struct__ in [ Geo.Point ] ->
183
+ Kaffy.Utils . json ( ) . encode! ( value , escape: :html_safe , pretty: true )
184
+ true ->
185
+ Map . from_struct ( value )
186
+ |> Map . drop ( [ :__meta__ ] )
187
+ |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
185
188
end
186
189
187
190
Kaffy.Utils . is_module ( ft ) && Keyword . has_key? ( ft . __info__ ( :functions ) , :render_index ) ->
@@ -206,12 +209,15 @@ defmodule Kaffy.ResourceSchema do
206
209
value
207
210
208
211
is_map ( value ) && Map . has_key? ( value , :__struct__ ) ->
209
- if value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] do
210
- value
211
- else
212
- Map . from_struct ( value )
213
- |> Map . drop ( [ :__meta__ ] )
214
- |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
212
+ cond do
213
+ value . __struct__ in [ NaiveDateTime , DateTime , Date , Time ] ->
214
+ value
215
+ value . __struct__ in [ Geo.Point ] ->
216
+ Kaffy.Utils . json ( ) . encode! ( value , escape: :html_safe , pretty: true )
217
+ true ->
218
+ Map . from_struct ( value )
219
+ |> Map . drop ( [ :__meta__ ] )
220
+ |> Kaffy.Utils . json ( ) . encode! ( escape: :html_safe , pretty: true )
215
221
end
216
222
217
223
is_map ( value ) ->
@@ -320,6 +326,9 @@ defmodule Kaffy.ResourceSchema do
320
326
{ _f , % { type: { :array , _ } } } ->
321
327
true
322
328
329
+ { _f , % { type: Geo.PostGIS.Geometry } } ->
330
+ true
331
+
323
332
f when is_atom ( f ) ->
324
333
f == :map
325
334
0 commit comments