refactor: add explicit text cast to email parameter in user update query

Add explicit ::text cast to $4 parameter in email update case statement to ensure proper type handling before citext conversion and null comparison.
This commit is contained in:
2026-03-18 09:15:38 +01:00
parent 1e04a07ef8
commit 908c9e8118

View File

@@ -78,7 +78,7 @@ func (r *PGRepository) Update(ctx context.Context, userID uuid.UUID, input Updat
set
role_id = coalesce((select id from roles where name = $2), u.role_id),
display_name = coalesce($3, u.display_name),
email = case when $4 is null then u.email else nullif($4, '')::citext end,
email = case when $4::text is null then u.email else nullif($4::text, '')::citext end,
password_hash = coalesce($5, u.password_hash),
is_active = coalesce($6, u.is_active),
updated_at = now()