|
|
|
@ -89,6 +89,27 @@ func (api *api) nextJob(r *jsonapi.Request) {
|
|
|
|
|
r.RenderJSON(http.StatusOK, job, api.logger) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (api *api) updateJob(r *jsonapi.Request) { |
|
|
|
|
job := new(jw.Job) |
|
|
|
|
|
|
|
|
|
if r.Decode(_maxBodySize, job) != nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
job, err := api.model.UpdateJob(job) |
|
|
|
|
if err != nil { |
|
|
|
|
r.InternalServerError(err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if job == nil { |
|
|
|
|
r.RenderAccepted() |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
r.RenderJSON(http.StatusOK, job, api.logger) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Build(ccs *components.Components) { |
|
|
|
|
api := newAPI(ccs) |
|
|
|
|
router := ccs.Router |
|
|
|
@ -99,6 +120,7 @@ func Build(ccs *components.Components) {
|
|
|
|
|
|
|
|
|
|
router.Post("/job/create", api.debug(api.createJob)) |
|
|
|
|
router.Get("/job/next/:namespace", api.trace(api.nextJob)) |
|
|
|
|
router.Post("/job/update", api.debug(api.updateJob)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|