feat: goals — "watch N movies in YEAR" with progress bar

Domain: Goal entity, UserSettings (federation toggle), RemoteGoalEntry.
Ports: GoalRepository, UserSettingsRepository, RemoteGoalRepository.
Adapters: sqlite + postgres repos, migrations, AP content query extensions.
Application: CRUD use cases (create/update/delete/get/list), settings use cases.
API: 7 endpoints (/goals CRUD, /users/{id}/goals, /settings) with utoipa docs.
Federation: GoalObject (Note + goal discriminator), outbound broadcast with
per-user toggle, inbound GoalObjectHandler in CompositeObjectHandler.
SPA: API client + hooks, GoalCard (shadcn Card+Progress+DropdownMenu),
GoalSheet (Drawer), profile integration (editable own, read-only others),
federation toggle in settings (Switch).
Classic HTML: glassmorphic goal card on profile, Frutiger Aero styling.
Progress computed from existing reviews — backwards compatible.
This commit is contained in:
2026-06-08 22:37:52 +02:00
parent 213f9a2433
commit fff5f4af2f
67 changed files with 2747 additions and 28 deletions

View File

@@ -18,6 +18,12 @@ pub mod watchlist;
pub use watchlist::{WatchlistEntry, WatchlistWithMovie};
pub mod remote_watchlist;
pub use remote_watchlist::RemoteWatchlistEntry;
pub mod goal;
pub use goal::{Goal, GoalWithProgress};
pub mod user_settings;
pub use user_settings::UserSettings;
pub mod remote_goal;
pub use remote_goal::RemoteGoalEntry;
pub mod watch_event;
pub mod wrapup;
pub use watch_event::{
@@ -38,6 +44,32 @@ pub use search::{
SearchResults,
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum GoalType {
Movies,
}
impl GoalType {
pub fn as_str(&self) -> &'static str {
match self {
Self::Movies => "movies",
}
}
}
impl std::str::FromStr for GoalType {
type Err = DomainError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"movies" => Ok(Self::Movies),
other => Err(DomainError::ValidationError(format!(
"Unknown goal type: {other}"
))),
}
}
}
#[derive(Clone, Debug, Default)]
pub enum SortDirection {
#[default]