diff --git a/internal/repository/api_services.sql.go b/internal/repository/api_services.sql.go index e8d9d66..8b5b1fa 100644 --- a/internal/repository/api_services.sql.go +++ b/internal/repository/api_services.sql.go @@ -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 } diff --git a/internal/repository/models.go b/internal/repository/models.go index 008bdda..8ebd95f 100644 --- a/internal/repository/models.go +++ b/internal/repository/models.go @@ -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 { diff --git a/migrations/00010_add_api_service_icon_url.sql b/migrations/00010_add_api_service_icon_url.sql new file mode 100644 index 0000000..72a2f27 --- /dev/null +++ b/migrations/00010_add_api_service_icon_url.sql @@ -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