making some progress

This commit is contained in:
2026-04-25 13:31:41 -06:00
parent 27088c2cd8
commit 09f4421f7f
11 changed files with 166 additions and 125 deletions

View File

@@ -1,7 +1,7 @@
-- name: GetUserFromId :one
-- name: GetUserById :one
SELECT *
FROM users u
WHERE u.id = $1;
WHERE u.id = @user_id::uuid;
-- name: GetUserAuthValue :one
SELECT u.ID as user_id, a.value as auth_value
@@ -9,5 +9,20 @@ FROM users u
JOIN auth_method a
ON a.user_id = u.id
WHERE
(u.name = $1 OR u.email = $1)
AND a.type = $2;
(u.name = @auth_value::text OR u.email = @auth_value)
AND a.type = @auth_type::auth_type;
-- name: CreateUser :one
INSERT INTO users (name, email, bio, profile_photo)
VALUES($1, $2, $3, $4)
RETURNING *;
-- name: UpdateUser :one
UPDATE users
SET name = @name::text, email = @email::text, bio = @bio::text, profile_photo = @photo::text
WHERE id = @id::uuid
RETURNING *;
-- name: CreateAuthMethod :exec
INSERT INTO auth_method (user_id, type, value)
VALUES ($1, $2, $3);