From 0252b487cfa01bd16da74995be0c36c17090b792 Mon Sep 17 00:00:00 2001 From: Chloe <25387744+qimiko@users.noreply.github.com> Date: Sun, 30 Jun 2024 02:36:32 -0700 Subject: [PATCH] add some properties to self mods --- openapi.yml | 10 +++++++++- src/endpoints/developers.rs | 2 ++ src/types/models/mod_entity.rs | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/openapi.yml b/openapi.yml index 7b54408..0145531 100644 --- a/openapi.yml +++ b/openapi.yml @@ -931,7 +931,7 @@ components: $ref: "#/components/schemas/ModID" featured: type: boolean - description: Whether the mod should is featured or not + description: Whether the mod is featured or not example: true download_count: type: integer @@ -955,7 +955,15 @@ components: example: 500 validated: type: boolean + deprecated: true example: true + description: True if the mod is accepted. Deprecated in favor of the status field + status: + $ref: "#/components/schemas/ModVersionStatus" + info: + type: string + nullable: true + description: Information given with the version's status (typically a reason) Platform: type: string diff --git a/src/endpoints/developers.rs b/src/endpoints/developers.rs index e7738b3..10d55b2 100644 --- a/src/endpoints/developers.rs +++ b/src/endpoints/developers.rs @@ -31,6 +31,8 @@ pub struct SimpleDevModVersion { pub version: String, pub download_count: i32, pub validated: bool, + pub info: Option, + pub status: ModVersionStatusEnum, } #[derive(Deserialize)] diff --git a/src/types/models/mod_entity.rs b/src/types/models/mod_entity.rs index a9bff32..3697e29 100644 --- a/src/types/models/mod_entity.rs +++ b/src/types/models/mod_entity.rs @@ -492,12 +492,15 @@ impl Mod { version: String, mod_version_download_count: i32, validated: bool, + status: ModVersionStatusEnum, + info: Option } let mut query_builder: QueryBuilder = QueryBuilder::new( "SELECT m.id, m.featured, m.download_count as mod_download_count, mv.name, mv.version, mv.download_count as mod_version_download_count, + mvs.info, mvs.status, exists( select 1 from mod_version_statuses mvs_inner where mvs_inner.mod_version_id = mv.id and mvs_inner.status = 'accepted' @@ -535,6 +538,8 @@ impl Mod { version: record.version.clone(), download_count: record.mod_version_download_count, validated: record.validated, + info: record.info.clone(), + status: record.status }; versions.entry(record.id.clone()).or_default().push(version);