fix migrate api
This commit is contained in:
parent
e5b105e513
commit
7ec991326d
|
@ -236,7 +236,6 @@ func runWeb(ctx *cli.Context) {
|
||||||
m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
|
m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
|
||||||
}, middleware.ApiReqToken())
|
}, middleware.ApiReqToken())
|
||||||
|
|
||||||
// TODO: https://github.com/gogits/go-gogs-client/wiki
|
|
||||||
m.Group("/:username/:reponame", func() {
|
m.Group("/:username/:reponame", func() {
|
||||||
m.Combo("/hooks").Get(v1.ListRepoHooks).
|
m.Combo("/hooks").Get(v1.ListRepoHooks).
|
||||||
Post(bind(api.CreateHookOption{}), v1.CreateRepoHook)
|
Post(bind(api.CreateHookOption{}), v1.CreateRepoHook)
|
||||||
|
|
|
@ -32,14 +32,14 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
|
||||||
}
|
}
|
||||||
|
|
||||||
type MigrateRepoForm struct {
|
type MigrateRepoForm struct {
|
||||||
CloneAddr string `binding:"Required"`
|
CloneAddr string `json:"clone_addr" binding:"Required"`
|
||||||
AuthUsername string
|
AuthUsername string `json:"auth_username"`
|
||||||
AuthPassword string
|
AuthPassword string `json:"auth_password"`
|
||||||
Uid int64 `binding:"Required"`
|
Uid int64 `json:"uid" binding:"Required"`
|
||||||
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||||
Private bool
|
Private bool `json:"mirror"`
|
||||||
Mirror bool
|
Mirror bool `json:"private"`
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `json:"description" binding:"MaxSize(255)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||||
|
|
|
@ -251,5 +251,5 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
|
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
|
||||||
ctx.WriteHeader(200)
|
ctx.JSON(201, ToApiRepository(ctxUser, repo, api.Permission{true, true, true}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue