You've already forked AstralRinth
forked from didirus/AstralRinth
Add gallery item deletion + making them optional (#224)
This commit is contained in:
@@ -846,6 +846,18 @@
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"2162043897db26d0b55a0652c1a6db66c555f1d148ce69bd0bd0d2122de1bd6a": {
|
||||
"query": "\n DELETE FROM mods_gallery\n WHERE mod_id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"22185b4e3826d5ff4907b66b53ad3d0b64fb0904967c7e4d8d6aa5105b1486f5": {
|
||||
"query": "\n SELECT n.id, n.user_id, n.title, n.text, n.link, n.created, n.read, n.type notification_type,\n STRING_AGG(DISTINCT na.id || ', ' || na.title || ', ' || na.action_route || ', ' || na.action_route_method, ' ,') actions\n FROM notifications n\n LEFT OUTER JOIN notifications_actions na on n.id = na.notification_id\n WHERE n.user_id = $1\n GROUP BY n.id, n.user_id;\n ",
|
||||
"describe": {
|
||||
|
||||
@@ -370,6 +370,16 @@ impl Project {
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
DELETE FROM mods_gallery
|
||||
WHERE mod_id = $1
|
||||
",
|
||||
id as ProjectId
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
DELETE FROM mod_follows
|
||||
|
||||
@@ -185,7 +185,7 @@ struct ProjectCreateData {
|
||||
|
||||
#[validate(length(max = 64))]
|
||||
/// The multipart names of the gallery items to upload
|
||||
pub gallery_items: Vec<String>,
|
||||
pub gallery_items: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
pub struct UploadedFile {
|
||||
@@ -426,8 +426,9 @@ pub async fn project_create_inner(
|
||||
continue;
|
||||
}
|
||||
|
||||
if project_create_data
|
||||
.gallery_items
|
||||
if let Some(gallery_items) = &project_create_data.gallery_items {
|
||||
if
|
||||
gallery_items
|
||||
.iter()
|
||||
.find(|x| *x == name)
|
||||
.is_some()
|
||||
@@ -464,6 +465,7 @@ pub async fn project_create_inner(
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let index = if let Some(i) = versions_map.get(name) {
|
||||
*i
|
||||
|
||||
Reference in New Issue
Block a user