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