From 61ad11245131b4205cc7562e9132daa87607f42c Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sun, 28 Feb 2021 19:57:19 +0100 Subject: [PATCH] :sparkles: Minor improvement on retrieve profile by email fn. --- backend/src/app/rpc/queries/profile.clj | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/backend/src/app/rpc/queries/profile.clj b/backend/src/app/rpc/queries/profile.clj index 5d87ba7da..59ed2e8b0 100644 --- a/backend/src/app/rpc/queries/profile.clj +++ b/backend/src/app/rpc/queries/profile.clj @@ -13,6 +13,7 @@ [app.common.spec :as us] [app.common.uuid :as uuid] [app.db :as db] + [app.db.sql :as sql] [app.util.services :as sv] [clojure.spec.alpha :as s] [cuerdas.core :as str])) @@ -96,18 +97,12 @@ profile)) - -(def sql:profile-by-email - "select * from profile - where email=? - and deleted_at is null") - (defn retrieve-profile-data-by-email [conn email] - (let [email (str/lower email)] - (-> (db/exec-one! conn [sql:profile-by-email email]) - (decode-profile-row)))) - + (let [sql (sql/select :profile {:email (str/lower email)}) + data (db/exec-one! conn sql)] + (when (and data (nil? (:deleted-at data))) + (decode-profile-row data)))) ;; --- Attrs Helpers