submissions: convert sentinel value to optional + api v0.6.1 + fix openapi #30
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1833,7 +1833,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "submissions-api"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
|
@ -21,7 +21,7 @@ paths:
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- name: VersionID
|
||||
- name: ValidatedModelVersion
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
|
@ -1096,15 +1096,15 @@ func (c *Client) sendUpdateSubmissionValidatedModel(ctx context.Context, params
|
||||
}
|
||||
}
|
||||
{
|
||||
// Encode "VersionID" parameter.
|
||||
// Encode "ValidatedModelVersion" parameter.
|
||||
cfg := uri.QueryParameterEncodingConfig{
|
||||
Name: "VersionID",
|
||||
Name: "ValidatedModelVersion",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.Int64ToString(params.VersionID))
|
||||
return e.EncodeValue(conv.Int64ToString(params.ValidatedModelVersion))
|
||||
}); err != nil {
|
||||
return res, errors.Wrap(err, "encode query")
|
||||
}
|
||||
|
@ -1369,9 +1369,9 @@ func (s *Server) handleUpdateSubmissionValidatedModelRequest(args [1]string, arg
|
||||
In: "query",
|
||||
}: params.ValidatedModelID,
|
||||
{
|
||||
Name: "VersionID",
|
||||
Name: "ValidatedModelVersion",
|
||||
In: "query",
|
||||
}: params.VersionID,
|
||||
}: params.ValidatedModelVersion,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
@ -1114,9 +1114,9 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
|
||||
// UpdateSubmissionValidatedModelParams is parameters of updateSubmissionValidatedModel operation.
|
||||
type UpdateSubmissionValidatedModelParams struct {
|
||||
// The unique identifier for a submission.
|
||||
SubmissionID int64
|
||||
ValidatedModelID int64
|
||||
VersionID int64
|
||||
SubmissionID int64
|
||||
ValidatedModelID int64
|
||||
ValidatedModelVersion int64
|
||||
}
|
||||
|
||||
func unpackUpdateSubmissionValidatedModelParams(packed middleware.Parameters) (params UpdateSubmissionValidatedModelParams) {
|
||||
@ -1136,10 +1136,10 @@ func unpackUpdateSubmissionValidatedModelParams(packed middleware.Parameters) (p
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "VersionID",
|
||||
Name: "ValidatedModelVersion",
|
||||
In: "query",
|
||||
}
|
||||
params.VersionID = packed[key].(int64)
|
||||
params.ValidatedModelVersion = packed[key].(int64)
|
||||
}
|
||||
return params
|
||||
}
|
||||
@ -1227,10 +1227,10 @@ func decodeUpdateSubmissionValidatedModelParams(args [1]string, argsEscaped bool
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode query: VersionID.
|
||||
// Decode query: ValidatedModelVersion.
|
||||
if err := func() error {
|
||||
cfg := uri.QueryParameterDecodingConfig{
|
||||
Name: "VersionID",
|
||||
Name: "ValidatedModelVersion",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
@ -1247,7 +1247,7 @@ func decodeUpdateSubmissionValidatedModelParams(args [1]string, argsEscaped bool
|
||||
return err
|
||||
}
|
||||
|
||||
params.VersionID = c
|
||||
params.ValidatedModelVersion = c
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
@ -1258,7 +1258,7 @@ func decodeUpdateSubmissionValidatedModelParams(args [1]string, argsEscaped bool
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "VersionID",
|
||||
Name: "ValidatedModelVersion",
|
||||
In: "query",
|
||||
Err: err,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ type ValidateRequest struct {
|
||||
SubmissionID int64
|
||||
ModelID int64
|
||||
ModelVersion int64
|
||||
ValidatedModelID int64 // optional value
|
||||
ValidatedModelID *int64 // optional value
|
||||
}
|
||||
|
||||
// Create a new map
|
||||
|
@ -534,7 +534,12 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
||||
SubmissionID: submission.ID,
|
||||
ModelID: submission.AssetID,
|
||||
ModelVersion: submission.AssetVersion,
|
||||
ValidatedModelID: submission.ValidatedAssetID,
|
||||
ValidatedModelID: nil,
|
||||
}
|
||||
|
||||
// sentinel values because we're not using rust
|
||||
if submission.ValidatedAssetID != 0 {
|
||||
validate_request.ValidatedModelID = &submission.ValidatedAssetID
|
||||
}
|
||||
|
||||
j, err := json.Marshal(validate_request)
|
||||
|
@ -17,7 +17,7 @@ func (svc *Service) UpdateSubmissionValidatedModel(ctx context.Context, params i
|
||||
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
||||
pmap := datastore.Optional()
|
||||
pmap.AddNotNil("validated_asset_id", params.ValidatedModelID)
|
||||
pmap.AddNotNil("validated_asset_version", params.VersionID)
|
||||
pmap.AddNotNil("validated_asset_version", params.ValidatedModelVersion)
|
||||
// DO NOT reset completed when validated model is updated
|
||||
// pmap.Add("completed", false)
|
||||
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusValidating}, pmap)
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "submissions-api"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
edition = "2021"
|
||||
publish = ["strafesnet"]
|
||||
repository = "https://git.itzana.me/StrafesNET/maps-service"
|
||||
|
Loading…
x
Reference in New Issue
Block a user