feat: complete profile update and settings management

refactor: change profile update endpoints to PUT
refactor: changed profile settings update query to use username
chore: update SQL queries for profile operations
This commit is contained in:
2025-07-23 17:46:59 +03:00
parent f38af13dc1
commit d14f90d628
7 changed files with 130 additions and 38 deletions

View File

@@ -346,17 +346,19 @@ LIMIT 20 OFFSET 20 * $1;
INSERT INTO profile_settings(profile_id)
VALUES ($1) RETURNING *;
;-- name: UpdateProfileSettings :exec
UPDATE profile_settings
;-- name: UpdateProfileSettingsByUsername :exec
UPDATE profile_settings ps
SET
hide_fulfilled = COALESCE($2, hide_fulfilled),
hide_profile_details = COALESCE($3, hide_profile_details),
hide_for_unauthenticated = COALESCE($4, hide_for_unauthenticated),
hide_birthday = COALESCE($5, hide_birthday),
hide_dates = COALESCE($6, hide_dates),
captcha = COALESCE($7, captcha),
followers_only_interaction = COALESCE($8, followers_only_interaction)
WHERE id = $1;
hide_fulfilled = COALESCE($2, ps.hide_fulfilled),
hide_profile_details = COALESCE($3, ps.hide_profile_details),
hide_for_unauthenticated = COALESCE($4, ps.hide_for_unauthenticated),
hide_birthday = COALESCE($5, ps.hide_birthday),
hide_dates = COALESCE($6, ps.hide_dates),
captcha = COALESCE($7, ps.captcha),
followers_only_interaction = COALESCE($8, ps.followers_only_interaction)
FROM profiles p
JOIN users u ON p.user_id = u.id
WHERE ps.profile_id = p.id AND u.username = $1;
;-- name: GetProfileSettingsByUsername :one
SELECT profile_settings.* FROM profile_settings