diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-29 19:28:48 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-29 19:28:48 -0500 |
commit | ac58a612a3fe928793b77c592551fdd962b69064 (patch) | |
tree | c746d9325a88447e3149891a2435bcb1f3ece67a /src/types/post.rs | |
parent | no mass rerendering html plus logging fix (diff) | |
download | xssbook-ac58a612a3fe928793b77c592551fdd962b69064.tar.gz xssbook-ac58a612a3fe928793b77c592551fdd962b69064.tar.bz2 xssbook-ac58a612a3fe928793b77c592551fdd962b69064.zip |
admin page
Diffstat (limited to 'src/types/post.rs')
-rw-r--r-- | src/types/post.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/types/post.rs b/src/types/post.rs index 90eada2..7397009 100644 --- a/src/types/post.rs +++ b/src/types/post.rs @@ -51,6 +51,14 @@ impl Post { } #[instrument()] + pub fn reterieve_all() -> Result<Vec<Self>> { + let Ok(posts) = database::posts::get_all_posts() else { + return Err(ResponseCode::InternalServerError.text("Failed to fetch posts")) + }; + Ok(posts) + } + + #[instrument()] pub fn new(user_id: u64, content: String) -> Result<Self> { let Ok(post) = database::posts::add_post(user_id, &content) else { tracing::error!("Failed to create post"); |