feature/spoiler-flag (#25)
Some checks failed
CI / Check / Test (push) Has been cancelled

Reviewed-on: #25
This commit was merged in pull request #25.
This commit is contained in:
2026-10-25 18:52:11 +00:00
parent 9dd9df1f73
commit 4f3d99ec8e
66 changed files with 502 additions and 168 deletions

View File

@@ -39,6 +39,8 @@ pub struct LogReviewForm {
pub watched_at: String,
#[serde(default, deserialize_with = "empty_string_as_none")]
pub watch_medium: Option<String>,
#[serde(default)]
pub spoilers: bool,
#[serde(rename = "_csrf", default)]
pub csrf_token: String,
}
@@ -173,6 +175,7 @@ pub struct LogReviewData {
pub comment: Option<String>,
pub watched_at: NaiveDateTime,
pub watch_medium: Option<domain::value_objects::WatchMedium>,
pub spoilers: bool,
}
#[derive(Debug)]
@@ -212,6 +215,7 @@ impl TryFrom<LogReviewForm> for LogReviewData {
comment: form.comment,
watched_at,
watch_medium,
spoilers: form.spoilers,
})
}
}
@@ -230,6 +234,7 @@ impl TryFrom<LogReviewRequest> for LogReviewData {
comment: req.comment,
watched_at,
watch_medium: req.watch_medium,
spoilers: req.spoilers,
})
}
}
@@ -249,6 +254,7 @@ impl LogReviewData {
comment: self.comment,
watched_at: self.watched_at,
watch_medium: self.watch_medium,
spoilers: self.spoilers,
}
}
}

View File

@@ -137,6 +137,7 @@ pub async fn patch_review(
comment: req.comment,
watched_at,
watch_medium: req.watch_medium,
spoilers: req.spoilers,
};
edit_review::execute(&state.app_ctx.deps.diary.edit_review, cmd).await?;
Ok(StatusCode::OK)

View File

@@ -168,11 +168,13 @@ pub async fn get_movie_detail(
.iter()
.map(|e| SocialReviewDto {
user_display: e.user_display_name().to_string(),
user_id: e.review().user_id().value(),
rating: e.review().rating().value(),
comment: e.review().comment().map(|c| c.value().to_string()),
watched_at: domain::value_objects::format_watched_at(e.review().watched_at()),
is_federated: e.review().is_remote(),
watch_medium: e.review().watch_medium().copied(),
spoilers: e.review().spoilers(),
})
.collect(),
total_count: result.reviews.total_count,

View File

@@ -38,6 +38,7 @@ pub fn review_to_dto(review: &Review) -> ReviewDto {
comment: review.comment().map(|c| c.value().to_string()),
watched_at: domain::value_objects::format_watched_at(review.watched_at()),
watch_medium: review.watch_medium().copied(),
spoilers: review.spoilers(),
}
}

View File

@@ -10,6 +10,7 @@ fn make_form(watched_at: &str) -> LogReviewForm {
comment: None,
watched_at: watched_at.to_string(),
watch_medium: None,
spoilers: false,
csrf_token: String::new(),
}
}
@@ -24,6 +25,7 @@ fn make_request(watched_at: &str) -> LogReviewRequest {
comment: None,
watched_at: watched_at.to_string(),
watch_medium: None,
spoilers: false,
}
}