diff --git a/cmd/main.go b/cmd/main.go index 3eaab89..7460770 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -23,7 +23,7 @@ import ( crt "github.com/codeready-toolchain/api/api/v1alpha1" "k8s.io/client-go/kubernetes" - "github.com/konflux-ci/workspace-manager/pkg/api/v1alpha1" + dummysignup "github.com/konflux-ci/workspace-manager/pkg/handlers/signup/dummy" ) var ( @@ -199,19 +199,9 @@ func main() { e.Use(middleware.Logger()) e.Use(middleware.Recover()) - e.POST("/api/v1/signup", func(c echo.Context) error { - return c.String(http.StatusOK, "ok") - }) + e.POST("/api/v1/signup", dummysignup.DummySignupPostHandler) - e.GET("/api/v1/signup", func(c echo.Context) error { - resp := &v1alpha1.Signup{ - SignupStatus: v1alpha1.SignupStatus{ - Ready: true, - Reason: v1alpha1.SignedUp, - }, - } - return c.JSON(http.StatusOK, resp) - }) + e.GET("/api/v1/signup", dummysignup.DummySignupGetHandler) e.GET("/workspaces", func(c echo.Context) error { nameReq, _ := labels.NewRequirement( diff --git a/pkg/handlers/signup/dummy/handlers.go b/pkg/handlers/signup/dummy/handlers.go new file mode 100644 index 0000000..ab3f867 --- /dev/null +++ b/pkg/handlers/signup/dummy/handlers.go @@ -0,0 +1,22 @@ +package dummy + +import ( + "net/http" + + "github.com/konflux-ci/workspace-manager/pkg/api/v1alpha1" + "github.com/labstack/echo/v4" +) + +func DummySignupPostHandler(c echo.Context) error { + return c.String(http.StatusOK, "ok") +} + +func DummySignupGetHandler(c echo.Context) error { + resp := &v1alpha1.Signup{ + SignupStatus: v1alpha1.SignupStatus{ + Ready: true, + Reason: v1alpha1.SignedUp, + }, + } + return c.JSON(http.StatusOK, resp) +}