completed is implicitly true
This commit is contained in:
parent
1119c91da3
commit
680c21ca11
@ -142,11 +142,6 @@ paths:
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- name: Completed
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
"200":
|
||||
description: Successful response
|
||||
|
@ -454,24 +454,6 @@ func (c *Client) sendPatchSubmissionCompleted(ctx context.Context, params PatchS
|
||||
pathParts[2] = "/completed"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeQueryParams"
|
||||
q := uri.NewQueryEncoder()
|
||||
{
|
||||
// Encode "Completed" parameter.
|
||||
cfg := uri.QueryParameterEncodingConfig{
|
||||
Name: "Completed",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.BoolToString(params.Completed))
|
||||
}); err != nil {
|
||||
return res, errors.Wrap(err, "encode query")
|
||||
}
|
||||
}
|
||||
u.RawQuery = q.Values().Encode()
|
||||
|
||||
stage = "EncodeRequest"
|
||||
r, err := ht.NewRequest(ctx, "PATCH", u)
|
||||
if err != nil {
|
||||
|
@ -465,10 +465,6 @@ func (s *Server) handlePatchSubmissionCompletedRequest(args [1]string, argsEscap
|
||||
Name: "SubmissionID",
|
||||
In: "path",
|
||||
}: params.SubmissionID,
|
||||
{
|
||||
Name: "Completed",
|
||||
In: "query",
|
||||
}: params.Completed,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
@ -179,7 +179,6 @@ func decodeListSubmissionsParams(args [0]string, argsEscaped bool, r *http.Reque
|
||||
// PatchSubmissionCompletedParams is parameters of patchSubmissionCompleted operation.
|
||||
type PatchSubmissionCompletedParams struct {
|
||||
SubmissionID int64
|
||||
Completed bool
|
||||
}
|
||||
|
||||
func unpackPatchSubmissionCompletedParams(packed middleware.Parameters) (params PatchSubmissionCompletedParams) {
|
||||
@ -190,18 +189,10 @@ func unpackPatchSubmissionCompletedParams(packed middleware.Parameters) (params
|
||||
}
|
||||
params.SubmissionID = packed[key].(int64)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "Completed",
|
||||
In: "query",
|
||||
}
|
||||
params.Completed = packed[key].(bool)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodePatchSubmissionCompletedParams(args [1]string, argsEscaped bool, r *http.Request) (params PatchSubmissionCompletedParams, _ error) {
|
||||
q := uri.NewQueryDecoder(r.URL.Query())
|
||||
// Decode path: SubmissionID.
|
||||
if err := func() error {
|
||||
param := args[0]
|
||||
@ -247,42 +238,6 @@ func decodePatchSubmissionCompletedParams(args [1]string, argsEscaped bool, r *h
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode query: Completed.
|
||||
if err := func() error {
|
||||
cfg := uri.QueryParameterDecodingConfig{
|
||||
Name: "Completed",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToBool(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.Completed = c
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "Completed",
|
||||
In: "query",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ func (svc *Service) ListSubmissions(ctx context.Context, request api.ListSubmiss
|
||||
// PATCH /submissions/{SubmissionID}/completed
|
||||
func (svc *Service) PatchSubmissionCompleted(ctx context.Context, params api.PatchSubmissionCompletedParams) error {
|
||||
pmap := datastore.Optional()
|
||||
pmap.AddNotNil("completed", params.Completed)
|
||||
pmap.Add("completed", true)
|
||||
err := svc.DB.Submissions().Update(ctx, params.SubmissionID, pmap)
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user