Change UpdateUserMaxDevices to return updated user record

- Change query from :exec to :one with RETURNING *
- Allows handler to detect when user doesn't exist
- Follows pattern established by UpdateMediaItem
- Required for 404 response on non-existent user

Related: Fix for TestUpdateUserMaxDevicesNonExistentUser
This commit is contained in:
2026-02-09 15:46:57 -05:00
parent c2cba82146
commit eed1ef37dc
+3 -2
View File
@@ -307,8 +307,9 @@ UPDATE users SET email = $2, updated_at = NOW() WHERE id = $1;
-- name: UpdatePassword :exec
UPDATE users SET password_hash = $2, updated_at = NOW() WHERE id = $1;
-- name: UpdateUserMaxDevices :exec
UPDATE users SET max_devices = $2, updated_at = NOW() WHERE id = $1;
-- name: UpdateUserMaxDevices :one
UPDATE users SET max_devices = $2, updated_at = NOW() WHERE id = $1
RETURNING *;
-- name: CountUserDevices :one
SELECT COUNT(*) FROM devices WHERE user_id = $1;