diff --git a/api/.env.dev b/api/.env.dev index 599005b004..88eac05079 100644 --- a/api/.env.dev +++ b/api/.env.dev @@ -6,11 +6,11 @@ POSTGRES_DB="hub" POSTGRES_USER="postgres" POSTGRES_PASSWORD="postgres" -GH_CLIENT_ID="" -GH_CLIENT_SECRET="" +GH_CLIENT_ID="client-id" +GH_CLIENT_SECRET="client-secret" -JWT_SIGNING_KEY="" -ACCESS_JWT_EXPIRES_IN="" -REFRESH_JWT_EXPIRES_IN="" +JWT_SIGNING_KEY="TektonHub" +ACCESS_JWT_EXPIRES_IN="1s" +REFRESH_JWT_EXPIRES_IN="1s" CONFIG_FILE_URL="file://../config.yaml" \ No newline at end of file diff --git a/api/v1/design/catalog.go b/api/v1/design/catalog.go index 36be456f34..67c5bd8adb 100644 --- a/api/v1/design/catalog.go +++ b/api/v1/design/catalog.go @@ -20,7 +20,7 @@ import ( ) var _ = Service("catalog", func() { - Description("List of catalogs") + Description("The catalog service provides details about catalogs.") HTTP(func() { Path("/v1") diff --git a/api/v1/gen/catalog/service.go b/api/v1/gen/catalog/service.go index 3beb993274..bc459d7b52 100644 --- a/api/v1/gen/catalog/service.go +++ b/api/v1/gen/catalog/service.go @@ -13,7 +13,7 @@ import ( goa "goa.design/goa/v3/pkg" ) -// List of catalogs +// The catalog service provides details about catalogs. type Service interface { // List all Catalogs List(context.Context) (res *ListResult, err error) diff --git a/api/v1/gen/http/cli/hub/cli.go b/api/v1/gen/http/cli/hub/cli.go index 0b683b9e97..7508d4b75f 100644 --- a/api/v1/gen/http/cli/hub/cli.go +++ b/api/v1/gen/http/cli/hub/cli.go @@ -229,7 +229,7 @@ func ParseEndpoint( // catalogUsage displays the usage of the catalog command and its subcommands. func catalogUsage() { - fmt.Fprintf(os.Stderr, `List of catalogs + fmt.Fprintf(os.Stderr, `The catalog service provides details about catalogs. Usage: %s [globalflags] catalog COMMAND [flags] diff --git a/api/v1/service/catalog/catalog.go b/api/v1/service/catalog/catalog.go index 21f347f479..312ffd3dcd 100644 --- a/api/v1/service/catalog/catalog.go +++ b/api/v1/service/catalog/catalog.go @@ -41,8 +41,9 @@ func (s *service) List(ctx context.Context) (*catalog.ListResult, error) { log := s.Logger(ctx) db := s.DB(ctx) + var all []model.Catalog - if err := db.Find(&all).Error; err != nil { + if err := db.Order("id").Find(&all).Error; err != nil { log.Error(err) return nil, internalError } @@ -52,7 +53,13 @@ func (s *service) List(ctx context.Context) (*catalog.ListResult, error) { } for _, c := range all { - res.Data = append(res.Data, &catalog.Catalog{ID: c.ID, Name: c.Name, Type: c.Type, URL: c.URL}) + res.Data = append(res.Data, + &catalog.Catalog{ + ID: c.ID, + Name: c.Name, + Type: c.Type, + URL: c.URL, + }) } return res, nil