validation: golang public fields must be upper case gg
This commit is contained in:
parent
1d545f4413
commit
03e71f09fc
@ -4,30 +4,33 @@
|
|||||||
// Requests are sent from maps-service to validator
|
// Requests are sent from maps-service to validator
|
||||||
// Validation invokes the REST api to update the submissions
|
// Validation invokes the REST api to update the submissions
|
||||||
|
|
||||||
|
#[allow(nonstandard_style)]
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct ValidateRequest{
|
pub struct ValidateRequest{
|
||||||
// submission_id is passed back in the response message
|
// submission_id is passed back in the response message
|
||||||
pub submission_id:i64,
|
pub SubmissionID:i64,
|
||||||
pub model_id:u64,
|
pub ModelID:u64,
|
||||||
pub model_version:u64,
|
pub ModelVersion:u64,
|
||||||
pub validated_model_id:Option<u64>,
|
pub ValidatedModelID:Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new map
|
// Create a new map
|
||||||
|
#[allow(nonstandard_style)]
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct PublishNewRequest{
|
pub struct PublishNewRequest{
|
||||||
pub submission_id:i64,
|
pub SubmissionID:i64,
|
||||||
pub model_id:u64,
|
pub ModelID:u64,
|
||||||
pub model_version:u64,
|
pub ModelVersion:u64,
|
||||||
pub creator:String,
|
pub Creator:String,
|
||||||
pub display_name:String,
|
pub DisplayName:String,
|
||||||
//games:HashSet<GameID>,
|
//games:HashSet<GameID>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(nonstandard_style)]
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct PublishFixRequest{
|
pub struct PublishFixRequest{
|
||||||
pub submission_id:i64,
|
pub SubmissionID:i64,
|
||||||
pub model_id:u64,
|
pub ModelID:u64,
|
||||||
pub model_version:u64,
|
pub ModelVersion:u64,
|
||||||
pub target_asset_id:u64,
|
pub TargetAssetID:u64,
|
||||||
}
|
}
|
||||||
|
@ -52,13 +52,13 @@ impl Publisher{
|
|||||||
|
|
||||||
// download the map model version
|
// download the map model version
|
||||||
let model_data=self.roblox_cookie.get_asset(rbx_asset::cookie::GetAssetRequest{
|
let model_data=self.roblox_cookie.get_asset(rbx_asset::cookie::GetAssetRequest{
|
||||||
asset_id:publish_info.model_id,
|
asset_id:publish_info.ModelID,
|
||||||
version:Some(publish_info.model_version),
|
version:Some(publish_info.ModelVersion),
|
||||||
}).await.map_err(PublishError::Get)?;
|
}).await.map_err(PublishError::Get)?;
|
||||||
|
|
||||||
// upload the map to the strafesnet group
|
// upload the map to the strafesnet group
|
||||||
let upload_response=self.roblox_cookie.create(rbx_asset::cookie::CreateRequest{
|
let upload_response=self.roblox_cookie.create(rbx_asset::cookie::CreateRequest{
|
||||||
name:publish_info.display_name,
|
name:publish_info.DisplayName,
|
||||||
description:"".to_owned(),
|
description:"".to_owned(),
|
||||||
ispublic:false,
|
ispublic:false,
|
||||||
allowComments:false,
|
allowComments:false,
|
||||||
@ -70,7 +70,7 @@ impl Publisher{
|
|||||||
|
|
||||||
// mark submission as published
|
// mark submission as published
|
||||||
self.api.action_submission_publish(
|
self.api.action_submission_publish(
|
||||||
api::SubmissionID(publish_info.submission_id)
|
api::SubmissionID(publish_info.SubmissionID)
|
||||||
).await.map_err(PublishError::ApiActionSubmissionPublish)?;
|
).await.map_err(PublishError::ApiActionSubmissionPublish)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -69,8 +69,8 @@ impl Validator{
|
|||||||
|
|
||||||
// download map
|
// download map
|
||||||
let data=self.roblox_cookie.get_asset(rbx_asset::cookie::GetAssetRequest{
|
let data=self.roblox_cookie.get_asset(rbx_asset::cookie::GetAssetRequest{
|
||||||
asset_id:validate_info.model_id,
|
asset_id:validate_info.ModelID,
|
||||||
version:Some(validate_info.model_version),
|
version:Some(validate_info.ModelVersion),
|
||||||
}).await.map_err(ValidateError::Get)?;
|
}).await.map_err(ValidateError::Get)?;
|
||||||
|
|
||||||
// decode dom (slow!)
|
// decode dom (slow!)
|
||||||
@ -149,7 +149,7 @@ impl Validator{
|
|||||||
rbx_binary::to_writer(&mut data,&dom,&[dom.root_ref()]).map_err(ValidateError::WriteDom)?;
|
rbx_binary::to_writer(&mut data,&dom,&[dom.root_ref()]).map_err(ValidateError::WriteDom)?;
|
||||||
|
|
||||||
// upload a model lol
|
// 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
|
// upload to existing id
|
||||||
let response=self.roblox_cookie.upload(rbx_asset::cookie::UploadRequest{
|
let response=self.roblox_cookie.upload(rbx_asset::cookie::UploadRequest{
|
||||||
assetid:model_id,
|
assetid:model_id,
|
||||||
@ -176,7 +176,7 @@ impl Validator{
|
|||||||
|
|
||||||
// update the submission to use the validated model
|
// update the submission to use the validated model
|
||||||
self.api.update_submission_model(api::UpdateSubmissionModelRequest{
|
self.api.update_submission_model(api::UpdateSubmissionModelRequest{
|
||||||
ID:validate_info.submission_id,
|
ID:validate_info.SubmissionID,
|
||||||
ModelID:model_id,
|
ModelID:model_id,
|
||||||
ModelVersion:model_version,
|
ModelVersion:model_version,
|
||||||
}).await.map_err(ValidateError::ApiUpdateSubmissionModel)?;
|
}).await.map_err(ValidateError::ApiUpdateSubmissionModel)?;
|
||||||
@ -184,7 +184,7 @@ impl Validator{
|
|||||||
|
|
||||||
// update the submission model status to validated
|
// update the submission model status to validated
|
||||||
self.api.action_submission_validate(
|
self.api.action_submission_validate(
|
||||||
api::SubmissionID(validate_info.submission_id)
|
api::SubmissionID(validate_info.SubmissionID)
|
||||||
).await.map_err(ValidateError::ApiActionSubmissionValidate)?;
|
).await.map_err(ValidateError::ApiActionSubmissionValidate)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user