jobqueue: start moving API types to json.go
Similar to `weldr/json.go`, this file will contain structs that are shared between client and server and only meant to be used to serialize from and to JSON. This immediate change allows us to make fields in `Job` private in a future commit.
This commit is contained in:
parent
9a96908c1e
commit
269988a737
4 changed files with 31 additions and 11 deletions
|
|
@ -102,7 +102,7 @@ func (api *API) addJobHandler(writer http.ResponseWriter, request *http.Request,
|
|||
|
||||
writer.WriteHeader(http.StatusCreated)
|
||||
// FIXME: handle or comment this possible error
|
||||
_ = json.NewEncoder(writer).Encode(Job{
|
||||
_ = json.NewEncoder(writer).Encode(addJobResponse{
|
||||
ID: nextJob.ComposeID,
|
||||
ImageBuildID: nextJob.ImageBuildID,
|
||||
Manifest: nextJob.Manifest,
|
||||
|
|
@ -130,7 +130,7 @@ func (api *API) updateJobHandler(writer http.ResponseWriter, request *http.Reque
|
|||
return
|
||||
}
|
||||
|
||||
var body JobStatus
|
||||
var body updateJobRequest
|
||||
err = json.NewDecoder(request.Body).Decode(&body)
|
||||
if err != nil {
|
||||
statusResponseError(writer, http.StatusBadRequest, "invalid status: "+err.Error())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue