fix: implement get_all_reviews_for_user, add crate metadata
Some checks failed
CI / Check / Test (push) Failing after 43s
Some checks failed
CI / Check / Test (push) Failing after 43s
Replace todo!() stubs in sqlite/postgres adapters with actual queries. Add description+license to presentation crate.
This commit is contained in:
@@ -586,9 +586,23 @@ impl ReviewRepository for PostgresRepository {
|
|||||||
|
|
||||||
async fn get_all_reviews_for_user(
|
async fn get_all_reviews_for_user(
|
||||||
&self,
|
&self,
|
||||||
_user_id: &UserId,
|
user_id: &UserId,
|
||||||
) -> Result<Vec<Review>, DomainError> {
|
) -> Result<Vec<Review>, DomainError> {
|
||||||
todo!()
|
let uid = user_id.value().to_string();
|
||||||
|
sqlx::query_as::<_, ReviewRow>(
|
||||||
|
"SELECT id, movie_id, user_id, rating, comment,
|
||||||
|
to_char(watched_at AT TIME ZONE 'UTC', 'YYYY-MM-DD HH24:MI:SS') AS watched_at,
|
||||||
|
to_char(created_at AT TIME ZONE 'UTC', 'YYYY-MM-DD HH24:MI:SS') AS created_at,
|
||||||
|
remote_actor_url
|
||||||
|
FROM reviews WHERE user_id = $1 ORDER BY watched_at DESC",
|
||||||
|
)
|
||||||
|
.bind(&uid)
|
||||||
|
.fetch_all(&self.pool)
|
||||||
|
.await
|
||||||
|
.map_err(Self::map_err)?
|
||||||
|
.into_iter()
|
||||||
|
.map(ReviewRow::into_domain)
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -578,9 +578,20 @@ impl ReviewRepository for SqliteMovieRepository {
|
|||||||
|
|
||||||
async fn get_all_reviews_for_user(
|
async fn get_all_reviews_for_user(
|
||||||
&self,
|
&self,
|
||||||
_user_id: &UserId,
|
user_id: &UserId,
|
||||||
) -> Result<Vec<Review>, DomainError> {
|
) -> Result<Vec<Review>, DomainError> {
|
||||||
todo!()
|
let uid = user_id.value().to_string();
|
||||||
|
sqlx::query_as::<_, ReviewRow>(
|
||||||
|
"SELECT id, movie_id, user_id, rating, comment, watched_at, created_at, remote_actor_url
|
||||||
|
FROM reviews WHERE user_id = ? ORDER BY watched_at DESC",
|
||||||
|
)
|
||||||
|
.bind(&uid)
|
||||||
|
.fetch_all(&self.pool)
|
||||||
|
.await
|
||||||
|
.map_err(Self::map_err)?
|
||||||
|
.into_iter()
|
||||||
|
.map(ReviewRow::into_domain)
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
name = "presentation"
|
name = "presentation"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
description = "Self-hosted movie diary with REST API and ActivityPub federation"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["sqlite", "sqlite-federation"]
|
default = ["sqlite", "sqlite-federation"]
|
||||||
|
|||||||
Reference in New Issue
Block a user