Skip to content

Commit

Permalink
Merge pull request #77 from gbenhaim/move-type
Browse files Browse the repository at this point in the history
Move Signup* types to their own package
  • Loading branch information
gbenhaim authored Sep 5, 2024
2 parents 4f3d064 + c50c1af commit d57e3df
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN go mod download

# Copy the go source
COPY cmd/main.go cmd/main.go
COPY pkg pkg

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager cmd/main.go
Expand Down
21 changes: 5 additions & 16 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,9 @@ import (

crt "github.com/codeready-toolchain/api/api/v1alpha1"
"k8s.io/client-go/kubernetes"
)

type SignupStatusReason = string

var SignedUp SignupStatusReason = "SignedUp"

type SignupStatus struct {
Ready bool `json:"ready"`
Reason SignupStatusReason `json:"reason"`
}

type Signup struct {
SignupStatus SignupStatus `json:"status"`
}
"github.com/konflux-ci/workspace-manager/pkg/api/v1alpha1"
)

var (
scheme = runtime.NewScheme()
Expand Down Expand Up @@ -215,10 +204,10 @@ func main() {
})

e.GET("/api/v1/signup", func(c echo.Context) error {
resp := &Signup{
SignupStatus: SignupStatus{
resp := &v1alpha1.Signup{
SignupStatus: v1alpha1.SignupStatus{
Ready: true,
Reason: SignedUp,
Reason: v1alpha1.SignedUp,
},
}
return c.JSON(http.StatusOK, resp)
Expand Down
14 changes: 14 additions & 0 deletions pkg/api/v1alpha1/usersignup_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package v1alpha1

type SignupStatusReason = string

var SignedUp SignupStatusReason = "SignedUp"

type SignupStatus struct {
Ready bool `json:"ready"`
Reason SignupStatusReason `json:"reason"`
}

type Signup struct {
SignupStatus SignupStatus `json:"status"`
}

0 comments on commit d57e3df

Please sign in to comment.