feat: 0.0.1
This commit is contained in:
146 files changed
+10444
No files matched your search
@@ -0,0 +1,17 @@
|
||||
-- name: CreateSession :one
|
||||
INSERT INTO sessions (
|
||||
id,
|
||||
username,
|
||||
refresh_token,
|
||||
user_agent,
|
||||
client_ip,
|
||||
is_blocked,
|
||||
expires_at
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetSession :one
|
||||
SELECT * FROM sessions
|
||||
WHERE id = $1 LIMIT 1;
|
||||
@@ -0,0 +1,25 @@
|
||||
-- name: CreateUser :one
|
||||
INSERT INTO users (
|
||||
username,
|
||||
hashed_password,
|
||||
full_name,
|
||||
email
|
||||
) VALUES (
|
||||
$1, $2, $3, $4
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetUser :one
|
||||
SELECT * FROM users
|
||||
WHERE username = $1 LIMIT 1;
|
||||
|
||||
-- name: UpdateUser :one
|
||||
UPDATE users
|
||||
SET
|
||||
hashed_password = COALESCE(sqlc.narg('hashed_password'), hashed_password),
|
||||
password_changed_at = COALESCE(sqlc.narg('password_changed_at'), password_changed_at),
|
||||
full_name = COALESCE(sqlc.narg('full_name'), full_name),
|
||||
email = COALESCE(sqlc.narg('email'), email),
|
||||
is_email_verified = COALESCE(sqlc.narg('is_email_verified'), is_email_verified)
|
||||
WHERE username = sqlc.arg('username')
|
||||
RETURNING *;
|
||||
@@ -0,0 +1,21 @@
|
||||
-- name: CreateVerifyEmail :one
|
||||
INSERT INTO verify_emails (
|
||||
username,
|
||||
email,
|
||||
secret_code
|
||||
) VALUES (
|
||||
$1, $2, $3
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
|
||||
-- name: UpdateVerifyEmail :one
|
||||
UPDATE verify_emails
|
||||
SET
|
||||
is_used = TRUE
|
||||
WHERE
|
||||
id = @id
|
||||
AND secret_code = @secret_code
|
||||
AND is_used = FALSE
|
||||
AND expired_at > NOW()
|
||||
RETURNING *;
|
||||
Reference in new issue
Block a user