From 27168df997c298e871d34e58fdc726bf2e8a4954 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 12 Mar 2025 03:10:46 +0900 Subject: feat(backend): implement user edit page --- backend/db/query.sql.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'backend/db/query.sql.go') diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index 5719e57..75671b6 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -733,6 +733,35 @@ func (q *Queries) UpdateSubmissionStatus(ctx context.Context, arg UpdateSubmissi return err } +const updateUser = `-- name: UpdateUser :exec +UPDATE users +SET + display_name = $2, + icon_path = $3, + is_admin = $4, + label = $5 +WHERE user_id = $1 +` + +type UpdateUserParams struct { + UserID int32 + DisplayName string + IconPath *string + IsAdmin bool + Label *string +} + +func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error { + _, err := q.db.Exec(ctx, updateUser, + arg.UserID, + arg.DisplayName, + arg.IconPath, + arg.IsAdmin, + arg.Label, + ) + return err +} + const updateUserIconPath = `-- name: UpdateUserIconPath :exec UPDATE users SET icon_path = $2 -- cgit v1.2.3-70-g09d2