From 03e71f09fcdb095e5a791b9bb965019860c9c62e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 10 Dec 2024 19:59:15 -0800 Subject: [PATCH] validation: golang public fields must be upper case gg --- validation/src/nats_types.rs | 29 ++++++++++++++++------------- validation/src/publish_new.rs | 8 ++++---- validation/src/validator.rs | 10 +++++----- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/validation/src/nats_types.rs b/validation/src/nats_types.rs index a7f945d..04085cb 100644 --- a/validation/src/nats_types.rs +++ b/validation/src/nats_types.rs @@ -4,30 +4,33 @@ // Requests are sent from maps-service to validator // Validation invokes the REST api to update the submissions +#[allow(nonstandard_style)] #[derive(serde::Deserialize)] pub struct ValidateRequest{ // submission_id is passed back in the response message - pub submission_id:i64, - pub model_id:u64, - pub model_version:u64, - pub validated_model_id:Option, + pub SubmissionID:i64, + pub ModelID:u64, + pub ModelVersion:u64, + pub ValidatedModelID:Option, } // Create a new map +#[allow(nonstandard_style)] #[derive(serde::Deserialize)] pub struct PublishNewRequest{ - pub submission_id:i64, - pub model_id:u64, - pub model_version:u64, - pub creator:String, - pub display_name:String, + pub SubmissionID:i64, + pub ModelID:u64, + pub ModelVersion:u64, + pub Creator:String, + pub DisplayName:String, //games:HashSet, } +#[allow(nonstandard_style)] #[derive(serde::Deserialize)] pub struct PublishFixRequest{ - pub submission_id:i64, - pub model_id:u64, - pub model_version:u64, - pub target_asset_id:u64, + pub SubmissionID:i64, + pub ModelID:u64, + pub ModelVersion:u64, + pub TargetAssetID:u64, } diff --git a/validation/src/publish_new.rs b/validation/src/publish_new.rs index e9e803b..31f9b22 100644 --- a/validation/src/publish_new.rs +++ b/validation/src/publish_new.rs @@ -52,13 +52,13 @@ impl Publisher{ // download the map model version let model_data=self.roblox_cookie.get_asset(rbx_asset::cookie::GetAssetRequest{ - asset_id:publish_info.model_id, - version:Some(publish_info.model_version), + asset_id:publish_info.ModelID, + version:Some(publish_info.ModelVersion), }).await.map_err(PublishError::Get)?; // upload the map to the strafesnet group let upload_response=self.roblox_cookie.create(rbx_asset::cookie::CreateRequest{ - name:publish_info.display_name, + name:publish_info.DisplayName, description:"".to_owned(), ispublic:false, allowComments:false, @@ -70,7 +70,7 @@ impl Publisher{ // mark submission as published self.api.action_submission_publish( - api::SubmissionID(publish_info.submission_id) + api::SubmissionID(publish_info.SubmissionID) ).await.map_err(PublishError::ApiActionSubmissionPublish)?; Ok(()) diff --git a/validation/src/validator.rs b/validation/src/validator.rs index bef895e..23aebd9 100644 --- a/validation/src/validator.rs +++ b/validation/src/validator.rs @@ -69,8 +69,8 @@ impl Validator{ // download map let data=self.roblox_cookie.get_asset(rbx_asset::cookie::GetAssetRequest{ - asset_id:validate_info.model_id, - version:Some(validate_info.model_version), + asset_id:validate_info.ModelID, + version:Some(validate_info.ModelVersion), }).await.map_err(ValidateError::Get)?; // decode dom (slow!) @@ -149,7 +149,7 @@ impl Validator{ rbx_binary::to_writer(&mut data,&dom,&[dom.root_ref()]).map_err(ValidateError::WriteDom)?; // upload a model lol - let (model_id,model_version)=if let Some(model_id)=validate_info.validated_model_id{ + let (model_id,model_version)=if let Some(model_id)=validate_info.ValidatedModelID{ // upload to existing id let response=self.roblox_cookie.upload(rbx_asset::cookie::UploadRequest{ assetid:model_id, @@ -176,7 +176,7 @@ impl Validator{ // update the submission to use the validated model self.api.update_submission_model(api::UpdateSubmissionModelRequest{ - ID:validate_info.submission_id, + ID:validate_info.SubmissionID, ModelID:model_id, ModelVersion:model_version, }).await.map_err(ValidateError::ApiUpdateSubmissionModel)?; @@ -184,7 +184,7 @@ impl Validator{ // update the submission model status to validated self.api.action_submission_validate( - api::SubmissionID(validate_info.submission_id) + api::SubmissionID(validate_info.SubmissionID) ).await.map_err(ValidateError::ApiActionSubmissionValidate)?; Ok(())