aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/store/sqlite/sql/find_identity.sql
blob: 152840749d82f6473b09213d60f78fd2f3963f14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
select distinct
       identity_public_id
       , data
       , i.created_at
       , i.updated_at
       , i.deleted_at
from identity i
left join address_validation av using (identity_id)
left join address            a  using (address_id)
left join session            s  using (identity_id)
where (($1 is null) or (i.identity_public_id = $1))
and (($2 is null) or (a.value = $2))
and (($3 is null) or (($3 is true) and (av.validated_at is not null)))
and (($4 is null) or (s.token_hash = $4))
and i.deleted_at is null;