|
|
|
@ -10,11 +10,14 @@ import (
|
|
|
|
|
"expvar" |
|
|
|
|
"net/http" |
|
|
|
|
|
|
|
|
|
"forge.chapril.org/armen/jw" |
|
|
|
|
"forge.chapril.org/mls-361/jsonapi" |
|
|
|
|
|
|
|
|
|
"forge.chapril.org/armen/armen/internal/components" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
//_maxBodySize = 1024 * 4
|
|
|
|
|
_maxBodySize = 1024 * 32 |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
type api struct { |
|
|
|
@ -28,7 +31,13 @@ func newAPI(model components.Model) *api {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (api *api) createJob(rw http.ResponseWriter, r *http.Request) { |
|
|
|
|
rw.WriteHeader(http.StatusOK) |
|
|
|
|
job := new(jw.Job) |
|
|
|
|
|
|
|
|
|
if err := jsonapi.Decode(rw, r, _maxBodySize, job); err != nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_, _ = api.model.CreateJob(job) // Bad or Internal ?
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Build(router components.Router, model components.Model) { |
|
|
|
|