Skip to content

Commit

Permalink
move repoOwner to query paramter
Browse files Browse the repository at this point in the history
Signed-off-by: allenshen <[email protected]>
  • Loading branch information
AllenShen committed Mar 15, 2022
1 parent 241effe commit 9355eb2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 25 deletions.
14 changes: 7 additions & 7 deletions pkg/microservice/aslan/core/code/handler/codehost.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func CodeHostGetProjectsList(c *gin.Context) {

namespaceType := c.DefaultQuery("type", "group")
codehostID := c.Param("codehostId")
namespace := c.Param("namespace")
namespace := c.Query("namespace")

if codehostID == "" {
ctx.Err = e.ErrInvalidParam.AddDesc("empty codehostId")
Expand Down Expand Up @@ -121,8 +121,8 @@ func CodeHostGetBranchList(c *gin.Context) {
defer func() { internalhandler.JSONResponse(c, ctx) }()

codehostID := c.Param("codehostId")
namespace := c.Param("namespace")
projectName := c.Param("projectName") // pro Name, id/name -> gitlab = id
namespace := c.Query("namespace")
projectName := c.Query("projectName") // pro Name, id/name -> gitlab = id
args := new(CodeHostGetPageNateListArgs)
if err := c.ShouldBindQuery(args); err != nil {
ctx.Err = e.ErrInvalidParam.AddDesc(err.Error())
Expand Down Expand Up @@ -158,8 +158,8 @@ func CodeHostGetTagList(c *gin.Context) {
defer func() { internalhandler.JSONResponse(c, ctx) }()

codehostID := c.Param("codehostId")
namespace := c.Param("namespace")
projectName := c.Param("projectName") // pro Name, id/name -> gitlab = id
namespace := c.Query("namespace")
projectName := c.Query("projectName") // pro Name, id/name -> gitlab = id
args := new(CodeHostGetPageNateListArgs)
if err := c.ShouldBindQuery(args); err != nil {
ctx.Err = e.ErrInvalidParam.AddDesc(err.Error())
Expand Down Expand Up @@ -187,8 +187,8 @@ func CodeHostGetPRList(c *gin.Context) {
defer func() { internalhandler.JSONResponse(c, ctx) }()

codehostID := c.Param("codehostId")
namespace := c.Param("namespace")
projectName := c.Param("projectName") // pro Name, id/name -> gitlab = id
namespace := c.Query("namespace")
projectName := c.Query("projectName") // pro Name, id/name -> gitlab = id

args := new(CodeHostGetPageNateListArgs)
if err := c.ShouldBindQuery(args); err != nil {
Expand Down
12 changes: 5 additions & 7 deletions pkg/microservice/aslan/core/code/handler/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ func (*Router) Inject(router *gin.RouterGroup) {
{
codehost.GET("", GetCodeHostList)
codehost.GET("/:codehostId/namespaces", CodeHostGetNamespaceList)
codehost.GET("/:codehostId/namespaces/:namespace/projects", CodeHostGetProjectsList)
codehost.GET("/:codehostId/namespaces/:namespace/projects/:projectName/branches", CodeHostGetBranchList)
codehost.GET("/:codehostId/namespaces/:namespace/projects/:projectName/tags", CodeHostGetTagList)
codehost.GET("/:codehostId/namespaces/:namespace/projects/:projectName/prs", CodeHostGetPRList)
codehost.GET("/:codehostId/namespaces/projects", CodeHostGetProjectsList)
codehost.GET("/:codehostId/namespaces/projects/branches", CodeHostGetBranchList)
codehost.GET("/:codehostId/namespaces/projects/tags", CodeHostGetTagList)
codehost.GET("/:codehostId/namespaces/projects/prs", CodeHostGetPRList)
codehost.PUT("/infos", ListRepoInfos)
codehost.POST("/branches/regular/check", MatchBranchesList)
}
Expand All @@ -44,11 +44,9 @@ func (*Router) Inject(router *gin.RouterGroup) {
{
workspace.DELETE("", GetProductNameByWorkspacePipeline, gin2.UpdateOperationLogStatus, CleanWorkspace)
workspace.GET("/file", GetWorkspaceFile)
//workspace.GET("/git/:codehostId/:repoName/:branchName/:remoteName", GetGitRepoInfo)
workspace.GET("/git/:codehostId/:repoName", GetGitRepoInfo)
workspace.GET("/git/:codehostId", GetGitRepoInfo)

workspace.GET("/tree", GetRepoTree)
//workspace.GET("/codehub/:codehostId/:repoUUID/:branchName", GetCodehubRepoInfo)
workspace.GET("/codehub/:codehostId/:repoUUID", GetCodehubRepoInfo)
}

Expand Down
8 changes: 1 addition & 7 deletions pkg/microservice/aslan/core/code/handler/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package handler

import (
"net/url"
"strconv"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -94,16 +93,11 @@ func GetGitRepoInfo(c *gin.Context) {
return
}

repoName := c.Param("repoName")
repoName := c.Query("repoName")
if repoName == "" {
ctx.Err = e.ErrInvalidParam.AddDesc("empty repo name")
return
}
repoName, err = url.QueryUnescape(repoName)
if err != nil {
ctx.Err = e.ErrInvalidParam.AddDesc("repoName decode error")
return
}

branchName := c.Query("branchName")
if branchName == "" {
Expand Down
1 change: 0 additions & 1 deletion pkg/microservice/aslan/core/service/handler/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func ValidateServiceUpdate(c *gin.Context) {
return
}

//branchName := c.Param("branchName")
branchName := c.Query("branchName")

path := c.Query("path")
Expand Down
3 changes: 0 additions & 3 deletions pkg/microservice/aslan/core/service/handler/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ func (*Router) Inject(router *gin.RouterGroup) {

loader := router.Group("loader")
{
//loader.GET("/preload/:codehostId/:branchName", PreloadServiceTemplate)
loader.GET("/preload/:codehostId", PreloadServiceTemplate)
//loader.POST("/load/:codehostId/:branchName", LoadServiceTemplate)
loader.POST("/load/:codehostId", LoadServiceTemplate)
//loader.GET("/validateUpdate/:codehostId/:branchName", ValidateServiceUpdate)
loader.GET("/validateUpdate/:codehostId", ValidateServiceUpdate)
}

Expand Down

0 comments on commit 9355eb2

Please sign in to comment.