Skip to content

Commit

Permalink
Merge pull request #37 from geode-sdk/resubmitting
Browse files Browse the repository at this point in the history
Pending version resubmitting
  • Loading branch information
Fleeym authored Jan 6, 2025
2 parents 922df22 + 2e5d352 commit f358ec8
Show file tree
Hide file tree
Showing 15 changed files with 500 additions and 142 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/endpoints/mod_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ pub async fn create_version(
let dev = auth.developer()?;
let mut pool = data.db.acquire().await.or(Err(ApiError::DbAcquireError))?;

let fetched_mod = Mod::get_one(&path.id, true, &mut pool).await?;
let fetched_mod = Mod::get_one(&path.id, false, &mut pool).await?;

if fetched_mod.is_none() {
return Err(ApiError::NotFound(format!("Mod {} not found", path.id)));
Expand Down
21 changes: 21 additions & 0 deletions src/types/models/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ impl Dependency {
Ok(())
}

pub async fn clear_for_mod_version(
id: i32,
pool: &mut PgConnection
) -> Result<(), ApiError> {
sqlx::query!(
"DELETE FROM dependencies
WHERE dependent_id = $1",
id
)
.execute(&mut *pool)
.await
.map(|_| ())
.map_err(|err| {
log::error!(
"Failed to remove dependencies for mod version {}: {}",
id, err
);
ApiError::DbError
})
}

pub async fn get_for_mod_versions(
ids: &Vec<i32>,
platform: Option<VerPlatform>,
Expand Down
21 changes: 21 additions & 0 deletions src/types/models/incompatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@ impl Incompatibility {
Ok(())
}

pub async fn clear_for_mod_version(
id: i32,
pool: &mut PgConnection
) -> Result<(), ApiError> {
sqlx::query!(
"DELETE FROM incompatibilities
WHERE mod_id = $1",
id
)
.execute(&mut *pool)
.await
.map(|_| ())
.map_err(|err| {
log::error!(
"Failed to remove incompatibilities for mod version {}: {}",
id, err
);
ApiError::DbError
})
}

pub async fn get_for_mod_version(
id: i32,
pool: &mut PgConnection,
Expand Down
Loading

0 comments on commit f358ec8

Please sign in to comment.