Fix version number editing
This commit is contained in:
parent
d2094e2b68
commit
62f1e39e6e
@ -206,6 +206,7 @@ fn convert_version(data: database::models::version_item::QueryVersion) -> models
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct EditVersion {
|
||||
pub name: Option<String>,
|
||||
pub version_number: Option<String>,
|
||||
pub changelog: Option<String>,
|
||||
pub version_type: Option<models::mods::VersionType>,
|
||||
pub dependencies: Option<Vec<models::ids::VersionId>>,
|
||||
@ -298,6 +299,21 @@ pub async fn version_edit(
|
||||
.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 {
|
||||
let channel = database::models::ids::ChannelId::get_id(
|
||||
version_type.as_str(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user