refactor: remaining MEDIUM — CQRS splits, DI Deps, profile dedup, event Value, response enum

M1: MovieRepository→MovieCommand/MovieQuery, WatchEventRepository→
WatchEventCommand/WatchEventQuery
M2: goals/ and import/ use Deps structs
M7: extract upload_image helper in update_profile
M8: FederationDeliveryRequested activity_json String→serde_json::Value
M11: UserProfileResponse uses ProfileViewData enum
This commit is contained in:
2026-07-10 03:50:43 +02:00
parent 12da356a40
commit dee013c7eb
99 changed files with 1262 additions and 896 deletions

View File

@@ -79,6 +79,14 @@ pub struct UserProfileBase {
pub banner_url: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
#[serde(untagged)]
pub enum ProfileViewData {
Entries { entries: DiaryResponse },
History { history: Vec<MonthActivityDto> },
Trends { trends: UserTrendsDto },
}
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub struct UserProfileResponse {
pub user_id: Uuid,
@@ -87,12 +95,8 @@ pub struct UserProfileResponse {
pub stats: UserStatsDto,
pub following_count: usize,
pub followers_count: usize,
/// Populated for view=recent and view=ratings
pub entries: Option<DiaryResponse>,
/// Populated for view=history
pub history: Option<Vec<MonthActivityDto>>,
/// Populated for view=trends
pub trends: Option<UserTrendsDto>,
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub view_data: Option<ProfileViewData>,
#[serde(skip_serializing_if = "Option::is_none")]
pub goals: Option<Vec<GoalDto>>,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]