initial commit
[squeep-indie-auther] / src / db / postgres / sql / token-get-by-code-id.sql
1 --
2 SELECT
3 t.code_id,
4 p.profile,
5 t.created,
6 t.expires,
7 t.refresh_expires,
8 t.refreshed,
9 t.duration,
10 t.refresh_duration,
11 t.refresh_count,
12 t.is_revoked,
13 t.is_token,
14 t.client_id,
15 t.profile_data,
16 a.identifier,
17 ARRAY(
18 SELECT s.scope FROM token_scope ts INNER JOIN scope s USING (scope_id)
19 WHERE ts.code_id = t.code_id
20 ) AS scopes
21 FROM token t
22 INNER JOIN profile p USING (profile_id)
23 INNER JOIN authentication a USING (identifier_id)
24 WHERE code_id = $(codeId)