feat: read_all for post, post_interaction, comment_interaction, comment

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-12-05 02:47:51 +03:00
parent dca2abb62a
commit 1aa1d8cb1e
4 changed files with 60 additions and 0 deletions

View file

@ -72,3 +72,18 @@ pub async fn delete(
.fetch_one(database_connection)
.await
}
pub async fn read_all(
poster_id: i64,
database_connection: &Pool<Postgres>,
) -> Result<Vec<Post>, sqlx::Error> {
sqlx::query_as!(
Post,
r#"
SELECT * FROM "post" WHERE "poster_id" = $1
"#,
poster_id
)
.fetch_all(database_connection)
.await
}