From 0920c4d4f30a3345870d385d5c6f3e0919228b56 Mon Sep 17 00:00:00 2001
From: benj <benj@rse8.com>
Date: Mon, 12 Dec 2022 17:06:57 -0800
Subject: (oauth2 + email added): a mess that may or may not really work and
 needs to be refactored...

---
 crates/secd/store/pg/sql/find_identity.sql | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'crates/secd/store/pg/sql/find_identity.sql')

diff --git a/crates/secd/store/pg/sql/find_identity.sql b/crates/secd/store/pg/sql/find_identity.sql
index f4c9cbf..135ff9a 100644
--- a/crates/secd/store/pg/sql/find_identity.sql
+++ b/crates/secd/store/pg/sql/find_identity.sql
@@ -1,9 +1,11 @@
 select
-        identity_public_id,
-        data,
-        i.created_at
+        identity_public_id
+        , data
+        , i.created_at
+        , i.deleted_at
 from secd.identity       i
-join secd.identity_email ie using (identity_id)
-join secd.email          e  using (email_id)
+join secd.identity_email_validation iev using (identity_id)
+join secd.email_validation          ev  using (email_validation_id)
+join secd.email                     e   using (email_id)
 where (($1 is null) or (i.identity_public_id = $1))
-and   (($2 is null) or (e.address = $2))
+and   (($2 is null) or (e.address = $2));
-- 
cgit v1.2.3

