Commit Graph

86 Commits

Author SHA1 Message Date
a7a11dde08 refactor: split monolithic handlers + testing into domain-grouped modules
Some checks failed
CI / Check / Test (push) Has been cancelled
handlers/api.rs (1706 LOC) + html.rs (1735 LOC) → 12 domain files:
auth, diary, movies, users, search, watchlist, goals, social,
integrations, helpers + existing import/webhook/wrapup/images/rss.

domain/testing.rs (1309 LOC) → testing/ module:
in_memory, fakes, noops, panics, wrapup.

Update README + architecture.mmd with goals feature.
2026-06-08 23:59:23 +02:00
fff5f4af2f 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.
2026-06-08 22:37:52 +02:00
886f26c7dc fix: broadcast AP Update after poster sync to fix missing posters on remote instances
Some checks failed
CI / Check / Test (push) Has been cancelled
New movies had no poster at AP broadcast time (race between poster sync
and ReviewLogged handler). PosterSynced event now fires after sync
completes, triggering Update notes so remote apps get the poster URL.
2026-06-04 23:12:27 +02:00
bd7dc648c4 feat: search reindex, worker improvements, person IDs, user display names
- add admin POST /api/v1/admin/reindex-search endpoint + event-driven handler
- backfill persons from movie_cast/movie_crew into persons table
- paginate person list_page/backfill_from_credits_batch to cap memory
- concurrent worker event dispatch with semaphore (max 8)
- graceful worker shutdown (drain in-flight tasks on SIGINT)
- always ack events, log handler errors as warnings (no infinite retry)
- NATS ack_wait 600s, AtomicBool guard against concurrent reindex
- add username/display_name to UserSummaryDto and users list
- add person_id to CastMemberDto/CrewMemberDto via get_movie_profile use case
- add movie_id to wrapup MovieRef, person_id to wrapup PersonStat
- thread tmdb_person_id through wrapup cast pipeline
- add is_federated to FeedEntryDto
- cap orphaned persons query with LIMIT 500
- add SPA link to classic site footer
2026-06-04 14:43:28 +02:00
bf73d4a695 feat: CORS, role in auth, banner_url, diary sort, cleanup
- CORS layer on API routes via CORS_ORIGINS env var
- role field in login + profile responses
- banner_url in profile response
- diary sort_by: rating_desc/rating_asc/date_asc/date_desc
- UserRole::as_str() to deduplicate role mapping
- typed DTOs for import preview (replace ad-hoc JSON)
- warn on invalid CORS origins
2026-06-04 02:06:51 +02:00
6668ba511c fmt
Some checks failed
CI / Check / Test (push) Failing after 6m32s
2026-06-03 01:38:25 +02:00
f262417971 refactor: rename ImageStorage → ObjectStorage
Some checks failed
CI / Check / Test (push) Failing after 46s
2026-06-03 01:33:08 +02:00
d94ccbe057 refactor: store typed WrapUpReport in domain, serialize in adapters
Some checks failed
CI / Check / Test (push) Failing after 45s
2026-06-03 01:25:16 +02:00
3cec726e3d refactor: move VideoRenderConfig from domain to adapter, inject at construction
Some checks failed
CI / Check / Test (push) Failing after 44s
2026-06-03 01:18:52 +02:00
e8e83d3f16 assets + fmt
Some checks failed
CI / Check / Test (push) Has been cancelled
2026-06-03 01:13:06 +02:00
fc086de7f7 refactor: move DateRange validation to value object, add delete/cleanup
Some checks failed
CI / Check / Test (push) Failing after 40s
2026-06-03 00:58:07 +02:00
241063c914 feat: wrapup date validation, delete endpoint, failed record cleanup
Some checks failed
CI / Check / Test (push) Failing after 41s
2026-06-03 00:54:08 +02:00
d52120d6a9 feat: frutiger aero visual overhaul — backgrounds, glass panels, cast photos, full mosaic
Some checks failed
CI / Check / Test (push) Failing after 42s
2026-06-03 00:34:13 +02:00
bf0350c87a fmt
Some checks failed
CI / Check / Test (push) Failing after 6m39s
2026-06-02 23:50:20 +02:00
1e063b6580 feat: streaming video download via ImageStorage::get_stream
Some checks failed
CI / Check / Test (push) Failing after 41s
2026-06-02 23:45:31 +02:00
efd1214a4c feat: font rendering + logo branding on wrapup slides
Some checks failed
CI / Check / Test (push) Failing after 43s
2026-06-02 23:16:55 +02:00
d45d8aa913 feat: video renderer adapter w/ slides + charts + ffmpeg 2026-06-02 22:31:45 +02:00
7ef8912d69 feat: wrapup worker handler + auto-generate job 2026-06-02 22:13:08 +02:00
59b42ce810 feat: add WrapUpRequested/Completed domain events 2026-06-02 22:06:06 +02:00
a95d831fd1 feat(domain): add WrapUpRecord, WrapUpRepository port 2026-06-02 21:59:47 +02:00
4c75113c4f chore: wire WrapUpStatsQuery panic stub into binaries
Some checks failed
CI / Check / Test (push) Failing after 44s
2026-06-02 21:49:54 +02:00
4df78221a8 feat(domain): add WrapUpStatsQuery port and in-memory fake 2026-06-02 21:42:15 +02:00
e8b2d4f7ee feat(domain): add WrapUpReport model and supporting types 2026-06-02 21:40:43 +02:00
4067dedb28 refactor: add DomainError::Forbidden + centralize error-to-HTTP mapping
Ownership checks (delete_review, confirm/dismiss watch events) now
return Forbidden instead of Unauthorized. Presentation layer maps
DomainError→StatusCode via domain_error_response helper, replacing
verbose per-handler match arms.
2026-06-02 21:00:22 +02:00
28170c95d4 chore: fmt + remove dead federation module
Some checks failed
CI / Check / Test (push) Failing after 5m58s
2026-06-02 20:44:08 +02:00
b9210b6c4e fix: batch N+1 queries in import duplicate check and watch event dismiss
Some checks failed
CI / Check / Test (push) Failing after 5m54s
apply_mapping: 2 batch queries instead of up to 2N per-row lookups
dismiss: single fetch + single update instead of 2N per-event queries
2026-06-02 20:05:15 +02:00
aadad3cfb0 feat: Jellyfin/Plex auto-import via watch queue
Some checks failed
CI / Check / Test (push) Failing after 6m5s
Webhook ingestion from media servers — movies land in a pending
watch queue, user rates and confirms to create diary entries.

- domain: WatchEvent, WebhookToken models, MediaServerParser port
- adapters: jellyfin + plex parser crates, SQLite + Postgres repos
- application: ingest/confirm/dismiss/cleanup use cases, token mgmt
- presentation: webhook endpoints (bearer + query param auth),
  watch queue + integrations settings HTML pages, OpenAPI docs
- worker: WatchEventCleanupJob (daily, 30d retention)

Movie resolution deferred to confirm — single canonical path
through log_review for enrichment, poster fetch, federation.
2026-06-02 17:34:16 +02:00
d1f9f55d4f fix: wire DeliveryRequested federation events — outbound AP delivery was broken
FederationEventBridge silently dropped DeliveryRequested events from k-ap,
so no Create/Delete/Accept activities were pushed to follower inboxes.
Reviews only reached remote instances via outbox backfill (pull), and
deletes never propagated.

Bridge now publishes FederationDeliveryRequested domain events through the
event bus; worker calls ap_service.deliver_to_inbox() to send them.
2026-05-29 12:09:02 +02:00
c3b89f6dc6 refactor: extract business logic from handlers to application layer
Some checks failed
CI / Check / Test (push) Has been cancelled
CI / Release build (push) Has been cancelled
Move domain logic out of 7 handlers into use cases:
- activity feed: FollowingFilter construction
- user profile: social counts + pending followers
- users list: parallel local+remote actor loading
- watchlist page: local-vs-remote branching
- sync_poster: movie lookup + validation
- get_profile: avatar URL construction
- post_register: register+login orchestration

Add SocialQueryPort.{count_following,count_accepted_followers,
get_pending_followers} to AppContext behind federation feature gate.
2026-05-29 11:41:16 +02:00
2355f89bed refactor: fix all clippy warnings properly
- UserProfile struct groups display_name/bio/avatar/banner/also_known_as/profile_fields
- User::from_persistence takes UserProfile (6 args, was 11)
- PersistedReview struct for Review::from_persistence (1 arg, was 8)
- WatchlistApInput struct for watchlist_to_ap_object (1 arg, was 8)
- ActivityPubDeps struct for activitypub::wire (1 arg, was 11)
- FederationRepos type alias for wire() return types
- FeedSortBy: impl std::str::FromStr instead of inherent from_str
- postgres users.rs: row_to_user takes &PgRow like sqlite
- collapse nested ifs in multipart handlers
- type alias for complex return types (image-converter, worker)
- tui: allow large_enum_variant at crate level (pre-existing, unrelated)
2026-05-29 11:19:02 +02:00
68a939f6c4 Refactor code for improved readability and consistency
- Simplified error handling in `PostgresApContentQuery` and `SqliteApContentQuery` by aligning the formatting of `try_get` calls.
- Removed unnecessary line breaks and improved formatting in various repository implementations for better readability.
- Consolidated imports in `lib.rs` and `factory.rs` to maintain a cleaner structure.
- Enhanced consistency in async function signatures across multiple files.
- Updated test helpers and use cases to streamline code and improve clarity.
- Refactored `InMemory` repositories to enhance readability by aligning method implementations.
2026-05-29 10:58:44 +02:00
36d15e1344 fix: AP bugs — backfill mapping, review activity type, also_known_as parse
- BackfillRequested now maps to BackfillFollower domain event (not FollowAccepted);
  worker calls run_backfill_for_follower to send LOCAL content to new follower inbox,
  instead of incorrectly trying to import from an inbox URL as if it were an outbox
- reviews broadcast as Create activity instead of Add (semantically correct)
- also_known_as JSON parse failure logs warning + preserves raw string as single-element
  vec instead of silently returning empty
2026-05-29 10:54:11 +02:00
624cfe5799 feat: migrate k-ap 0.1.10→0.3.1, fix AP gaps
- split FederationRepository into FollowRepository, ActorRepository, BlocklistRepository, ActivityRepository
- RemoteActor: 5 new fields (bio, banner_url, followers_url, following_url, also_known_as)
- ApObjectHandler split: get_local_objects_page/count_local_posts → ApContentReader trait
- builder API: positional args → named setters
- broadcast_create_note/update_note: add ApVisibility + mentioned_inboxes params
- backfill_outbox → import_remote_outbox
- ApUser: also_known_as Option<String> → Vec<String>, new fields

AP gaps fixed:
- add GET /users/{id}/followers + /following with content negotiation
- wire EventPublisher into builder via FederationEventBridge adapter
- add display_name field full stack (domain→DB→API→AP)
- DB-side outbox pagination (get_local_reviews_page)
- set featured_url on ApUser
2026-05-29 10:42:53 +02:00
51bd580a04 watchlist backfill
Some checks failed
CI / Check / Test (push) Failing after 57s
CI / Release build (push) Has been skipped
2026-05-28 03:52:38 +02:00
edc1f6c850 feat: domain mocks, TestContextBuilder, use case tests, factory pattern
- Add test-helpers feature to domain crate with in-memory mocks and panic stubs for all ports
- Add TestContextBuilder to application crate for zero-database test setup
- Add unit tests for log_review, register, login, add_to_watchlist, delete_review use cases
- Extract DatabaseAdapters factory and build_* helpers into presentation/src/factory.rs
- Refactor wire_dependencies() in main.rs to use factory module
2026-05-14 00:41:25 +02:00
e41d85bd7e feat: show user avatars on /users page
All checks were successful
CI / Check / Test / Build (push) Successful in 24m46s
2026-05-13 23:45:19 +02:00
19171806b9 fmt
Some checks failed
CI / Check / Test / Build (push) Has been cancelled
2026-05-13 23:38:57 +02:00
c420826474 fix: update tests for expanded User profile signature 2026-05-13 23:27:36 +02:00
fdd61ae701 feat: refactor user profile handling and integrate ApProfileField structure 2026-05-13 22:59:38 +02:00
815178e6a4 feat(ap): ActivityPub spec compliance and profile completeness
Phase 1 — spec compliance:
- Add AS_PUBLIC constant; add to/cc fields to CreateActivity, DeleteActivity,
  UpdateActivity, AddActivity; populate on all broadcast call sites
- Add @context to outbox CreateActivity items
- Set manuallyApprovesFollowers: true to match actual Pending follow flow
- Gate PermissiveVerifier behind FEDERATION_DEBUG env var
- Add updated timestamp to Person actor JSON
- Improve actor update delivery logging

Phase 2a Batch 1 — AP layer:
- Add /inbox shared inbox route; add endpoints.sharedInbox to Person
- Paginate followers and following collections (20/page, OrderedCollectionPage)

Phase 2a Batch 2 — profile completeness:
- DB migrations: banner_path, also_known_as columns; user_profile_fields table
- ProfileField value object; UserProfileFieldsRepository port
- Banner image upload (stored via image-converter, surfaced as image in Person)
- alsoKnownAs field in Person (account migration support)
- Custom profile fields (up to 4 PropertyValue attachments in Person)
- Profile settings UI: banner preview/upload, alsoKnownAs input, fields form
- PUT /api/v1/profile/fields API endpoint
2026-05-13 22:21:41 +02:00
80983f1ff2 feat: add FollowAccepted domain event 2026-05-13 01:17:26 +02:00
53df90ab1f feat: MovieDto enrichment, movie detail page, PWA, watchlist, watchlist federation 2026-05-13 00:23:45 +02:00
2fd8734d23 fix: close search index consistency gaps (orphan cleanup, discovery indexing, poster sync) 2026-05-12 19:05:22 +02:00
c6770659c5 feat: extensible search engine with person entities (FTS5/tsvector) 2026-05-12 18:47:06 +02:00
763d622601 refactor: move inline tests to separate files via #[path] 2026-05-12 16:39:58 +02:00
00218366da Revert "feat: rename product to Screened, add PRODUCT_NAME constant to domain"
This reverts commit f2e3a876dc.
2026-05-12 16:26:42 +02:00
f2e3a876dc feat: rename product to Screened, add PRODUCT_NAME constant to domain 2026-05-12 15:42:24 +02:00
cea414fe60 refactor: split ImageRefPort into ImageRefCommand and ImageRefQuery 2026-05-12 15:10:49 +02:00
696e3e170c feat: async image conversion service (avif/webp) with backfill 2026-05-12 15:05:28 +02:00
4269eca582 feat: implement movie listing functionality with pagination and search 2026-05-12 13:57:55 +02:00