File size: 541 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- name: AuthLinkAddReq :exec
INSERT INTO auth_link_requests(id, provider_id, subject_id, expires_at, metadata)
    VALUES ($1, $2, $3, $4, $5);

-- name: AuthLinkUseReq :one
DELETE FROM auth_link_requests
WHERE id = $1
    AND expires_at > now()
RETURNING
    provider_id,
    subject_id;

-- name: AuthLinkAddAuthSubject :exec
INSERT INTO auth_subjects(provider_id, subject_id, user_id)
    VALUES ($1, $2, $3);

-- name: AuthLinkMetadata :one
SELECT
    metadata
FROM
    auth_link_requests
WHERE
    id = $1
    AND expires_at > now();