add: polls backend

TODO: polls frontend
This commit is contained in:
trisua 2025-06-03 23:35:34 -04:00
parent b5e060e8ae
commit 4dfa09207e
18 changed files with 574 additions and 17 deletions

View file

@ -358,6 +358,24 @@ impl DataManager {
return Err(Error::DatabaseError(e.to_string()));
}
// delete polls
let res = execute!(&conn, "DELETE FROM polls WHERE owner = $1", &[&(id as i64)]);
if let Err(e) = res {
return Err(Error::DatabaseError(e.to_string()));
}
// delete poll votes
let res = execute!(
&conn,
"DELETE FROM pollvotes WHERE owner = $1",
&[&(id as i64)]
);
if let Err(e) = res {
return Err(Error::DatabaseError(e.to_string()));
}
// delete user follows... individually since it requires updating user counts
for follow in self.get_userfollows_by_receiver_all(id).await? {
self.delete_userfollow(follow.id, &user, true).await?;