Skip to content

Commit

Permalink
move timestamp coercions to ops ns
Browse files Browse the repository at this point in the history
  • Loading branch information
milt committed Jan 19, 2024
1 parent eec03ed commit c64ecea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
13 changes: 3 additions & 10 deletions src/main/lrsql/admin/interceptors/reaction.clj
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,11 @@
{:name ::get-all-reactions
:enter
(fn get-all-reactions [ctx]
(let [{lrs :com.yetanalytics/lrs} ctx
result
(adp/-get-all-reactions lrs)]
(let [{lrs :com.yetanalytics/lrs} ctx]
(assoc ctx
:response
{:status 200 :body {:reactions
(map
(fn [reaction-record]
(-> reaction-record
(update :created u/time->str)
(update :modified u/time->str)))
result)}})))}))
{:status 200
:body {:reactions (adp/-get-all-reactions lrs)}})))}))

(def update-reaction
"Update an existing reaction."
Expand Down
4 changes: 2 additions & 2 deletions src/main/lrsql/ops/query/reaction.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
:title title
:ruleset (ru/stringify-template ruleset)
:active active
:created created
:modified modified
:created (u/time->str created)
:modified (u/time->str modified)
:error error})
(bp/-query-all-reactions bk tx)))

Expand Down
7 changes: 5 additions & 2 deletions src/main/lrsql/spec/reaction.clj
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,16 @@
(s/def :lrsql.spec.reaction.query-all-reactions/error
(s/nilable ::error))

(s/def :lrsql.spec.reaction.query-all-reactions/created ::xs/timestamp)
(s/def :lrsql.spec.reaction.query-all-reactions/modified ::xs/timestamp)

(def query-all-reactions-ret-spec
(s/every (s/keys :req-un [::id
::title
::ruleset
::active
::created
::modified
:lrsql.spec.reaction.query-all-reactions/created
:lrsql.spec.reaction.query-all-reactions/modified
:lrsql.spec.reaction.query-all-reactions/error])))

(def query-statement-reactions-ret-element-spec
Expand Down

0 comments on commit c64ecea

Please sign in to comment.