refactor/tighten-architecture #26

Merged
GKaszewski merged 104 commits from refactor/tighten-architecture into master 2026-10-26 09:36:27 +00:00
94 changed files with 99 additions and 126 deletions
Showing only changes of commit a931fb548f - Show all commits

View File

@@ -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

View File

@@ -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<dyn Trait>` 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)

81
Cargo.lock generated
View File

@@ -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"

View File

@@ -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" }

View File

@@ -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

View File

@@ -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:

View File

@@ -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
```

View File

@@ -3,7 +3,7 @@ title: Movies Diary — Hexagonal Architecture
---
graph TB
subgraph Binaries["Binaries (Composition Root)"]
WEB["presentation<br/><i>Axum web server</i><br/>Routes, Handlers, Mappers"]
WEB["http-axum<br/><i>Axum web server + HTML templates</i><br/>Routes, Handlers, Mappers"]
WORKER["worker<br/><i>Event consumer</i><br/>Concurrent dispatch, graceful shutdown"]
TUI["tui<br/><i>Terminal UI</i>"]
end
@@ -110,7 +110,6 @@ graph TB
A_POSTER_SYNC["poster-sync"]
end
subgraph Presentation["Presentation Helpers"]
A_TEMPLATE["template-askama<br/><i>HTML templates</i>"]
A_RSS["rss<br/><i>Feed generation</i>"]
A_EXPORT["export<br/><i>CSV/JSON diary</i>"]
A_IMPORT["importer<br/><i>CSV/JSON/XLSX parser</i>"]

View File

@@ -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"] }

View File

@@ -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 ─────────────────────────────────────────────────────────────

View File

@@ -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};

View File

@@ -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,

View File

@@ -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<template_askama::WebhookTokenView> = tokens
let token_views: Vec<crate::html::templates::WebhookTokenView> = 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<template_askama::WatchQueueDisplayEntry> = events
let entries: Vec<crate::html::templates::WatchQueueDisplayEntry> = events
.iter()
.map(crate::mappers::integrations::watch_queue_entry)
.collect();

View File

@@ -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;

View File

@@ -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<template_askama::BlockedDomainEntry> = domains
let entries: Vec<crate::html::templates::BlockedDomainEntry> = 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<template_askama::BlockedActorEntry> = blocked
let entries: Vec<crate::html::templates::BlockedActorEntry> = 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,

View File

@@ -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<template_askama::PageItem>,
page_items: Vec<crate::html::templates::PageItem>,
}
fn compute_pagination(
@@ -571,7 +571,7 @@ fn build_monthly_rating_rows<'a>(
async fn fetch_profile_goals(
state: &AppState,
user_id: Uuid,
) -> Vec<template_askama::GoalViewData> {
) -> Vec<crate::html::templates::GoalViewData> {
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,

View File

@@ -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};

View File

@@ -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(),

View File

@@ -0,0 +1 @@
pub mod templates;

View File

@@ -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,

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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

View File

@@ -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<WatchlistDisplayEntry>,

View File

@@ -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) => {

View File

@@ -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 }

View File

@@ -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 }

View File

@@ -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};

View File

@@ -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());

View File

@@ -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 }

View File

@@ -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,