From c2268c285648ef02ece04de0d9df0813c6d70ff8 Mon Sep 17 00:00:00 2001
From: benj <benj@rse8.com>
Date: Sat, 24 Dec 2022 00:43:38 -0800
Subject: refactor everything with more abstraction and a nicer interface

---
 .../secd/store/sqlite/sql/find_address_validation.sql  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 crates/secd/store/sqlite/sql/find_address_validation.sql

(limited to 'crates/secd/store/sqlite/sql/find_address_validation.sql')

diff --git a/crates/secd/store/sqlite/sql/find_address_validation.sql b/crates/secd/store/sqlite/sql/find_address_validation.sql
new file mode 100644
index 0000000..81d2cdf
--- /dev/null
+++ b/crates/secd/store/sqlite/sql/find_address_validation.sql
@@ -0,0 +1,18 @@
+select av.address_validation_public_id
+       , i.identity_public_id
+       , a.address_public_id
+       , a.type
+       , a.value
+       , a.created_at
+       , av.method
+       , av.token_hash
+       , av.code_hash
+       , av.attempts
+       , av.created_at
+       , av.expires_at
+       , av.revoked_at
+       , av.validated_at
+from address_validation av
+join address            a  using(address_id)
+left join identity      i  using(identity_id)
+where (($1 is null) or (address_validation_public_id = $1));
-- 
cgit v1.2.3

