Browse Source

En cours de développement

master
mls-361 1 month ago
parent
commit
dade722e12
  1. 2
      go.mod
  2. 4
      go.sum
  3. 22
      internal/api/api.go

2
go.mod

@ -11,7 +11,7 @@ require (
forge.chapril.org/mls-361/application v0.0.0-20210507222412-1e7c647c76cd
forge.chapril.org/mls-361/crypto v0.0.0-20210507222429-aa9bfa212956
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507235532-6f8ca43c1463
forge.chapril.org/mls-361/jsonapi v0.0.0-20210510124030-8dfcd685a7d1
forge.chapril.org/mls-361/logger v0.0.0-20210507222454-9faceb920b06
forge.chapril.org/mls-361/uuid v0.0.0-20210411123640-49d47af267ff
github.com/julienschmidt/httprouter v1.3.0

4
go.sum

@ -20,8 +20,8 @@ forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140 h1:uBp4Uz62/
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140/go.mod h1:GBBbrcpLm0Hww05AoFQJY3tTXbNBOQPqV+qTFEWpL20=
forge.chapril.org/mls-361/fqdn v0.0.0-20210507222326-a85c3c19b9af h1:TbPVsBz8TYVmyqcrskFWlheyapWsuNrCVd6HedWuRjc=
forge.chapril.org/mls-361/fqdn v0.0.0-20210507222326-a85c3c19b9af/go.mod h1:AFGBvcK+UEZ9riVN+xN0suL8mVhBrxQIMKK39EX434s=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507235532-6f8ca43c1463 h1:i/vUEM88RqWk9S5q64ugtOLXIVzc6Jq3YE1QXD5eELM=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507235532-6f8ca43c1463/go.mod h1:h7tNGoefr353rJRCt3O5fOMSMCfD8xzMX/ADulKMdq8=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210510124030-8dfcd685a7d1 h1:9ZwUpY+ZDfoswHQwSaJkLD5BVkfzAHXq2comAfHA0pg=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210510124030-8dfcd685a7d1/go.mod h1:h7tNGoefr353rJRCt3O5fOMSMCfD8xzMX/ADulKMdq8=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210507213839-4f18d8b29e73 h1:OKwxmpmkdhy9SWwZcJrz7Fp57LWpY/PNloHdFiDc4Ek=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210507213839-4f18d8b29e73/go.mod h1:bv44R0CAd8lQV4ub1hjLE3kWYwpfsW4Ro9zRnD4YOMU=
forge.chapril.org/mls-361/logger v0.0.0-20210507222454-9faceb920b06 h1:8+774tb3VA3VOgzM5I42JqXUqCRf/q9sMsEwuTqEXuM=

22
internal/api/api.go

@ -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))
}
/*

Loading…
Cancel
Save