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

@@ -650,6 +650,75 @@ impl domain::ports::WrapUpRepository for Panic {
}
}
#[async_trait::async_trait]
impl domain::ports::GoalRepository for Panic {
async fn save(&self, _: &domain::models::Goal) -> Result<(), DomainError> {
panic!()
}
async fn update(&self, _: &domain::models::Goal) -> Result<(), DomainError> {
panic!()
}
async fn delete(
&self,
_: &domain::value_objects::GoalId,
_: &domain::value_objects::UserId,
) -> Result<(), DomainError> {
panic!()
}
async fn find_by_user_and_year(
&self,
_: &domain::value_objects::UserId,
_: u16,
) -> Result<Option<domain::models::Goal>, DomainError> {
panic!()
}
async fn list_for_user(
&self,
_: &domain::value_objects::UserId,
) -> Result<Vec<domain::models::Goal>, DomainError> {
panic!()
}
async fn count_reviews_in_year(
&self,
_: &domain::value_objects::UserId,
_: u16,
) -> Result<u32, DomainError> {
panic!()
}
}
#[async_trait::async_trait]
impl domain::ports::UserSettingsRepository for Panic {
async fn get(
&self,
_: &domain::value_objects::UserId,
) -> Result<domain::models::UserSettings, DomainError> {
panic!()
}
async fn save(&self, _: &domain::models::UserSettings) -> Result<(), DomainError> {
panic!()
}
}
#[async_trait::async_trait]
impl domain::ports::RemoteGoalRepository for Panic {
async fn save(&self, _: domain::models::RemoteGoalEntry) -> Result<(), DomainError> {
panic!()
}
async fn update_by_ap_id(&self, _: &str, _: u32, _: u32) -> Result<(), DomainError> {
panic!()
}
async fn remove_by_ap_id(&self, _: &str, _: &str) -> Result<(), DomainError> {
panic!()
}
async fn get_by_actor_url(
&self,
_: &str,
) -> Result<Vec<domain::models::RemoteGoalEntry>, DomainError> {
panic!()
}
}
// --- Single state factory — only auth_service varies ---
pub fn make_test_state(auth_service: Arc<dyn AuthService>) -> crate::state::AppState {
@@ -677,6 +746,9 @@ pub fn make_test_state(auth_service: Arc<dyn AuthService>) -> crate::state::AppS
social_query: Arc::clone(&repo) as _,
wrapup_stats: Arc::clone(&repo) as _,
wrapup_repo: Arc::clone(&repo) as _,
goal: Arc::clone(&repo) as _,
user_settings: Arc::clone(&repo) as _,
remote_goal: Arc::clone(&repo) as _,
},
services: Services {
auth: auth_service,