Skip to content

Commit

Permalink
add some properties to self mods
Browse files Browse the repository at this point in the history
  • Loading branch information
qimiko committed Jun 30, 2024
1 parent cec0b3e commit 0252b48
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/endpoints/developers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub struct SimpleDevModVersion {
pub version: String,
pub download_count: i32,
pub validated: bool,
pub info: Option<String>,
pub status: ModVersionStatusEnum,
}

#[derive(Deserialize)]
Expand Down
5 changes: 5 additions & 0 deletions src/types/models/mod_entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,15 @@ impl Mod {
version: String,
mod_version_download_count: i32,
validated: bool,
status: ModVersionStatusEnum,
info: Option<String>
}

let mut query_builder: QueryBuilder<Postgres> = 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'
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0252b48

Please sign in to comment.