Skip to content

Commit

Permalink
fix: some lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-hm19 committed Dec 18, 2024
1 parent ecf0c3f commit 4ce8d44
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 69 deletions.
1 change: 1 addition & 0 deletions pkg/infra/persistence/variable.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:dulp
package persistence

Check failure on line 2 in pkg/infra/persistence/variable.go

View workflow job for this annotation

GitHub Actions / Golang Lint

2-134 lines are duplicate of `pkg/infra/persistence/variable_labels.go:1-134` (dupl)

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/infra/persistence/variable_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type VariableModel struct {
}

// The TableName method returns the name of the database table that the struct is mapped to.
func (vl *VariableModel) TableName() string {
func (v *VariableModel) TableName() string {
return "variable"
}

Expand Down
136 changes: 68 additions & 68 deletions pkg/server/handler/variable/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ import (
logutil "kusionstack.io/kusion/pkg/server/util/logging"
)

// @Id createVariable
// @Summary Create variable
// @Description Create a new variable
// @Tags variable
// @Accept json
// @Produce json
// @Param variable body request.CreateVariableSetRequest true "Created variable"
// @Success 200 {object} entity.Variable "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables [post]
// @Id createVariable
// @Summary Create variable
// @Description Create a new variable
// @Tags variable
// @Accept json
// @Produce json
// @Param variable body request.CreateVariableSetRequest true "Created variable"
// @Success 200 {object} entity.Variable "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables [post]
func (h *Handler) CreateVariable() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
Expand All @@ -48,19 +48,19 @@ func (h *Handler) CreateVariable() http.HandlerFunc {
}
}

// @Id deleteVariable
// @Summary Delete variable
// @Description Delete a specified variable with fqn
// @Tags variable
// @Produce json
// @Param fqn path string true "Variable Fqn"
// @Success 200 {object} string "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables/{fqn} [delete]
// @Id deleteVariable
// @Summary Delete variable
// @Description Delete a specified variable with fqn
// @Tags variable
// @Produce json
// @Param fqn path string true "Variable Fqn"
// @Success 200 {object} string "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables/{fqn} [delete]
func (h *Handler) DeleteVariable() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
Expand All @@ -76,21 +76,21 @@ func (h *Handler) DeleteVariable() http.HandlerFunc {
}
}

// @Id updateVariable
// @Summary Update variable
// @Description Update the specified variable
// @Tags variable
// @Accept json
// @Produce json
// @Param fqn path string true "Variable Fqn"
// @Param variable body request.UpdateVariableRequest true "Updated Variable"
// @Success 200 {object} entity.Variable "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables/{fqn} [put]
// @Id updateVariable
// @Summary Update variable
// @Description Update the specified variable
// @Tags variable
// @Accept json
// @Produce json
// @Param fqn path string true "Variable Fqn"
// @Param variable body request.UpdateVariableRequest true "Updated Variable"
// @Success 200 {object} entity.Variable "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables/{fqn} [put]
func (h *Handler) UpdateVariable() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
Expand All @@ -114,19 +114,19 @@ func (h *Handler) UpdateVariable() http.HandlerFunc {
}
}

// @Id getVariable
// @Summary Get variable
// @Description Get variable by variable fqn
// @Tags variable
// @Produce json
// @Param fqn path string true "Variable Fqn"
// @Success 200 {object} entity.Variable "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables/{fqn} [get]
// @Id getVariable
// @Summary Get variable
// @Description Get variable by variable fqn
// @Tags variable
// @Produce json
// @Param fqn path string true "Variable Fqn"
// @Success 200 {object} entity.Variable "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables/{fqn} [get]
func (h *Handler) GetVariable() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
Expand All @@ -142,19 +142,19 @@ func (h *Handler) GetVariable() http.HandlerFunc {
}
}

// @Id listVariables
// @Summary List variables
// @Description List variables
// @Tags variable
// @Produce json
// @Param variable body request.ListVariableSetRequest true "Variable labels to filter variables by."
// @Success 200 {object} entity.VariableLabelsListResult "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables [get]
// @Id listVariables
// @Summary List variables
// @Description List variables
// @Tags variable
// @Produce json
// @Param variable body request.ListVariableSetRequest true "Variable labels to filter variables by."
// @Success 200 {object} entity.VariableLabelsListResult "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/variables [get]
func (h *Handler) ListVariables() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
Expand Down

0 comments on commit 4ce8d44

Please sign in to comment.