Skip to content

Commit

Permalink
Move label param for input fns to end of arg list
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Feb 10, 2025
1 parent 841d6a3 commit b404c12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/lrsql/init.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
:secret-key ?secret-key}
acc-id (:primary-key admin-in)
cred-in (auth-input/insert-credential-input
acc-id nil key-pair)
acc-id key-pair nil)
scope-in (auth-input/insert-credential-scopes-input
key-pair #{"all"})]
;; Don't insert creds if reconnecting to a DB previously seeded
Expand Down
16 changes: 8 additions & 8 deletions src/main/lrsql/input/auth.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

(s/fdef insert-credential-input
:args (s/cat :account-id ::ads/account-id
:label ::as/label
:key-pair as/key-pair-args-spec)
:key-pair as/key-pair-args-spec
:label ::as/label)
:ret as/insert-cred-input-spec)

(defn insert-credential-input
"Given `account-id` and either a `key-pair` map or separate `api-key` and
`secret-key` args, construct the input param map for `insert-credential!`"
([account-id label key-pair]
([account-id key-pair label]
(assoc key-pair
:primary-key (u/generate-squuid)
:account-id account-id
:label label))
([account-id label api-key secret-key]
([account-id api-key secret-key label]
{:primary-key (u/generate-squuid)
:api-key api-key
:secret-key secret-key
Expand Down Expand Up @@ -52,17 +52,17 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(s/fdef update-credential-label-input
:args (s/cat :label ::as/label
:key-pair as/key-pair-args-spec)
:args (s/cat :key-pair as/key-pair-args-spec
:label ::as/label)
:ret as/update-cred-label-input-spec)

(defn update-credential-label-input
"Given a `label` and either a `key-pair` map or seperate `api-key` and
`secret-key` args, construct the input param map for
`update-credential-label!`"
([label key-pair]
([key-pair label]
(assoc key-pair :label label))
([label api-key secret-key]
([api-key secret-key label]
{:api-key api-key
:secret-key secret-key
:label label}))
Expand Down
8 changes: 4 additions & 4 deletions src/main/lrsql/system/lrs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@
key-pair (auth-util/generate-key-pair)
cred-in (auth-input/insert-credential-input
account-id
label
key-pair)
key-pair
label)
scope-in (auth-input/insert-credential-scopes-input
key-pair
scopes)]
Expand Down Expand Up @@ -348,9 +348,9 @@
secret-key
del-scopes)
lab-inputs (auth-input/update-credential-label-input
label
api-key
secret-key)]
secret-key
label)]
(auth-cmd/update-credential-label! backend tx lab-inputs)
(auth-cmd/insert-credential-scopes! backend tx add-inputs)
(auth-cmd/delete-credential-scopes! backend tx del-inputs)
Expand Down

0 comments on commit b404c12

Please sign in to comment.