feat: add icon url to api service
This commit is contained in:
@ -28,7 +28,7 @@ INSERT INTO api_services (
|
|||||||
client_id, client_secret, name, description, redirect_uris, scopes, grant_types, is_active
|
client_id, client_secret, name, description, redirect_uris, scopes, grant_types, is_active
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8
|
$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 {
|
type CreateApiServiceParams struct {
|
||||||
@ -66,6 +66,7 @@ func (q *Queries) CreateApiService(ctx context.Context, arg CreateApiServicePara
|
|||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.IsActive,
|
&i.IsActive,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.IconUrl,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@ -83,7 +84,7 @@ func (q *Queries) DeactivateApiService(ctx context.Context, clientID string) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getApiServiceCID = `-- name: GetApiServiceCID :one
|
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
|
WHERE client_id = $1
|
||||||
AND is_active = true
|
AND is_active = true
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
@ -104,12 +105,13 @@ func (q *Queries) GetApiServiceCID(ctx context.Context, clientID string) (ApiSer
|
|||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.IsActive,
|
&i.IsActive,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.IconUrl,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const getApiServiceId = `-- name: GetApiServiceId :one
|
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
|
WHERE id = $1
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
`
|
`
|
||||||
@ -129,12 +131,13 @@ func (q *Queries) GetApiServiceId(ctx context.Context, id uuid.UUID) (ApiService
|
|||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.IsActive,
|
&i.IsActive,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.IconUrl,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const listApiServices = `-- name: ListApiServices :many
|
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
|
ORDER BY created_at DESC
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -159,6 +162,7 @@ func (q *Queries) ListApiServices(ctx context.Context) ([]ApiService, error) {
|
|||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.IsActive,
|
&i.IsActive,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.IconUrl,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -180,7 +184,7 @@ SET
|
|||||||
grant_types = $6,
|
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, icon_url
|
||||||
`
|
`
|
||||||
|
|
||||||
type UpdateApiServiceParams struct {
|
type UpdateApiServiceParams struct {
|
||||||
@ -214,6 +218,7 @@ func (q *Queries) UpdateApiService(ctx context.Context, arg UpdateApiServicePara
|
|||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.IsActive,
|
&i.IsActive,
|
||||||
&i.Description,
|
&i.Description,
|
||||||
|
&i.IconUrl,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ type ApiService struct {
|
|||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
IsActive bool `json:"is_active"`
|
IsActive bool `json:"is_active"`
|
||||||
Description *string `json:"description"`
|
Description *string `json:"description"`
|
||||||
|
IconUrl *string `json:"icon_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
|
12
migrations/00010_add_api_service_icon_url.sql
Normal file
12
migrations/00010_add_api_service_icon_url.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-- +goose Up
|
||||||
|
-- +goose StatementBegin
|
||||||
|
ALTER TABLE api_services
|
||||||
|
ADD COLUMN icon_url TEXT DEFAULT NULL;
|
||||||
|
|
||||||
|
-- +goose StatementEnd
|
||||||
|
-- +goose Down
|
||||||
|
-- +goose StatementBegin
|
||||||
|
ALTER TABLE api_services
|
||||||
|
DROP COLUMN icon_url;
|
||||||
|
|
||||||
|
-- +goose StatementEnd
|
Reference in New Issue
Block a user