Update project version

This commit is contained in:
simon987 2019-02-28 21:45:33 -05:00
parent 67c67090cf
commit 31359b1770
3 changed files with 6 additions and 0 deletions

View File

@ -155,6 +155,7 @@ type UpdateProjectRequest struct {
Paused bool `json:"paused"` Paused bool `json:"paused"`
AssignRate rate.Limit `json:"assign_rate"` AssignRate rate.Limit `json:"assign_rate"`
SubmitRate rate.Limit `json:"submit_rate"` SubmitRate rate.Limit `json:"submit_rate"`
Version string `json:"version"`
} }
func (req *UpdateProjectRequest) isValid(pid int64) bool { func (req *UpdateProjectRequest) isValid(pid int64) bool {

View File

@ -178,6 +178,7 @@ func (api *WebAPI) UpdateProject(r *Request) {
Paused: updateReq.Paused, Paused: updateReq.Paused,
AssignRate: updateReq.AssignRate, AssignRate: updateReq.AssignRate,
SubmitRate: updateReq.SubmitRate, SubmitRate: updateReq.SubmitRate,
Version: updateReq.Version,
} }
sess := api.Session.StartFasthttp(r.Ctx) sess := api.Session.StartFasthttp(r.Ctx)
manager := sess.Get("manager") manager := sess.Get("manager")

View File

@ -137,6 +137,7 @@ func TestUpdateProjectValid(t *testing.T) {
Paused: true, Paused: true,
AssignRate: 1, AssignRate: 1,
SubmitRate: 2, SubmitRate: 2,
Version: "VersionB",
}, pid, testAdminCtx) }, pid, testAdminCtx)
if updateResp.Ok != true { if updateResp.Ok != true {
@ -157,6 +158,9 @@ func TestUpdateProjectValid(t *testing.T) {
if proj.Project.GitRepo != "GitRepoB" { if proj.Project.GitRepo != "GitRepoB" {
t.Error() t.Error()
} }
if proj.Project.Version != "VersionB" {
t.Error()
}
if proj.Project.Priority != 2 { if proj.Project.Priority != 2 {
t.Error() t.Error()
} }