Skip to content

Commit b8d3dd2

Browse files
committed
fix(mod_versions): fix get_for_mod
1 parent 1ea3978 commit b8d3dd2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/database/repository/mod_versions.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,23 @@ pub async fn get_for_mod(
9696
statuses: Option<&[ModVersionStatusEnum]>,
9797
conn: &mut PgConnection,
9898
) -> Result<Vec<ModVersion>, ApiError> {
99-
sqlx::query_as(
99+
sqlx::query_as!(
100+
ModVersionRow,
100101
r#"SELECT
101102
mv.id, mv.name, mv.description, mv.version,
102103
mv.download_link, mv.download_count, mv.hash,
103-
mv.geode, mv.early_load, mv.api, mv.mod_id,
104+
format_semver(mv.geode_major, mv.geode_minor, mv.geode_patch, mv.geode_meta) as "geode!: _",
105+
mv.early_load, mv.api, mv.mod_id,
104106
mv.created_at, mv.updated_at,
105-
mvs.status, mvs.info
107+
mvs.status as "status: _", mvs.info
106108
FROM mod_versions mv
107109
INNER JOIN mod_version_statuses mvs ON mvs.mod_version_id = mv.id
108110
WHERE mv.mod_id = $1
109-
AND ($2 IS NULL OR mvs.status = ANY($2))
111+
AND ($2::mod_version_status[] IS NULL OR mvs.status = ANY($2))
110112
ORDER BY mv.id DESC"#,
113+
mod_id,
114+
statuses as Option<&[ModVersionStatusEnum]>
111115
)
112-
.bind(mod_id)
113-
.bind(statuses)
114116
.fetch_all(conn)
115117
.await
116118
.inspect_err(|e| log::error!("{}", e))

0 commit comments

Comments
 (0)