You've already forked AstralRinth
forked from didirus/AstralRinth
Merge pull request #136 from modrinth/small-fixes
Fix version number editing
This commit is contained in:
@@ -1236,6 +1236,19 @@
|
|||||||
"nullable": []
|
"nullable": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"53a8966ac345cc334ad65ea907be81af74e90b1217696c7eedcf8a8e3fca736e": {
|
||||||
|
"query": "\n UPDATE versions\n SET version_number = $1\n WHERE (id = $2)\n ",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Varchar",
|
||||||
|
"Int8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"5564434408e4b88ff1bdd14e0d32a35136e5ee0c837655fbde7d3ca9182dc25b": {
|
"5564434408e4b88ff1bdd14e0d32a35136e5ee0c837655fbde7d3ca9182dc25b": {
|
||||||
"query": "\n SELECT tm.id, tm.team_id, tm.user_id, tm.role, tm.permissions, tm.accepted FROM mods m\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND user_id = $2 AND accepted = TRUE\n WHERE m.id = $1\n ",
|
"query": "\n SELECT tm.id, tm.team_id, tm.user_id, tm.role, tm.permissions, tm.accepted FROM mods m\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND user_id = $2 AND accepted = TRUE\n WHERE m.id = $1\n ",
|
||||||
"describe": {
|
"describe": {
|
||||||
|
|||||||
@@ -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