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:
@@ -307,8 +307,9 @@ UPDATE users SET email = $2, updated_at = NOW() WHERE id = $1;
|
|||||||
-- name: UpdatePassword :exec
|
-- name: UpdatePassword :exec
|
||||||
UPDATE users SET password_hash = $2, updated_at = NOW() WHERE id = $1;
|
UPDATE users SET password_hash = $2, updated_at = NOW() WHERE id = $1;
|
||||||
|
|
||||||
-- name: UpdateUserMaxDevices :exec
|
-- name: UpdateUserMaxDevices :one
|
||||||
UPDATE users SET max_devices = $2, updated_at = NOW() WHERE id = $1;
|
UPDATE users SET max_devices = $2, updated_at = NOW() WHERE id = $1
|
||||||
|
RETURNING *;
|
||||||
|
|
||||||
-- name: CountUserDevices :one
|
-- name: CountUserDevices :one
|
||||||
SELECT COUNT(*) FROM devices WHERE user_id = $1;
|
SELECT COUNT(*) FROM devices WHERE user_id = $1;
|
||||||
|
|||||||
Reference in New Issue
Block a user