feat: add documentation crate and integrate OpenAPI specifications

- Added a new crate `doc` for API documentation.
- Integrated `utoipa` for OpenAPI support in the presentation layer.
- Updated routes to include social features (follow, unfollow, etc.) and diary export.
- Enhanced API request and response structures with new DTOs for social interactions.
- Updated `Cargo.toml` files to include new dependencies and features.
- Modified Dockerfile to copy the new documentation crate.
- Refactored existing handlers and routes to accommodate new API endpoints.
- Updated tests to cover new functionality and ensure proper API behavior.
This commit is contained in:
2026-05-09 21:29:20 +02:00
parent f66f8745c7
commit fa501706cd
16 changed files with 777 additions and 38 deletions

View File

@@ -167,7 +167,7 @@ async fn get_api_diary_returns_empty_list() {
let response = app
.oneshot(
Request::builder()
.uri("/api/diary")
.uri("/api/v1/diary")
.body(Body::empty())
.unwrap(),
)
@@ -192,7 +192,7 @@ async fn post_api_reviews_without_auth_returns_401() {
.oneshot(
Request::builder()
.method("POST")
.uri("/api/reviews")
.uri("/api/v1/reviews")
.header("content-type", "application/json")
.body(Body::from(
r#"{"rating":4,"watched_at":"2026-01-01T20:00:00","manual_title":"Dune","manual_release_year":2021}"#,
@@ -212,7 +212,7 @@ async fn post_api_auth_login_unknown_user_returns_401() {
.oneshot(
Request::builder()
.method("POST")
.uri("/api/auth/login")
.uri("/api/v1/auth/login")
.header("content-type", "application/json")
.body(Body::from(r#"{"email":"a@b.com","password":"x"}"#))
.unwrap(),