You've already forked AstralRinth
forked from didirus/AstralRinth
Fix version number editing
This commit is contained in:
@@ -206,6 +206,7 @@ fn convert_version(data: database::models::version_item::QueryVersion) -> models
|
|||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct EditVersion {
|
pub struct EditVersion {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
pub version_number: Option<String>,
|
||||||
pub changelog: Option<String>,
|
pub changelog: Option<String>,
|
||||||
pub version_type: Option<models::mods::VersionType>,
|
pub version_type: Option<models::mods::VersionType>,
|
||||||
pub dependencies: Option<Vec<models::ids::VersionId>>,
|
pub dependencies: Option<Vec<models::ids::VersionId>>,
|
||||||
@@ -298,6 +299,21 @@ pub async fn version_edit(
|
|||||||
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(number) = &new_version.version_number {
|
||||||
|
sqlx::query!(
|
||||||
|
"
|
||||||
|
UPDATE versions
|
||||||
|
SET version_number = $1
|
||||||
|
WHERE (id = $2)
|
||||||
|
",
|
||||||
|
number,
|
||||||
|
id as database::models::ids::VersionId,
|
||||||
|
)
|
||||||
|
.execute(&mut *transaction)
|
||||||
|
.await
|
||||||
|
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(version_type) = &new_version.version_type {
|
if let Some(version_type) = &new_version.version_type {
|
||||||
let channel = database::models::ids::ChannelId::get_id(
|
let channel = database::models::ids::ChannelId::get_id(
|
||||||
version_type.as_str(),
|
version_type.as_str(),
|
||||||
|
|||||||
Reference in New Issue
Block a user