Skip to content

Commit

Permalink
Merge branch 'reactions' into reactions_sql_case_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffcaseyyet committed Jan 17, 2024
2 parents 5311636 + b66a002 commit 00c7f17
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
9 changes: 7 additions & 2 deletions src/main/lrsql/admin/routes.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns lrsql.admin.routes
(:require [clojure.set :as cset]
[io.pedestal.http :refer [json-body]]
[io.pedestal.http.body-params :refer [body-params]]
[io.pedestal.http.body-params :refer [body-params
default-parser-map]]
[com.yetanalytics.lrs.pedestal.interceptor :as i]
[lrsql.admin.interceptors.account :as ai]
[lrsql.admin.interceptors.credentials :as ci]
Expand All @@ -20,7 +21,11 @@
i/x-forwarded-for-interceptor
(h/secure-headers sec-head-opts)
json-body
(body-params)
(body-params
;; By default the JSON parser will attempt to parse strings with `/` as
;; qualified keywords. We prevent this so (name x) is always the string.
(default-parser-map
:json-options {:key-fn #(keyword nil %)}))
(i/lrs-interceptor lrs)])

(defn admin-account-routes
Expand Down
4 changes: 3 additions & 1 deletion src/test/lrsql/lrs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,9 @@
"verb" {"id" "https://example.com/verbs/completed"},
"object"
{"id" "https://example.com/activities/a-and-b",
"objectType" "Activity"}}
"objectType" "Activity"}
"context"
{"extensions" {"https://example.com/foo" nil}}}
(remove-id tc/reaction-stmt-b)
(remove-id tc/reaction-stmt-a)]
:more ""}
Expand Down
12 changes: 7 additions & 5 deletions src/test/lrsql/ops/query/reaction_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@
[{:reaction-id reaction-id
:trigger-id trigger-id
:statement
{"actor" {"mbox" "mailto:[email protected]"},
"verb" {"id" "https://example.com/verbs/completed"},
{"actor" {"mbox" "mailto:[email protected]"},
"verb" {"id" "https://example.com/verbs/completed"},
"object"
{"id" "https://example.com/activities/a-and-b",
"objectType" "Activity"}}
"objectType" "Activity"}
"context" {"extensions" {"https://example.com/foo" nil}}}
;; Authority derived from the trigger statement
:authority (:agent tc/auth-ident)}]}
(qr/query-statement-reactions
Expand Down Expand Up @@ -118,11 +119,12 @@
[{:reaction-id reaction-id
:trigger-id trigger-id
:statement
{"actor" {"mbox" "mailto:[email protected]"},
"verb" {"id" "https://example.com/verbs/completed"},
{"actor" {"mbox" "mailto:[email protected]"},
"verb" {"id" "https://example.com/verbs/completed"},
"object"
{"id" "https://example.com/activities/a-and-b",
"objectType" "Activity"}
"context" {"extensions" {"https://example.com/foo" nil}}
"authority" {"mbox" "mailto:[email protected]"}}
;; Authority derived from the template
:authority {"mbox" "mailto:[email protected]"}}]}
Expand Down
9 changes: 5 additions & 4 deletions src/test/lrsql/reaction/protocol_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@
(testing "New statement added"
(is (= {:statement-result
{:statements
[{"id" reaction-s-id
"actor" {"mbox" "mailto:[email protected]"},
"verb" {"id" "https://example.com/verbs/completed"},
[{"id" reaction-s-id
"actor" {"mbox" "mailto:[email protected]"},
"verb" {"id" "https://example.com/verbs/completed"},
"object"
{"id" "https://example.com/activities/a-and-b",
"objectType" "Activity"}}
"objectType" "Activity"}
"context" {"extensions" {"https://example.com/foo" nil}}}
tc/reaction-stmt-b
tc/reaction-stmt-a]
:more ""}
Expand Down
9 changes: 5 additions & 4 deletions src/test/lrsql/test_constants.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
(def simple-reaction-ruleset
{:identityPaths [["actor" "mbox"]]
:template
{"actor" {"mbox" {"$templatePath" ["a" "actor" "mbox"]}}
"verb" {"id" "https://example.com/verbs/completed"}
"object" {"id" "https://example.com/activities/a-and-b"
"objectType" "Activity"}}
{"actor" {"mbox" {"$templatePath" ["a" "actor" "mbox"]}}
"verb" {"id" "https://example.com/verbs/completed"}
"object" {"id" "https://example.com/activities/a-and-b"
"objectType" "Activity"}
"context" {"extensions" {"https://example.com/foo" nil}}}
:conditions
{:a
{:and
Expand Down

0 comments on commit 00c7f17

Please sign in to comment.