diff --git a/.env.example b/.env.example index 0fdad9f4..a859bf8b 100644 --- a/.env.example +++ b/.env.example @@ -45,11 +45,11 @@ ALLOW_REGISTRATION=true # PORT=3000 # RATE_LIMIT=60 # SECURE_COOKIES=true -# Handler-level logs come from the `presentation` crate; startup/wiring logs come +# Handler-level logs come from the `http_axum` crate; startup/wiring logs come # from `server`. Include both — `server=info` alone silently drops handler logs. # Crates not named here (adapters, etc.) still log warnings and errors unless -# you set a bare level yourself (e.g. `info,presentation=debug`). -# RUST_LOG=server=info,presentation=info,tower_http=info,worker=info +# you set a bare level yourself (e.g. `info,http_axum=debug`). +# RUST_LOG=server=info,http_axum=info,tower_http=info,worker=info # CORS (for SPA development only) # CORS_ORIGINS=http://localhost:5173 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47d7df88..33661d10 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,13 +43,13 @@ The project follows hexagonal (ports & adapters) architecture. See `architecture **Key rules:** - Presentation handlers never touch repositories directly — all domain logic goes through use cases in the `application` crate -- Application use cases return raw domain data — URL formatting, date display, and view model assembly belong in presentation mappers (`presentation/src/mappers/`) +- Application use cases return raw domain data — URL formatting, date display, and view model assembly belong in presentation mappers (`crates/adapters/http-axum/src/mappers/`) - Use cases called from presentation handlers take a `&FooDeps` struct (registered in `application::Deps`, built by `bootstrap::build_deps`) — never `&AppContext` itself, which `application` cannot even depend on. A few keep individual `Arc` params instead: `enrich_movie` and `request_enrichment` because they are called from adapters rather than handlers, and `diary::log_review` because its one extra dependency comes from `Services` rather than a repository. `wrapup::compute`, `import::cleanup` and `integrations::cleanup` also take individual params, but they are only ever called from jobs. See ADR-0007 for the exact list and why each is legitimate ``` domain → pure types, traits (ports), zero deps application → use cases, orchestration -presentation → Axum handlers, routes, OpenAPI +http-axum → Axum handlers, routes, OpenAPI worker → event consumer, background jobs adapters/* → implements domain ports (sqlite, AP, etc.) spa/ → React SPA (TanStack Router + shadcn/ui) diff --git a/Cargo.lock b/Cargo.lock index d4d6721a..754ef1e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -919,6 +919,7 @@ dependencies = [ "config", "domain", "export", + "http-axum", "image-converter", "importer", "media-server", @@ -926,7 +927,6 @@ dependencies = [ "nats", "object-storage", "poster-fetcher", - "presentation", "rss 0.1.0", "serde_json", "sqlite", @@ -2409,6 +2409,39 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-axum" +version = "0.1.0" +dependencies = [ + "anyhow", + "api-types", + "application", + "askama", + "async-trait", + "axum", + "axum-governor", + "bootstrap", + "bytes", + "chrono", + "chrono-tz", + "domain", + "dotenvy", + "futures", + "infer", + "percent-encoding", + "serde", + "serde_json", + "tokio", + "tower", + "tower-http", + "tracing", + "tracing-subscriber", + "utoipa", + "utoipa-scalar", + "utoipa-swagger-ui", + "uuid", +] + [[package]] name = "http-body" version = "1.0.1" @@ -3983,39 +4016,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "presentation" -version = "0.1.0" -dependencies = [ - "anyhow", - "api-types", - "application", - "async-trait", - "axum", - "axum-governor", - "bootstrap", - "bytes", - "chrono", - "chrono-tz", - "domain", - "dotenvy", - "futures", - "infer", - "percent-encoding", - "serde", - "serde_json", - "template-askama", - "tokio", - "tower", - "tower-http", - "tracing", - "tracing-subscriber", - "utoipa", - "utoipa-scalar", - "utoipa-swagger-ui", - "uuid", -] - [[package]] name = "prettyplease" version = "0.2.37" @@ -4938,8 +4938,8 @@ dependencies = [ "domain", "dotenvy", "futures", + "http-axum", "http-body-util", - "presentation", "rss 0.1.0", "serde_json", "sqlite", @@ -5610,17 +5610,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "template-askama" -version = "0.1.0" -dependencies = [ - "api-types", - "askama", - "chrono", - "domain", - "uuid", -] - [[package]] name = "tendril" version = "0.4.3" diff --git a/Cargo.toml b/Cargo.toml index 8c73152e..ead06304 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ members = [ "crates/adapters/rss", "crates/adapters/sqlite", "crates/adapters/sqlite-federation", - "crates/adapters/template-askama", "crates/adapters/activitypub", "crates/adapters/export", "crates/event-payload", @@ -19,7 +18,7 @@ members = [ "crates/adapters/image-converter", "crates/domain", "crates/bootstrap", - "crates/presentation", + "crates/adapters/http-axum", "crates/server", "crates/tui", "crates/worker", @@ -68,7 +67,7 @@ domain = { path = "crates/domain" } tmdb-enrichment = { path = "crates/adapters/tmdb-enrichment" } application = { path = "crates/application" } bootstrap = { path = "crates/bootstrap" } -presentation = { path = "crates/presentation" } +http-axum = { path = "crates/adapters/http-axum" } auth = { path = "crates/adapters/auth" } metadata = { path = "crates/adapters/metadata" } poster-fetcher = { path = "crates/adapters/poster-fetcher" } @@ -78,7 +77,6 @@ rss = { path = "crates/adapters/rss" } export = { path = "crates/adapters/export" } sqlite = { path = "crates/adapters/sqlite" } sqlite-federation = { path = "crates/adapters/sqlite-federation" } -template-askama = { path = "crates/adapters/template-askama" } activitypub = { path = "crates/adapters/activitypub" } event-payload = { path = "crates/event-payload" } media-server = { path = "crates/adapters/media-server" } diff --git a/Dockerfile b/Dockerfile index 75560c74..1b8d79b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,13 +32,12 @@ COPY crates/adapters/media-server/Cargo.toml crates/adapters/media-server/C COPY crates/adapters/rss/Cargo.toml crates/adapters/rss/Cargo.toml COPY crates/adapters/sqlite/Cargo.toml crates/adapters/sqlite/Cargo.toml COPY crates/adapters/sqlite-federation/Cargo.toml crates/adapters/sqlite-federation/Cargo.toml -COPY crates/adapters/template-askama/Cargo.toml crates/adapters/template-askama/Cargo.toml COPY crates/api-types/Cargo.toml crates/api-types/Cargo.toml COPY crates/application/Cargo.toml crates/application/Cargo.toml COPY crates/adapters/tmdb-enrichment/Cargo.toml crates/adapters/tmdb-enrichment/Cargo.toml COPY crates/domain/Cargo.toml crates/domain/Cargo.toml COPY crates/bootstrap/Cargo.toml crates/bootstrap/Cargo.toml -COPY crates/presentation/Cargo.toml crates/presentation/Cargo.toml +COPY crates/adapters/http-axum/Cargo.toml crates/adapters/http-axum/Cargo.toml COPY crates/server/Cargo.toml crates/server/Cargo.toml COPY crates/tui/Cargo.toml crates/tui/Cargo.toml COPY crates/adapters/image-converter/Cargo.toml crates/adapters/image-converter/Cargo.toml diff --git a/Makefile b/Makefile index 293759fb..ba3f5966 100644 --- a/Makefile +++ b/Makefile @@ -12,26 +12,26 @@ check-appcontext: @echo "✅ No AppContext in application crate" check-handler-deps: - @if grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/presentation/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ + @if grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ echo "❌ hand-built deps struct found in presentation:"; \ - grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/presentation/src --include="*.rs" --exclude-dir=tests; \ + grep -rnE "[A-Za-z0-9_]*Deps(\s*\{|::from\()" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests; \ exit 1; \ fi @echo "✅ No hand-built deps structs in presentation" check-handler-repos: - @if grep -rn "app_ctx\.repos" crates/presentation/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ + @if grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests | grep -q .; then \ echo "❌ app_ctx.repos referenced in presentation:"; \ - grep -rn "app_ctx\.repos" crates/presentation/src --include="*.rs" --exclude-dir=tests; \ + grep -rn "app_ctx\.repos" crates/adapters/http-axum/src --include="*.rs" --exclude-dir=tests; \ exit 1; \ fi @echo "✅ No app_ctx.repos references in presentation" -PRESENTATION_ALLOWED_ADAPTERS := template-askama +PRESENTATION_ALLOWED_ADAPTERS := check-presentation-adapters: - @deps=$$(awk '/^\[dependencies\]/{f=1;next} /^\[/{f=0} f' crates/presentation/Cargo.toml \ + @deps=$$(awk '/^\[dependencies\]/{f=1;next} /^\[/{f=0} f' crates/adapters/http-axum/Cargo.toml \ | sed -n 's/^\([A-Za-z0-9_-]\{1,\}\)[[:space:]]*=.*/\1/p'); \ bad=""; \ for a in $$(ls crates/adapters); do \ @@ -43,7 +43,7 @@ check-presentation-adapters: echo " presentation may name renderers, not reachers — see ADR-0008."; \ exit 1; \ fi; \ - echo "✅ presentation depends on no adapter crate but $(PRESENTATION_ALLOWED_ADAPTERS)" + echo "✅ http-axum depends on no other adapter crate" check-federation-off-social: diff --git a/README.md b/README.md index e57bd204..bc3bf316 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,12 @@ Open `http://localhost:3000`. The HTTP server and background worker start togeth Hexagonal (Ports & Adapters) with Domain-Driven Design: ``` -api-types — shared REST API request/response DTOs (Serialize/Deserialize + utoipa schemas) + HtmlPageContext; used by presentation, tui, and template adapters +api-types — shared REST API request/response DTOs (Serialize/Deserialize + utoipa schemas) + HtmlPageContext; used by http-axum and tui config — typed configuration (defaults, config.toml, legacy env names); loaded once by the binaries bootstrap — composition root: the only crate that names adapters; builds the server router and the worker service domain — pure types and CQRS port traits (MovieCommand/MovieQuery, WatchEventCommand/WatchEventQuery, GoalCommand/GoalQuery, DiaryQuery, PersonCommand/PersonQuery, SearchCommand/SearchPort, SocialCommand/SocialQuery, ImageFetcher, RssFeedRenderer), no external deps except serde application — use cases (commands + queries), business logic orchestration; handlers delegate here for all domain logic; modules: auth, diary, goals, import, integrations, movies, person, search, social, users, watchlist, wrapup -presentation — Axum HTTP router, OpenAPI spec assembly, Swagger UI + Scalar serving; library crate, no binary of its own +adapters/http-axum — Axum HTTP router, OpenAPI spec assembly, Swagger UI + Scalar serving; library crate, no binary of its own server — thin HTTP binary (dotenv, config, bootstrap::build_server, axum::serve); features (federation, nats) forward to bootstrap worker — thin worker binary (bootstrap::build_worker, run until ctrl-c) adapters/ @@ -106,7 +106,6 @@ adapters/ object-storage — stores images (posters + user avatars) on local filesystem or S3-compatible storage image-converter — optional background worker: converts stored images to AVIF or WebP; backfills existing images via a 24h periodic job tmdb-enrichment — TMDb HTTP client implementing MovieEnrichmentClient and PersonEnrichmentClient; event handlers (MovieEnrichmentHandler, PersonEnrichmentHandler) live in the application layer - template-askama — Askama HTML rendering rss — RSS/Atom feed generation export — CSV and JSON diary serialization importer — CSV/TSV/JSON/XLSX parser and column mapper for bulk import @@ -115,7 +114,7 @@ adapters/ nats — NATS Core / JetStream event publisher and consumer activitypub — ActivityPub federation adapter (follow, inbox/outbox, actor); delegates to k-ap for protocol internals sqlite-federation — SQLite-backed federation repository -tui — terminal UI client (ratatui); shares api-types with presentation for typed API access +tui — terminal UI client (ratatui); shares api-types with http-axum for typed API access spa/ — React SPA (TanStack Router + shadcn/ui + Vite); served at /app/ by the backend ``` diff --git a/architecture.mmd b/architecture.mmd index 4e7cc9bd..d8ef6cb0 100644 --- a/architecture.mmd +++ b/architecture.mmd @@ -3,7 +3,7 @@ title: Movies Diary — Hexagonal Architecture --- graph TB subgraph Binaries["Binaries (Composition Root)"] - WEB["presentation
Axum web server
Routes, Handlers, Mappers"] + WEB["http-axum
Axum web server + HTML templates
Routes, Handlers, Mappers"] WORKER["worker
Event consumer
Concurrent dispatch, graceful shutdown"] TUI["tui
Terminal UI"] end @@ -110,7 +110,6 @@ graph TB A_POSTER_SYNC["poster-sync"] end subgraph Presentation["Presentation Helpers"] - A_TEMPLATE["template-askama
HTML templates"] A_RSS["rss
Feed generation"] A_EXPORT["export
CSV/JSON diary"] A_IMPORT["importer
CSV/JSON/XLSX parser"] diff --git a/crates/presentation/Cargo.toml b/crates/adapters/http-axum/Cargo.toml similarity index 95% rename from crates/presentation/Cargo.toml rename to crates/adapters/http-axum/Cargo.toml index bd25a45a..77e1df8e 100644 --- a/crates/presentation/Cargo.toml +++ b/crates/adapters/http-axum/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "presentation" +name = "http-axum" version = "0.1.0" edition.workspace = true description = "Self-hosted movie diary with REST API and ActivityPub federation" @@ -33,7 +33,7 @@ futures = { workspace = true } api-types = { workspace = true } domain = { workspace = true } application = { workspace = true } -template-askama = { workspace = true } +askama = { version = "0.16.0" } utoipa = { version = "5.5.0", features = ["axum_extras", "uuid"] } utoipa-scalar = { version = "0.3.0", features = ["axum"], default-features = false } utoipa-swagger-ui = { version = "9.0.2", features = ["axum", "vendored"] } diff --git a/crates/presentation/src/context.rs b/crates/adapters/http-axum/src/context.rs similarity index 100% rename from crates/presentation/src/context.rs rename to crates/adapters/http-axum/src/context.rs diff --git a/crates/presentation/src/csrf.rs b/crates/adapters/http-axum/src/csrf.rs similarity index 100% rename from crates/presentation/src/csrf.rs rename to crates/adapters/http-axum/src/csrf.rs diff --git a/crates/presentation/src/errors.rs b/crates/adapters/http-axum/src/errors.rs similarity index 100% rename from crates/presentation/src/errors.rs rename to crates/adapters/http-axum/src/errors.rs diff --git a/crates/presentation/src/extractors.rs b/crates/adapters/http-axum/src/extractors.rs similarity index 100% rename from crates/presentation/src/extractors.rs rename to crates/adapters/http-axum/src/extractors.rs diff --git a/crates/presentation/src/forms.rs b/crates/adapters/http-axum/src/forms.rs similarity index 100% rename from crates/presentation/src/forms.rs rename to crates/adapters/http-axum/src/forms.rs diff --git a/crates/presentation/src/handlers/auth.rs b/crates/adapters/http-axum/src/handlers/auth.rs similarity index 99% rename from crates/presentation/src/handlers/auth.rs rename to crates/adapters/http-axum/src/handlers/auth.rs index 0cc2a4e4..e6754dfb 100644 --- a/crates/presentation/src/handlers/auth.rs +++ b/crates/adapters/http-axum/src/handlers/auth.rs @@ -10,6 +10,7 @@ use application::auth::{ commands::RegisterCommand, login as login_uc, queries::LoginCommand, register as register_uc, }; +use crate::html::templates::{LoginTemplate, RegisterTemplate}; use crate::{ csrf::{CsrfToken, secure_flag}, errors::ApiError, @@ -21,7 +22,6 @@ use api_types::HtmlPageContext; use api_types::{ LoginRequest, LoginResponse, LogoutRequest, RefreshRequest, RefreshResponse, RegisterRequest, }; -use template_askama::{LoginTemplate, RegisterTemplate}; // ── HTML helpers ───────────────────────────────────────────────────────────── diff --git a/crates/presentation/src/handlers/diary.rs b/crates/adapters/http-axum/src/handlers/diary.rs similarity index 99% rename from crates/presentation/src/handlers/diary.rs rename to crates/adapters/http-axum/src/handlers/diary.rs index 1327b3cf..f374b7ba 100644 --- a/crates/presentation/src/handlers/diary.rs +++ b/crates/adapters/http-axum/src/handlers/diary.rs @@ -12,6 +12,7 @@ use application::diary::{ queries::GetActivityFeedQuery, }; +use crate::html::templates::{ActivityFeedTemplate, NewReviewTemplate, build_page_items}; use crate::{ csrf::CsrfToken, errors::ApiError, @@ -24,7 +25,6 @@ use api_types::{ ActivityFeedQueryParams, ActivityFeedResponse, DiaryQueryParams, DiaryResponse, EditReviewRequest, ExportQueryParams, LogReviewRequest, }; -use template_askama::{ActivityFeedTemplate, NewReviewTemplate, build_page_items}; use super::helpers::{build_export_response, build_page_context, encode_domain_error}; diff --git a/crates/presentation/src/handlers/goals.rs b/crates/adapters/http-axum/src/handlers/goals.rs similarity index 100% rename from crates/presentation/src/handlers/goals.rs rename to crates/adapters/http-axum/src/handlers/goals.rs diff --git a/crates/presentation/src/handlers/helpers.rs b/crates/adapters/http-axum/src/handlers/helpers.rs similarity index 100% rename from crates/presentation/src/handlers/helpers.rs rename to crates/adapters/http-axum/src/handlers/helpers.rs diff --git a/crates/presentation/src/handlers/images.rs b/crates/adapters/http-axum/src/handlers/images.rs similarity index 100% rename from crates/presentation/src/handlers/images.rs rename to crates/adapters/http-axum/src/handlers/images.rs diff --git a/crates/presentation/src/handlers/import.rs b/crates/adapters/http-axum/src/handlers/import.rs similarity index 99% rename from crates/presentation/src/handlers/import.rs rename to crates/adapters/http-axum/src/handlers/import.rs index 33061e0f..af372f84 100644 --- a/crates/presentation/src/handlers/import.rs +++ b/crates/adapters/http-axum/src/handlers/import.rs @@ -11,6 +11,10 @@ use axum::{ use serde::Deserialize; use std::collections::HashMap; +use crate::html::templates::{ + ImportMappingTemplate, ImportPreviewRow, ImportPreviewTemplate, ImportProfileView, + ImportUploadTemplate, +}; use crate::render::render_page; use application::import::{ apply_mapping as apply_import_mapping, apply_profile_and_map, @@ -28,10 +32,6 @@ use domain::models::{ import::{DomainField, Transform}, }; use domain::value_objects::ImportSessionId; -use template_askama::{ - ImportMappingTemplate, ImportPreviewRow, ImportPreviewTemplate, ImportProfileView, - ImportUploadTemplate, -}; use crate::{ csrf::CsrfToken, diff --git a/crates/presentation/src/handlers/insights.rs b/crates/adapters/http-axum/src/handlers/insights.rs similarity index 100% rename from crates/presentation/src/handlers/insights.rs rename to crates/adapters/http-axum/src/handlers/insights.rs diff --git a/crates/presentation/src/handlers/integrations.rs b/crates/adapters/http-axum/src/handlers/integrations.rs similarity index 96% rename from crates/presentation/src/handlers/integrations.rs rename to crates/adapters/http-axum/src/handlers/integrations.rs index 6325461b..2d6aab44 100644 --- a/crates/presentation/src/handlers/integrations.rs +++ b/crates/adapters/http-axum/src/handlers/integrations.rs @@ -18,11 +18,11 @@ use application::integrations::{ revoke_token as revoke_webhook_token, }; +use crate::html::templates::{IntegrationsTemplate, WatchQueueTemplate}; use crate::{ csrf::CsrfToken, extractors::RequiredCookieUser, forms::ErrorQuery, render::render_page, state::AppState, }; -use template_askama::{IntegrationsTemplate, WatchQueueTemplate}; use super::helpers::{build_page_context, encode_domain_error}; @@ -46,7 +46,7 @@ pub async fn get_integrations_page( .await .unwrap_or_default(); - let token_views: Vec = tokens + let token_views: Vec = tokens .iter() .map(crate::mappers::integrations::webhook_token_view) .collect(); @@ -146,7 +146,7 @@ pub async fn get_watch_queue_page( .await .unwrap_or_default(); - let entries: Vec = events + let entries: Vec = events .iter() .map(crate::mappers::integrations::watch_queue_entry) .collect(); diff --git a/crates/presentation/src/handlers/mod.rs b/crates/adapters/http-axum/src/handlers/mod.rs similarity index 100% rename from crates/presentation/src/handlers/mod.rs rename to crates/adapters/http-axum/src/handlers/mod.rs diff --git a/crates/presentation/src/handlers/movies.rs b/crates/adapters/http-axum/src/handlers/movies.rs similarity index 99% rename from crates/presentation/src/handlers/movies.rs rename to crates/adapters/http-axum/src/handlers/movies.rs index ab54d045..89f74ba0 100644 --- a/crates/presentation/src/handlers/movies.rs +++ b/crates/adapters/http-axum/src/handlers/movies.rs @@ -17,6 +17,7 @@ use application::{ }; use domain::services::review_history::Trend; +use crate::html::templates::MovieDetailTemplate; use crate::{ csrf::CsrfToken, errors::ApiError, @@ -29,7 +30,6 @@ use api_types::{ MovieStatsDto, MoviesQueryParams, MoviesResponse, PaginationQueryParams, ReviewHistoryResponse, SocialFeedResponse, SocialReviewDto, }; -use template_askama::MovieDetailTemplate; use super::helpers::build_page_context; diff --git a/crates/presentation/src/handlers/rss.rs b/crates/adapters/http-axum/src/handlers/rss.rs similarity index 100% rename from crates/presentation/src/handlers/rss.rs rename to crates/adapters/http-axum/src/handlers/rss.rs diff --git a/crates/presentation/src/handlers/search.rs b/crates/adapters/http-axum/src/handlers/search.rs similarity index 100% rename from crates/presentation/src/handlers/search.rs rename to crates/adapters/http-axum/src/handlers/search.rs diff --git a/crates/presentation/src/handlers/social.rs b/crates/adapters/http-axum/src/handlers/social.rs similarity index 98% rename from crates/presentation/src/handlers/social.rs rename to crates/adapters/http-axum/src/handlers/social.rs index 4256d292..b311b686 100644 --- a/crates/presentation/src/handlers/social.rs +++ b/crates/adapters/http-axum/src/handlers/social.rs @@ -6,6 +6,9 @@ use axum::{ }; use uuid::Uuid; +#[cfg(feature = "federation")] +use crate::html::templates::{BlockedActorsTemplate, BlockedDomainsTemplate}; +use crate::html::templates::{FollowersTemplate, FollowingTemplate, RemoteActorData}; use crate::{ csrf::CsrfToken, errors::ApiError, @@ -26,9 +29,6 @@ use api_types::{ #[cfg(feature = "federation")] use api_types::{AddBlockedDomainRequest, BlockedActorResponse, BlockedDomainResponse}; use domain::value_objects::{FollowTarget, InstanceIdentity, SocialActor, SocialIdentity}; -#[cfg(feature = "federation")] -use template_askama::{BlockedActorsTemplate, BlockedDomainsTemplate}; -use template_askama::{FollowersTemplate, FollowingTemplate, RemoteActorData}; use super::helpers::{build_page_context, encode_domain_error}; @@ -917,9 +917,9 @@ pub async fn get_blocked_domains_page( ctx.canonical_url = format!("{}/admin/blocked-domains", state.app_ctx.config.base_url); match state.app_ctx.ap_blocklist.get_blocked_domains().await { Ok(domains) => { - let entries: Vec = domains + let entries: Vec = domains .into_iter() - .map(|d| template_askama::BlockedDomainEntry { + .map(|d| crate::html::templates::BlockedDomainEntry { domain: d.domain, reason: d.reason, blocked_at: d.blocked_at, @@ -1008,9 +1008,9 @@ pub async fn get_blocked_actors_page( .await { Ok(blocked) => { - let entries: Vec = blocked + let entries: Vec = blocked .into_iter() - .map(|a| template_askama::BlockedActorEntry { + .map(|a| crate::html::templates::BlockedActorEntry { url: instance.actor_url_of(&a.identity), handle: a.handle, display_name: a.display_name, diff --git a/crates/presentation/src/handlers/tests/social.rs b/crates/adapters/http-axum/src/handlers/tests/social.rs similarity index 100% rename from crates/presentation/src/handlers/tests/social.rs rename to crates/adapters/http-axum/src/handlers/tests/social.rs diff --git a/crates/presentation/src/handlers/users.rs b/crates/adapters/http-axum/src/handlers/users.rs similarity index 99% rename from crates/presentation/src/handlers/users.rs rename to crates/adapters/http-axum/src/handlers/users.rs index ba5cc638..c6f8034d 100644 --- a/crates/presentation/src/handlers/users.rs +++ b/crates/adapters/http-axum/src/handlers/users.rs @@ -16,6 +16,11 @@ use application::users::{ }; use domain::{errors::DomainError, value_objects::Username}; +use crate::html::templates::{ + EmbedProfileTemplate, MonthlyRatingRow, ProfileSettingsTemplate, ProfileTemplate, + RemoteActorData, RemoteActorDisplay, UserSummaryView, UsersTemplate, bar_height_px, + build_heatmap, build_page_items, +}; use crate::{ csrf::CsrfToken, errors::ApiError, @@ -28,11 +33,6 @@ use api_types::{ ProfileResponse, UserProfileQueryParams, UserProfileResponse, UserStatsDto, UserSummaryDto, UserTrendsDto, UsersResponse, WatchMediumStatDto, }; -use template_askama::{ - EmbedProfileTemplate, MonthlyRatingRow, ProfileSettingsTemplate, ProfileTemplate, - RemoteActorData, RemoteActorDisplay, UserSummaryView, UsersTemplate, bar_height_px, - build_heatmap, build_page_items, -}; use super::goals::goal_with_progress_to_dto; use super::helpers::build_page_context; @@ -502,7 +502,7 @@ struct PaginationInfo { offset: u32, has_more: bool, limit: u32, - page_items: Vec, + page_items: Vec, } fn compute_pagination( @@ -571,7 +571,7 @@ fn build_monthly_rating_rows<'a>( async fn fetch_profile_goals( state: &AppState, user_id: Uuid, -) -> Vec { +) -> Vec { let goals_list = application::goals::list::execute( &state.app_ctx.deps.goals.query, application::goals::queries::ListGoalsQuery { user_id }, @@ -580,7 +580,7 @@ async fn fetch_profile_goals( .unwrap_or_default(); goals_list .iter() - .map(|g| template_askama::GoalViewData { + .map(|g| crate::html::templates::GoalViewData { year: g.goal.year(), target_count: g.goal.target_count(), current_count: g.current_count, diff --git a/crates/presentation/src/handlers/watchlist.rs b/crates/adapters/http-axum/src/handlers/watchlist.rs similarity index 99% rename from crates/presentation/src/handlers/watchlist.rs rename to crates/adapters/http-axum/src/handlers/watchlist.rs index 0f360a41..9854e60f 100644 --- a/crates/presentation/src/handlers/watchlist.rs +++ b/crates/adapters/http-axum/src/handlers/watchlist.rs @@ -18,6 +18,7 @@ use application::{ }; use domain::errors::DomainError; +use crate::html::templates::WatchlistTemplate; use crate::{ csrf::CsrfToken, errors::ApiError, @@ -29,7 +30,6 @@ use api_types::{ AddToWatchlistRequest, PaginationQueryParams, WatchlistEntryDto, WatchlistResponse, WatchlistStatusResponse, }; -use template_askama::WatchlistTemplate; use super::helpers::{build_page_context, encode_error}; diff --git a/crates/presentation/src/handlers/webhook.rs b/crates/adapters/http-axum/src/handlers/webhook.rs similarity index 100% rename from crates/presentation/src/handlers/webhook.rs rename to crates/adapters/http-axum/src/handlers/webhook.rs diff --git a/crates/presentation/src/handlers/wrapup.rs b/crates/adapters/http-axum/src/handlers/wrapup.rs similarity index 99% rename from crates/presentation/src/handlers/wrapup.rs rename to crates/adapters/http-axum/src/handlers/wrapup.rs index 0bb6545a..026dc598 100644 --- a/crates/presentation/src/handlers/wrapup.rs +++ b/crates/adapters/http-axum/src/handlers/wrapup.rs @@ -219,7 +219,7 @@ fn render_wrapup( .take(8) .map(|g| g.count as f64 / genre_max as f64 * 100.0) .collect(); - let tmpl = template_askama::WrapUpPageTemplate { + let tmpl = crate::html::templates::WrapUpPageTemplate { ctx, report, year_label: year.to_string(), diff --git a/crates/adapters/http-axum/src/html/mod.rs b/crates/adapters/http-axum/src/html/mod.rs new file mode 100644 index 00000000..b9a16841 --- /dev/null +++ b/crates/adapters/http-axum/src/html/mod.rs @@ -0,0 +1 @@ +pub mod templates; diff --git a/crates/adapters/template-askama/src/lib.rs b/crates/adapters/http-axum/src/html/templates.rs similarity index 99% rename from crates/adapters/template-askama/src/lib.rs rename to crates/adapters/http-axum/src/html/templates.rs index 5a2b37b6..77e140d6 100644 --- a/crates/adapters/template-askama/src/lib.rs +++ b/crates/adapters/http-axum/src/html/templates.rs @@ -136,7 +136,7 @@ pub struct MovieDetailTemplate<'a> { pub struct WatchlistTemplate<'a> { pub ctx: &'a HtmlPageContext, pub owner_id: uuid::Uuid, - pub display_entries: &'a [crate::WatchlistDisplayEntry], + pub display_entries: &'a [WatchlistDisplayEntry], pub current_offset: u32, pub has_more: bool, pub limit: u32, diff --git a/crates/presentation/src/lib.rs b/crates/adapters/http-axum/src/lib.rs similarity index 93% rename from crates/presentation/src/lib.rs rename to crates/adapters/http-axum/src/lib.rs index 79ba5c97..f7858366 100644 --- a/crates/presentation/src/lib.rs +++ b/crates/adapters/http-axum/src/lib.rs @@ -4,6 +4,7 @@ pub mod errors; pub mod extractors; pub mod forms; pub mod handlers; +pub mod html; pub mod mappers; pub mod openapi; pub mod render; diff --git a/crates/presentation/src/mappers/diary.rs b/crates/adapters/http-axum/src/mappers/diary.rs similarity index 100% rename from crates/presentation/src/mappers/diary.rs rename to crates/adapters/http-axum/src/mappers/diary.rs diff --git a/crates/presentation/src/mappers/import.rs b/crates/adapters/http-axum/src/mappers/import.rs similarity index 94% rename from crates/presentation/src/mappers/import.rs rename to crates/adapters/http-axum/src/mappers/import.rs index f5ce7022..e1230b46 100644 --- a/crates/presentation/src/mappers/import.rs +++ b/crates/adapters/http-axum/src/mappers/import.rs @@ -1,6 +1,6 @@ +use crate::html::templates::{ImportPreviewRow, ImportRowStatus}; use domain::models::AnnotatedRow; use domain::models::import::RowResult; -use template_askama::{ImportPreviewRow, ImportRowStatus}; pub fn annotated_to_preview_row(idx: usize, annotated: &AnnotatedRow) -> ImportPreviewRow { match &annotated.result { diff --git a/crates/presentation/src/mappers/integrations.rs b/crates/adapters/http-axum/src/mappers/integrations.rs similarity index 92% rename from crates/presentation/src/mappers/integrations.rs rename to crates/adapters/http-axum/src/mappers/integrations.rs index f2477fb7..4282eb86 100644 --- a/crates/presentation/src/mappers/integrations.rs +++ b/crates/adapters/http-axum/src/mappers/integrations.rs @@ -1,5 +1,5 @@ +use crate::html::templates::{WatchQueueDisplayEntry, WebhookTokenView}; use domain::models::{WatchEvent, WebhookToken}; -use template_askama::{WatchQueueDisplayEntry, WebhookTokenView}; pub fn webhook_token_view(t: &WebhookToken) -> WebhookTokenView { WebhookTokenView { diff --git a/crates/presentation/src/mappers/mod.rs b/crates/adapters/http-axum/src/mappers/mod.rs similarity index 100% rename from crates/presentation/src/mappers/mod.rs rename to crates/adapters/http-axum/src/mappers/mod.rs diff --git a/crates/presentation/src/mappers/movies.rs b/crates/adapters/http-axum/src/mappers/movies.rs similarity index 100% rename from crates/presentation/src/mappers/movies.rs rename to crates/adapters/http-axum/src/mappers/movies.rs diff --git a/crates/presentation/src/mappers/search.rs b/crates/adapters/http-axum/src/mappers/search.rs similarity index 100% rename from crates/presentation/src/mappers/search.rs rename to crates/adapters/http-axum/src/mappers/search.rs diff --git a/crates/presentation/src/mappers/users.rs b/crates/adapters/http-axum/src/mappers/users.rs similarity index 94% rename from crates/presentation/src/mappers/users.rs rename to crates/adapters/http-axum/src/mappers/users.rs index ee3c0fd8..b9952a9c 100644 --- a/crates/presentation/src/mappers/users.rs +++ b/crates/adapters/http-axum/src/mappers/users.rs @@ -1,7 +1,7 @@ +use crate::html::templates::{RemoteActorData, RemoteActorDisplay, UserSummaryView}; use application::users::get_local_profile::PendingFollowerView; use domain::models::RemoteActorInfo; use domain::models::UserSummary; -use template_askama::{RemoteActorData, RemoteActorDisplay, UserSummaryView}; pub fn user_summary_view(u: &UserSummary) -> UserSummaryView { let name = u diff --git a/crates/presentation/src/mappers/watchlist.rs b/crates/adapters/http-axum/src/mappers/watchlist.rs similarity index 97% rename from crates/presentation/src/mappers/watchlist.rs rename to crates/adapters/http-axum/src/mappers/watchlist.rs index 9ff5b830..00752b47 100644 --- a/crates/presentation/src/mappers/watchlist.rs +++ b/crates/adapters/http-axum/src/mappers/watchlist.rs @@ -1,5 +1,5 @@ +use crate::html::templates::WatchlistDisplayEntry; use domain::models::{RemoteWatchlistEntry, WatchlistWithMovie, collections::Paginated}; -use template_askama::WatchlistDisplayEntry; pub struct WatchlistPageResult { pub display_entries: Vec, diff --git a/crates/presentation/src/openapi/auth.rs b/crates/adapters/http-axum/src/openapi/auth.rs similarity index 100% rename from crates/presentation/src/openapi/auth.rs rename to crates/adapters/http-axum/src/openapi/auth.rs diff --git a/crates/presentation/src/openapi/diary.rs b/crates/adapters/http-axum/src/openapi/diary.rs similarity index 100% rename from crates/presentation/src/openapi/diary.rs rename to crates/adapters/http-axum/src/openapi/diary.rs diff --git a/crates/presentation/src/openapi/goals.rs b/crates/adapters/http-axum/src/openapi/goals.rs similarity index 100% rename from crates/presentation/src/openapi/goals.rs rename to crates/adapters/http-axum/src/openapi/goals.rs diff --git a/crates/presentation/src/openapi/import.rs b/crates/adapters/http-axum/src/openapi/import.rs similarity index 100% rename from crates/presentation/src/openapi/import.rs rename to crates/adapters/http-axum/src/openapi/import.rs diff --git a/crates/presentation/src/openapi/insights.rs b/crates/adapters/http-axum/src/openapi/insights.rs similarity index 100% rename from crates/presentation/src/openapi/insights.rs rename to crates/adapters/http-axum/src/openapi/insights.rs diff --git a/crates/presentation/src/openapi/mod.rs b/crates/adapters/http-axum/src/openapi/mod.rs similarity index 100% rename from crates/presentation/src/openapi/mod.rs rename to crates/adapters/http-axum/src/openapi/mod.rs diff --git a/crates/presentation/src/openapi/movies.rs b/crates/adapters/http-axum/src/openapi/movies.rs similarity index 100% rename from crates/presentation/src/openapi/movies.rs rename to crates/adapters/http-axum/src/openapi/movies.rs diff --git a/crates/presentation/src/openapi/search.rs b/crates/adapters/http-axum/src/openapi/search.rs similarity index 100% rename from crates/presentation/src/openapi/search.rs rename to crates/adapters/http-axum/src/openapi/search.rs diff --git a/crates/presentation/src/openapi/social.rs b/crates/adapters/http-axum/src/openapi/social.rs similarity index 100% rename from crates/presentation/src/openapi/social.rs rename to crates/adapters/http-axum/src/openapi/social.rs diff --git a/crates/presentation/src/openapi/users.rs b/crates/adapters/http-axum/src/openapi/users.rs similarity index 100% rename from crates/presentation/src/openapi/users.rs rename to crates/adapters/http-axum/src/openapi/users.rs diff --git a/crates/presentation/src/openapi/watchlist.rs b/crates/adapters/http-axum/src/openapi/watchlist.rs similarity index 100% rename from crates/presentation/src/openapi/watchlist.rs rename to crates/adapters/http-axum/src/openapi/watchlist.rs diff --git a/crates/presentation/src/openapi/webhook.rs b/crates/adapters/http-axum/src/openapi/webhook.rs similarity index 100% rename from crates/presentation/src/openapi/webhook.rs rename to crates/adapters/http-axum/src/openapi/webhook.rs diff --git a/crates/presentation/src/openapi/wrapup.rs b/crates/adapters/http-axum/src/openapi/wrapup.rs similarity index 100% rename from crates/presentation/src/openapi/wrapup.rs rename to crates/adapters/http-axum/src/openapi/wrapup.rs diff --git a/crates/presentation/src/render.rs b/crates/adapters/http-axum/src/render.rs similarity index 79% rename from crates/presentation/src/render.rs rename to crates/adapters/http-axum/src/render.rs index b54e5220..6cc026eb 100644 --- a/crates/presentation/src/render.rs +++ b/crates/adapters/http-axum/src/render.rs @@ -3,7 +3,7 @@ use axum::{ response::{Html, IntoResponse, Response}, }; -pub fn render_page(template: impl template_askama::askama::Template) -> Response { +pub fn render_page(template: impl askama::Template) -> Response { match template.render() { Ok(html) => Html(html).into_response(), Err(e) => { diff --git a/crates/presentation/src/routes.rs b/crates/adapters/http-axum/src/routes.rs similarity index 100% rename from crates/presentation/src/routes.rs rename to crates/adapters/http-axum/src/routes.rs diff --git a/crates/presentation/src/state.rs b/crates/adapters/http-axum/src/state.rs similarity index 100% rename from crates/presentation/src/state.rs rename to crates/adapters/http-axum/src/state.rs diff --git a/crates/presentation/src/tests/api_handlers.rs b/crates/adapters/http-axum/src/tests/api_handlers.rs similarity index 100% rename from crates/presentation/src/tests/api_handlers.rs rename to crates/adapters/http-axum/src/tests/api_handlers.rs diff --git a/crates/presentation/src/tests/context.rs b/crates/adapters/http-axum/src/tests/context.rs similarity index 100% rename from crates/presentation/src/tests/context.rs rename to crates/adapters/http-axum/src/tests/context.rs diff --git a/crates/presentation/src/tests/extractors.rs b/crates/adapters/http-axum/src/tests/extractors.rs similarity index 100% rename from crates/presentation/src/tests/extractors.rs rename to crates/adapters/http-axum/src/tests/extractors.rs diff --git a/crates/presentation/src/tests/forms.rs b/crates/adapters/http-axum/src/tests/forms.rs similarity index 100% rename from crates/presentation/src/tests/forms.rs rename to crates/adapters/http-axum/src/tests/forms.rs diff --git a/crates/presentation/src/tests/mod.rs b/crates/adapters/http-axum/src/tests/mod.rs similarity index 100% rename from crates/presentation/src/tests/mod.rs rename to crates/adapters/http-axum/src/tests/mod.rs diff --git a/crates/adapters/template-askama/templates/_filter_controls.html b/crates/adapters/http-axum/templates/_filter_controls.html similarity index 100% rename from crates/adapters/template-askama/templates/_filter_controls.html rename to crates/adapters/http-axum/templates/_filter_controls.html diff --git a/crates/adapters/template-askama/templates/activity_feed.html b/crates/adapters/http-axum/templates/activity_feed.html similarity index 100% rename from crates/adapters/template-askama/templates/activity_feed.html rename to crates/adapters/http-axum/templates/activity_feed.html diff --git a/crates/adapters/template-askama/templates/base.html b/crates/adapters/http-axum/templates/base.html similarity index 100% rename from crates/adapters/template-askama/templates/base.html rename to crates/adapters/http-axum/templates/base.html diff --git a/crates/adapters/template-askama/templates/blocked_actors.html b/crates/adapters/http-axum/templates/blocked_actors.html similarity index 100% rename from crates/adapters/template-askama/templates/blocked_actors.html rename to crates/adapters/http-axum/templates/blocked_actors.html diff --git a/crates/adapters/template-askama/templates/blocked_domains.html b/crates/adapters/http-axum/templates/blocked_domains.html similarity index 100% rename from crates/adapters/template-askama/templates/blocked_domains.html rename to crates/adapters/http-axum/templates/blocked_domains.html diff --git a/crates/adapters/template-askama/templates/diary.html b/crates/adapters/http-axum/templates/diary.html similarity index 100% rename from crates/adapters/template-askama/templates/diary.html rename to crates/adapters/http-axum/templates/diary.html diff --git a/crates/adapters/template-askama/templates/embed_base.html b/crates/adapters/http-axum/templates/embed_base.html similarity index 100% rename from crates/adapters/template-askama/templates/embed_base.html rename to crates/adapters/http-axum/templates/embed_base.html diff --git a/crates/adapters/template-askama/templates/embed_profile.html b/crates/adapters/http-axum/templates/embed_profile.html similarity index 100% rename from crates/adapters/template-askama/templates/embed_profile.html rename to crates/adapters/http-axum/templates/embed_profile.html diff --git a/crates/adapters/template-askama/templates/followers.html b/crates/adapters/http-axum/templates/followers.html similarity index 100% rename from crates/adapters/template-askama/templates/followers.html rename to crates/adapters/http-axum/templates/followers.html diff --git a/crates/adapters/template-askama/templates/following.html b/crates/adapters/http-axum/templates/following.html similarity index 100% rename from crates/adapters/template-askama/templates/following.html rename to crates/adapters/http-axum/templates/following.html diff --git a/crates/adapters/template-askama/templates/import_mapping.html b/crates/adapters/http-axum/templates/import_mapping.html similarity index 100% rename from crates/adapters/template-askama/templates/import_mapping.html rename to crates/adapters/http-axum/templates/import_mapping.html diff --git a/crates/adapters/template-askama/templates/import_preview.html b/crates/adapters/http-axum/templates/import_preview.html similarity index 100% rename from crates/adapters/template-askama/templates/import_preview.html rename to crates/adapters/http-axum/templates/import_preview.html diff --git a/crates/adapters/template-askama/templates/import_upload.html b/crates/adapters/http-axum/templates/import_upload.html similarity index 100% rename from crates/adapters/template-askama/templates/import_upload.html rename to crates/adapters/http-axum/templates/import_upload.html diff --git a/crates/adapters/template-askama/templates/integrations.html b/crates/adapters/http-axum/templates/integrations.html similarity index 100% rename from crates/adapters/template-askama/templates/integrations.html rename to crates/adapters/http-axum/templates/integrations.html diff --git a/crates/adapters/template-askama/templates/login.html b/crates/adapters/http-axum/templates/login.html similarity index 100% rename from crates/adapters/template-askama/templates/login.html rename to crates/adapters/http-axum/templates/login.html diff --git a/crates/adapters/template-askama/templates/movie_detail.html b/crates/adapters/http-axum/templates/movie_detail.html similarity index 100% rename from crates/adapters/template-askama/templates/movie_detail.html rename to crates/adapters/http-axum/templates/movie_detail.html diff --git a/crates/adapters/template-askama/templates/new_review.html b/crates/adapters/http-axum/templates/new_review.html similarity index 100% rename from crates/adapters/template-askama/templates/new_review.html rename to crates/adapters/http-axum/templates/new_review.html diff --git a/crates/adapters/template-askama/templates/profile.html b/crates/adapters/http-axum/templates/profile.html similarity index 100% rename from crates/adapters/template-askama/templates/profile.html rename to crates/adapters/http-axum/templates/profile.html diff --git a/crates/adapters/template-askama/templates/profile_settings.html b/crates/adapters/http-axum/templates/profile_settings.html similarity index 100% rename from crates/adapters/template-askama/templates/profile_settings.html rename to crates/adapters/http-axum/templates/profile_settings.html diff --git a/crates/adapters/template-askama/templates/register.html b/crates/adapters/http-axum/templates/register.html similarity index 100% rename from crates/adapters/template-askama/templates/register.html rename to crates/adapters/http-axum/templates/register.html diff --git a/crates/adapters/template-askama/templates/users.html b/crates/adapters/http-axum/templates/users.html similarity index 100% rename from crates/adapters/template-askama/templates/users.html rename to crates/adapters/http-axum/templates/users.html diff --git a/crates/adapters/template-askama/templates/watch_queue.html b/crates/adapters/http-axum/templates/watch_queue.html similarity index 100% rename from crates/adapters/template-askama/templates/watch_queue.html rename to crates/adapters/http-axum/templates/watch_queue.html diff --git a/crates/adapters/template-askama/templates/watchlist.html b/crates/adapters/http-axum/templates/watchlist.html similarity index 100% rename from crates/adapters/template-askama/templates/watchlist.html rename to crates/adapters/http-axum/templates/watchlist.html diff --git a/crates/adapters/template-askama/templates/wrapup.html b/crates/adapters/http-axum/templates/wrapup.html similarity index 100% rename from crates/adapters/template-askama/templates/wrapup.html rename to crates/adapters/http-axum/templates/wrapup.html diff --git a/crates/adapters/template-askama/Cargo.toml b/crates/adapters/template-askama/Cargo.toml deleted file mode 100644 index eea631b7..00000000 --- a/crates/adapters/template-askama/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "template-askama" -version = "0.1.0" -edition.workspace = true - -[dependencies] -askama = { version = "0.16.0" } - -chrono = { workspace = true } -uuid = { workspace = true } - -domain = { workspace = true } -api-types = { workspace = true } diff --git a/crates/bootstrap/Cargo.toml b/crates/bootstrap/Cargo.toml index 95458630..c9e21232 100644 --- a/crates/bootstrap/Cargo.toml +++ b/crates/bootstrap/Cargo.toml @@ -8,7 +8,7 @@ default = [] nats = ["dep:nats"] federation = [ "application/federation", - "presentation/federation", + "http-axum/federation", "dep:sqlite-federation", "dep:activitypub", ] @@ -17,7 +17,7 @@ federation = [ config = { workspace = true } domain = { workspace = true } application = { workspace = true } -presentation = { path = "../presentation", default-features = false } +http-axum = { path = "../adapters/http-axum", default-features = false } auth = { workspace = true } metadata = { workspace = true } poster-fetcher = { workspace = true } diff --git a/crates/bootstrap/src/server.rs b/crates/bootstrap/src/server.rs index f430fd7a..76302609 100644 --- a/crates/bootstrap/src/server.rs +++ b/crates/bootstrap/src/server.rs @@ -6,9 +6,9 @@ use application::config::AppConfig as AppSettings; use domain::ports::{DiaryExporter, DocumentParser, EventPublisher}; use domain::value_objects::InstanceIdentity; use export::ExportAdapter; +use http_axum::context::AppContext; +use http_axum::{openapi, routes, state::AppState}; use importer::ImporterDocumentParser; -use presentation::context::AppContext; -use presentation::{openapi, routes, state::AppState}; use rss::RssAdapter; use crate::database::{self, DatabaseOutput}; diff --git a/crates/bootstrap/src/tracing_setup.rs b/crates/bootstrap/src/tracing_setup.rs index 786a3e4d..26147833 100644 --- a/crates/bootstrap/src/tracing_setup.rs +++ b/crates/bootstrap/src/tracing_setup.rs @@ -10,7 +10,7 @@ pub fn init_tracing(default_directives: &str) { /// `RUST_LOG` names the crates to trace in detail; anything it doesn't name /// still reports warnings and errors. Without a baseline, a filter like -/// `presentation=debug` silently drops adapter errors (e.g. the sqlx detail +/// `http_axum=debug` silently drops adapter errors (e.g. the sqlx detail /// behind "Database operation failed"). fn log_filter(default: &str) -> tracing_subscriber::EnvFilter { let directives = std::env::var("RUST_LOG").unwrap_or_else(|_| default.to_string()); diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index eff91cd0..ccbdb448 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -25,7 +25,7 @@ tracing = { workspace = true } [dev-dependencies] domain = { workspace = true, features = ["test-helpers"] } application = { workspace = true } -presentation = { path = "../presentation", default-features = false } +http-axum = { path = "../adapters/http-axum", default-features = false } rss = { workspace = true } sqlite = { workspace = true } sqlx = { workspace = true } diff --git a/crates/server/tests/api_test.rs b/crates/server/tests/api_test.rs index 68c4c41e..ef4c96b1 100644 --- a/crates/server/tests/api_test.rs +++ b/crates/server/tests/api_test.rs @@ -21,9 +21,9 @@ use domain::{ }, value_objects::{Email, ExternalMetadataId, PasswordHash, PosterUrl, UserId}, }; +use http_axum::context::AppContext; +use http_axum::{routes, state::AppState}; use http_body_util::BodyExt; -use presentation::context::AppContext; -use presentation::{routes, state::AppState}; use rss::RssAdapter; use sqlite::{ SqliteDiaryRepository, SqliteInsightsQuery, SqliteMovieRepository, SqliteReviewRepository,