Alexander Belanger пре 4 година
родитељ
комит
a5c1bf5c25
2 измењених фајлова са 31 додато и 3 уклоњено
  1. 28 0
      api/server/router/project.go
  2. 3 3
      docs/developing/backend-refactor-status.md

+ 28 - 0
api/server/router/project.go

@@ -3,6 +3,7 @@ package router
 import (
 	"github.com/go-chi/chi"
 	"github.com/porter-dev/porter/api/server/handlers/cluster"
+	"github.com/porter-dev/porter/api/server/handlers/gitinstallation"
 	"github.com/porter-dev/porter/api/server/handlers/project"
 	"github.com/porter-dev/porter/api/server/shared"
 	"github.com/porter-dev/porter/api/server/shared/config"
@@ -161,5 +162,32 @@ func getProjectRoutes(
 		Router:   r,
 	})
 
+	// GET /api/projects/{project_id}/gitrepos -> gitinstallation.NewGitRepoListHandler
+	listGitReposEndpoint := factory.NewAPIEndpoint(
+		&types.APIRequestMetadata{
+			Verb:   types.APIVerbList,
+			Method: types.HTTPVerbGet,
+			Path: &types.Path{
+				Parent:       basePath,
+				RelativePath: relPath + "/gitrepos",
+			},
+			Scopes: []types.PermissionScope{
+				types.UserScope,
+				types.ProjectScope,
+			},
+		},
+	)
+
+	listGitReposHandler := gitinstallation.NewGitRepoListHandler(
+		config,
+		factory.GetResultWriter(),
+	)
+
+	routes = append(routes, &Route{
+		Endpoint: listGitReposEndpoint,
+		Handler:  listGitReposHandler,
+		Router:   r,
+	})
+
 	return routes, newPath
 }

+ 3 - 3
docs/developing/backend-refactor-status.md

@@ -1,5 +1,5 @@
-| Path                                                                                                                    | Assigned To | Changed schema? | CLI Updated | Frontend Updated |
-|-------------------------------------------------------------------------------------------------------------------------|-------------|-----------------|-------------|------------------|
+| Path                                                                                                                        | Assigned To | Changed schema? | CLI Updated | Frontend Updated |
+| --------------------------------------------------------------------------------------------------------------------------- | ----------- | --------------- | ----------- | ---------------- |
 | <li>- [x] `GET /api/auth/check`                                                                                             |             | yes             |             | yes              |
 | <li>- [x] `GET /api/capabilities`                                                                                           |             |                 |             | yes              |
 | <li>- [x] `GET /api/cli/login`                                                                                              |             |                 | yes         |                  |
@@ -50,7 +50,7 @@
 | <li>- [ ] `POST /api/projects/{project_id}/delete/{name}`                                                                   |             |                 |             |                  |
 | <li>- [ ] `POST /api/projects/{project_id}/deploy/addon/{name}/{version}`                                                   |             |                 |             |                  |
 | <li>- [ ] `POST /api/projects/{project_id}/deploy/{name}/{version}`                                                         |             |                 |             |                  |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos`                                                                         |             |                 |             |                  |
+| <li>- [X] `GET /api/projects/{project_id}/gitrepos`                                                                         | AB          |                 |             |                  |
 | <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos`                                                 |             |                 |             |                  |
 | <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/branches`                  |             |                 |             |                  |
 | <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/buildpack/detect` |             |                 |             |                  |