fix: implement get_all_reviews_for_user, add crate metadata
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:
2026-06-09 02:12:35 +02:00
parent d867a14b28
commit 7bcbc59587
3 changed files with 31 additions and 4 deletions

View File

@@ -586,9 +586,23 @@ impl ReviewRepository for PostgresRepository {
async fn get_all_reviews_for_user(
&self,
_user_id: &UserId,
user_id: &UserId,
) -> 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()
}
}

View File

@@ -578,9 +578,20 @@ impl ReviewRepository for SqliteMovieRepository {
async fn get_all_reviews_for_user(
&self,
_user_id: &UserId,
user_id: &UserId,
) -> 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()
}
}