feat: add icon url to api service

This commit is contained in:
2025-06-07 19:21:14 +02:00
parent b7a67c208f
commit 3ceeab04e1
3 changed files with 23 additions and 5 deletions

View File

@ -28,7 +28,7 @@ INSERT INTO api_services (
client_id, client_secret, name, description, redirect_uris, scopes, grant_types, is_active
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8
) 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, icon_url
`
type CreateApiServiceParams struct {
@ -66,6 +66,7 @@ func (q *Queries) CreateApiService(ctx context.Context, arg CreateApiServicePara
&i.UpdatedAt,
&i.IsActive,
&i.Description,
&i.IconUrl,
)
return i, err
}
@ -83,7 +84,7 @@ func (q *Queries) DeactivateApiService(ctx context.Context, clientID string) err
}
const getApiServiceCID = `-- name: GetApiServiceCID :one
SELECT id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description FROM api_services
SELECT id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description, icon_url FROM api_services
WHERE client_id = $1
AND is_active = true
LIMIT 1
@ -104,12 +105,13 @@ func (q *Queries) GetApiServiceCID(ctx context.Context, clientID string) (ApiSer
&i.UpdatedAt,
&i.IsActive,
&i.Description,
&i.IconUrl,
)
return i, err
}
const getApiServiceId = `-- name: GetApiServiceId :one
SELECT id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description FROM api_services
SELECT id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description, icon_url FROM api_services
WHERE id = $1
LIMIT 1
`
@ -129,12 +131,13 @@ func (q *Queries) GetApiServiceId(ctx context.Context, id uuid.UUID) (ApiService
&i.UpdatedAt,
&i.IsActive,
&i.Description,
&i.IconUrl,
)
return i, err
}
const listApiServices = `-- name: ListApiServices :many
SELECT id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description FROM api_services
SELECT id, client_id, client_secret, name, redirect_uris, scopes, grant_types, created_at, updated_at, is_active, description, icon_url FROM api_services
ORDER BY created_at DESC
`
@ -159,6 +162,7 @@ func (q *Queries) ListApiServices(ctx context.Context) ([]ApiService, error) {
&i.UpdatedAt,
&i.IsActive,
&i.Description,
&i.IconUrl,
); err != nil {
return nil, err
}
@ -180,7 +184,7 @@ SET
grant_types = $6,
updated_at = NOW()
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, icon_url
`
type UpdateApiServiceParams struct {
@ -214,6 +218,7 @@ func (q *Queries) UpdateApiService(ctx context.Context, arg UpdateApiServicePara
&i.UpdatedAt,
&i.IsActive,
&i.Description,
&i.IconUrl,
)
return i, err
}

View File

@ -22,6 +22,7 @@ type ApiService struct {
UpdatedAt time.Time `json:"updated_at"`
IsActive bool `json:"is_active"`
Description *string `json:"description"`
IconUrl *string `json:"icon_url"`
}
type User struct {