add: circle stacks

This commit is contained in:
trisua 2025-06-15 16:09:02 -04:00
parent 50704d27a9
commit 56cea83933
27 changed files with 419 additions and 107 deletions

View file

@ -124,6 +124,10 @@ pub async fn create_request(
};
} else {
props.title = req.title;
props.stack = match req.stack.parse::<usize>() {
Ok(x) => x,
Err(e) => return Json(Error::MiscError(e.to_string()).into()),
};
}
// check sizes
@ -197,18 +201,23 @@ pub async fn create_repost_request(
None => return Json(Error::NotAllowed.into()),
};
match data
.create_post(Post::repost(
req.content,
match req.community.parse::<usize>() {
Ok(x) => x,
Err(e) => return Json(Error::MiscError(e.to_string()).into()),
},
user.id,
id,
))
.await
{
let mut props = Post::repost(
req.content,
match req.community.parse::<usize>() {
Ok(x) => x,
Err(e) => return Json(Error::MiscError(e.to_string()).into()),
},
user.id,
id,
);
props.stack = match req.stack.parse::<usize>() {
Ok(x) => x,
Err(e) => return Json(Error::MiscError(e.to_string()).into()),
};
// ...
match data.create_post(props).await {
Ok(id) => Json(ApiReturn {
ok: true,
message: "Post reposted".to_string(),