Skip to content

Commit

Permalink
Merge pull request #78 from konflux-ci/move-signup
Browse files Browse the repository at this point in the history
Move signup handlers to their own package
  • Loading branch information
Omeramsc authored Sep 5, 2024
2 parents d57e3df + 40a86dd commit 8307325
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
16 changes: 3 additions & 13 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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(
Expand Down
22 changes: 22 additions & 0 deletions pkg/handlers/signup/dummy/handlers.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 8307325

Please sign in to comment.