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(
post_creation_time: DateTime<Utc>,
database_connection: &Pool<Postgres>,
) -> Result<Vec<Comment>, sqlx::Error> {
sqlx::query_as!(
Comment,
r#"
SELECT * FROM "comment" WHERE "post_creation_time" = $1
"#,
post_creation_time
)
.fetch_all(database_connection)
.await
}