aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/store/pg/sql/find_email_validation.sql
diff options
context:
space:
mode:
Diffstat (limited to 'crates/secd/store/pg/sql/find_email_validation.sql')
-rw-r--r--crates/secd/store/pg/sql/find_email_validation.sql17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/secd/store/pg/sql/find_email_validation.sql b/crates/secd/store/pg/sql/find_email_validation.sql
new file mode 100644
index 0000000..d16d8e7
--- /dev/null
+++ b/crates/secd/store/pg/sql/find_email_validation.sql
@@ -0,0 +1,17 @@
+select
+ ev.email_validation_public_id
+ , i.identity_public_id
+ , e.address
+ , ev.attempts
+ , ev.code
+ , ev.is_validated
+ , ev.created_at
+ , ev.expires_at
+ , ev.revoked_at
+from auth.email_validation ev
+join auth.identity_email ie using (identity_email_id)
+join auth.email e using (email_id)
+join auth.identity i using (identity_id)
+where (($1 is null) or (email_validation_public_id = $1))
+and (($2 is null) or (code = $2));
+--