Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

Commit

Permalink
Fix store and retrieve-by-user-container functions. Fix gsindexes at …
Browse files Browse the repository at this point in the history
…the bottom too.
  • Loading branch information
bago2k4 committed Jun 28, 2020
1 parent 66e9308 commit 5910679
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject open-company/lib "0.17.29-alpha20"
(defproject open-company/lib "0.17.29-alpha21"
:description "OpenCompany Common Library"
:url "https://github.com/open-company/open-company-lib"
:license {
Expand Down
10 changes: 5 additions & 5 deletions src/oc/lib/change/resources/seen.clj
Expand Up @@ -32,7 +32,7 @@
container-id :- lib-schema/UniqueID
seen-at :- lib-schema/ISO8601
seen-ttl :- schema/Int]
(store! user-id org-id container-id entire-container seen-at seen-ttl))
(store! db-opts user-id org-id container-id entire-container seen-at seen-ttl))

;; Store a seen entry for the specified user
([db-opts
Expand Down Expand Up @@ -115,8 +115,8 @@
{:index (container-id-gsi-name db-opts)})]
(if (seq seen-items)
(-> (first seen-items)
(clojure.set/rename-keys {:container_id :container-id :item_id :item-id :seen_at :seen-at})
(select-keys [:item-id :container-id :seen-at]))
(clojure.set/rename-keys {:container_id :container-id :org_id :org-id :seen_at :seen-at})
(select-keys [:org-id :container-id :seen-at]))
{})))

(schema/defn ^:always-validate retrieve-by-user-item :- (schema/maybe {:org-id lib-schema/UniqueID
Expand Down Expand Up @@ -157,7 +157,7 @@
:billing-mode :pay-per-request
:hash-keydef [:item_id :s]
:range-keydef [:container_id :s]
:projection :keys-only}}))
:projection :all}}))

(doseq [item (far/query config/dynamodb-opts (lib-seen/table-name db-opts) {:item_id [:eq "512b-4ad1-9924"]} {:index seen/container-id-item-id-gsi-name})]
(aprint
Expand All @@ -173,7 +173,7 @@
:billing-mode :pay-per-request
:hash-keydef [:container_id :s]
:range-keydef [:user_id :s]
:projection :keys-only}}))
:projection :all}}))

(doseq [item (far/query config/dynamodb-opts (lib-seen/table-name db-opts) {:container_id [:eq "25a3-4692-bf02"]} {:index seen/container-id-gsi-name})]
(aprint
Expand Down

0 comments on commit 5910679

Please sign in to comment.