2020-04-10 04:40:22 +02:00
|
|
|
-- name: GetUserAccountByID :one
|
|
|
|
SELECT * FROM user_account WHERE user_id = $1;
|
|
|
|
|
|
|
|
-- name: GetAllUserAccounts :many
|
|
|
|
SELECT * FROM user_account;
|
|
|
|
|
|
|
|
-- name: GetUserAccountByUsername :one
|
|
|
|
SELECT * FROM user_account WHERE username = $1;
|
|
|
|
|
|
|
|
-- name: CreateUserAccount :one
|
2020-07-05 01:02:57 +02:00
|
|
|
INSERT INTO user_account(full_name, initials, email, username, created_at, password_hash, role_code)
|
|
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING *;
|
2020-06-13 00:21:58 +02:00
|
|
|
|
|
|
|
-- name: UpdateUserAccountProfileAvatarURL :one
|
|
|
|
UPDATE user_account SET profile_avatar_url = $2 WHERE user_id = $1
|
|
|
|
RETURNING *;
|
2020-06-23 22:20:53 +02:00
|
|
|
|
|
|
|
-- name: DeleteUserAccountByID :exec
|
|
|
|
DELETE FROM user_account WHERE user_id = $1;
|
2020-07-05 01:02:57 +02:00
|
|
|
|
|
|
|
-- name: GetRoleForUserID :one
|
|
|
|
SELECT username, role.code, role.name FROM user_account
|
|
|
|
INNER JOIN role ON role.code = user_account.role_code
|
|
|
|
WHERE user_id = $1;
|
2020-07-12 09:06:11 +02:00
|
|
|
|
|
|
|
-- name: UpdateUserRole :one
|
|
|
|
UPDATE user_account SET role_code = $2 WHERE user_id = $1 RETURNING *;
|