add: post image uploads (supporter)

This commit is contained in:
trisua 2025-05-11 14:27:55 -04:00
parent ba1f8ef063
commit 70965298b5
18 changed files with 455 additions and 50 deletions

View file

@ -41,6 +41,8 @@ impl DataManager {
dislikes: get!(x->8(i32)) as isize,
// other counts
comment_count: get!(x->9(i32)) as usize,
// ...
uploads: serde_json::from_str(&get!(x->10(String))).unwrap(),
}
}
@ -1038,7 +1040,7 @@ impl DataManager {
let res = execute!(
&conn,
"INSERT INTO posts VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
"INSERT INTO posts VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
params![
&(data.id as i64),
&(data.created as i64),
@ -1053,7 +1055,8 @@ impl DataManager {
},
&0_i32,
&0_i32,
&0_i32
&0_i32,
&serde_json::to_string(&data.uploads).unwrap()
]
);
@ -1148,6 +1151,11 @@ impl DataManager {
}
}
// delete uploads
for upload in y.uploads {
self.delete_upload(upload).await?;
}
// return
Ok(())
}