feat: modify fields for updation

This commit is contained in:
2025-05-31 23:19:30 +02:00
parent 45bce711f2
commit bce775f692
2 changed files with 15 additions and 11 deletions

View File

@ -163,9 +163,10 @@ const updateApiService = `-- name: UpdateApiService :one
UPDATE api_services UPDATE api_services
SET SET
name = $2, name = $2,
redirect_uris = $3, description = $3,
scopes = $4, redirect_uris = $4,
grant_types = $5, scopes = $5,
grant_types = $6,
updated_at = NOW() updated_at = NOW()
WHERE client_id = $1 WHERE client_id = $1
RETURNING id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description RETURNING id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description
@ -174,6 +175,7 @@ RETURNING id, client_id, client_secret, name, redirect_uris, scopes, grant_types
type UpdateApiServiceParams struct { type UpdateApiServiceParams struct {
ClientID string `json:"client_id"` ClientID string `json:"client_id"`
Name string `json:"name"` Name string `json:"name"`
Description pgtype.Text `json:"description"`
RedirectUris []string `json:"redirect_uris"` RedirectUris []string `json:"redirect_uris"`
Scopes []string `json:"scopes"` Scopes []string `json:"scopes"`
GrantTypes []string `json:"grant_types"` GrantTypes []string `json:"grant_types"`
@ -183,6 +185,7 @@ func (q *Queries) UpdateApiService(ctx context.Context, arg UpdateApiServicePara
row := q.db.QueryRow(ctx, updateApiService, row := q.db.QueryRow(ctx, updateApiService,
arg.ClientID, arg.ClientID,
arg.Name, arg.Name,
arg.Description,
arg.RedirectUris, arg.RedirectUris,
arg.Scopes, arg.Scopes,
arg.GrantTypes, arg.GrantTypes,

View File

@ -24,9 +24,10 @@ ORDER BY created_at DESC;
UPDATE api_services UPDATE api_services
SET SET
name = $2, name = $2,
redirect_uris = $3, description = $3,
scopes = $4, redirect_uris = $4,
grant_types = $5, scopes = $5,
grant_types = $6,
updated_at = NOW() updated_at = NOW()
WHERE client_id = $1 WHERE client_id = $1
RETURNING *; RETURNING *;