Cleans up and removes TODOs, adds tests (#844)

* removes version ordering from v2; simplifies now-unecessary three-level faceting

* resolved some todos

* test for game version updating

* merge fixes; display_categories fix
This commit is contained in:
Wyatt Verchere
2024-01-11 18:11:27 -08:00
committed by GitHub
parent 76c885f080
commit ef31c0c0da
24 changed files with 243 additions and 241 deletions

View File

@@ -583,8 +583,6 @@ async fn upload_file_to_version_inner(
};
let all_loaders = models::loader_fields::Loader::list(&mut **transaction, &redis).await?;
// TODO: this coded is reused a lot, it should be refactored into a function
let selected_loaders = version
.loaders
.iter()

View File

@@ -132,7 +132,6 @@ pub async fn get_update_from_hash(
.map(|x| x.1)
.ok();
let hash = info.into_inner().0.to_lowercase();
if let Some(file) = database::models::Version::get_file_from_hash(
hash_query
.algorithm
@@ -185,7 +184,6 @@ pub async fn get_update_from_hash(
}
}
}
Err(ApiError::NotFound)
}

View File

@@ -202,8 +202,12 @@ pub struct EditVersion {
pub downloads: Option<u32>,
pub status: Option<VersionStatus>,
pub file_types: Option<Vec<EditVersionFileType>>,
pub ordering: Option<Option<i32>>, //TODO: How do you actually pass this in json?
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "::serde_with::rust::double_option"
)]
pub ordering: Option<Option<i32>>,
// Flattened loader fields
// All other fields are loader-specific VersionFields
@@ -220,8 +224,6 @@ pub struct EditVersionFileType {
pub file_type: Option<FileType>,
}
// TODO: Avoid this 'helper' pattern here and similar fnunctoins- a macro might be the best bet here to ensure it's callable from both v2 and v3
// (web::Path can't be recreated naturally)
pub async fn version_edit(
req: HttpRequest,
info: web::Path<(VersionId,)>,