Skip to content

Commit

Permalink
changing how user-create-from-byu detects if the user was created
Browse files Browse the repository at this point in the history
  • Loading branch information
benrencher committed Oct 17, 2024
1 parent feda9cc commit c2d80d8
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
;; [username byu-person-id]
[username]
(let [yvideo-user-exists? (not-empty (users/READ-BY-USERNAME username))]
(when-not yvideo-user-exists? (uc/create-potentially-empty-user username)))) ;; handles creating user if doesn't exist already
(when-not yvideo-user-exists? (uc/create-potentially-empty-user username))
(not-empty (users/READ-BY-USERNAME username))
)
);; handles creating user if doesn't exist already
;; will have to user BYU id (byu-person-id) when calling with the new bdp
;; byu-data (when-not yvideo-user-exists? (persons/get-user-data-new byu-person-id))
;; byu-data (when-not yvideo-user-exists? (uc/create-potentially-empty-user username))
Expand All @@ -62,15 +65,15 @@
:handler (fn [request]
(let [body (:body request)
username (get-in body [:parameters :username])]
(if-let [user-data-from-byu (_user-create-from-byu username)]
(if-let [user-was-created (_user-create-from-byu username)]
{:status 200
:body (let [response (merge body (:user-data user-data-from-byu))]
(if user-data-from-byu
{:message "1 user created"
:id (utils/get-id (:db-item response))}
{:message "username not created invalid BYU username"
:id "-"}))}

:body (if user-was-created
{:message "1 user created"
:id (utils/get-id (:db-item response))}
{:message "username not created invalid BYU username"
:id "-"}
)
}
{:status 500
:body {:message "username already taken"}})))})

Expand Down

0 comments on commit c2d80d8

Please sign in to comment.