Skip to content

Commit dbd2d1b

Browse files
committed
refactor(axum-rest-api-server): remove re-exports, import protocol DTOs directly
Remove pub-use re-exports from axum-rest-api-server's peer.rs and torrent.rs that forwarded to torrust-tracker-rest-api-protocol. All callers now import directly from the protocol crate. Updated files: - packages/axum-rest-api-server/tests/ (asserts, contract test) - src/console/ci/qbittorrent_e2e/ (verify_tracker_swarm, tracker client) - packages/axum-rest-api-server/src/v1/context/torrent/resources/ (tests) Also adds torrust-tracker-rest-api-protocol as a direct dependency of the root torrust-tracker crate. Part of EPIC #1669
1 parent 8dcccf0 commit dbd2d1b

8 files changed

Lines changed: 10 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ torrust-tracker-axum-rest-api-server = { version = "3.0.0-develop", path = "pack
6363
torrust-tracker-axum-server = { version = "3.0.0-develop", path = "packages/axum-server" }
6464
torrust-tracker-rest-api-client = { version = "3.0.0-develop", path = "packages/rest-api-client" }
6565
torrust-tracker-rest-api-core = { version = "3.0.0-develop", path = "packages/rest-api-core" }
66+
torrust-tracker-rest-api-protocol = { version = "3.0.0-develop", path = "packages/rest-api-protocol" }
6667
torrust-server-lib = "0.1.0"
6768
torrust-clock = "3.0.0"
6869
torrust-tracker-configuration = { version = "3.0.0-develop", path = "packages/configuration" }
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
//! `Peer` and Peer `Id` API resources.
22
//!
3-
//! Re-exports the protocol DTOs.
4-
pub use torrust_tracker_rest_api_protocol::v1::resources::peer::{Id, Peer};
3+
//! Protocol DTOs are defined in `torrust-tracker-rest-api-protocol`.

packages/axum-rest-api-server/src/v1/context/torrent/resources/torrent.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! `Torrent` and `ListItem` API resources.
22
//!
3-
//! Re-exports the protocol DTOs.
4-
pub use torrust_tracker_rest_api_protocol::v1::resources::torrent::{ListItem, Torrent};
3+
//! Protocol DTOs are defined in `torrust-tracker-rest-api-protocol`.
4+
//! This module only contains unit tests for domain→DTO conversions.
55
66
#[cfg(test)]
77
mod tests {
@@ -12,10 +12,9 @@ mod tests {
1212
use torrust_info_hash::InfoHash;
1313
use torrust_tracker_core::torrent::services::{BasicInfo, Info};
1414
use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer};
15+
use torrust_tracker_rest_api_protocol::v1::resources::torrent::{ListItem, Torrent};
1516
use torrust_tracker_rest_api_runtime_adapter::conversion;
1617

17-
use crate::v1::context::torrent::resources::torrent::{ListItem, Torrent};
18-
1918
fn sample_peer() -> peer::Peer {
2019
peer::Peer {
2120
peer_id: PeerId(*b"-qB00000000000000000"),

packages/axum-rest-api-server/tests/server/v1/asserts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use reqwest::Response;
44
use torrust_tracker_axum_rest_api_server::v1::context::auth_key::resources::AuthKey;
55
use torrust_tracker_axum_rest_api_server::v1::context::stats::resources::Stats;
6-
use torrust_tracker_axum_rest_api_server::v1::context::torrent::resources::torrent::{ListItem, Torrent};
6+
use torrust_tracker_rest_api_protocol::v1::resources::torrent::{ListItem, Torrent};
77

88
// Resource responses
99

packages/axum-rest-api-server/tests/server/v1/contract/context/torrent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use std::str::FromStr;
22

33
use torrust_info_hash::InfoHash;
44
use torrust_tracker_axum_rest_api_server::testing::environment::Started;
5-
use torrust_tracker_axum_rest_api_server::v1::context::torrent::resources::torrent::{self, Torrent};
65
use torrust_tracker_primitives::peer::fixture::PeerBuilder;
76
use torrust_tracker_rest_api_client::common::http::{Query, QueryParam};
87
use torrust_tracker_rest_api_client::v1::client::{Client, headers_with_request_id};
8+
use torrust_tracker_rest_api_protocol::v1::resources::torrent::{self, Torrent};
99
use torrust_tracker_rest_api_runtime_adapter::conversion;
1010
use torrust_tracker_test_helpers::logging::logs_contains_a_line_with;
1111
use torrust_tracker_test_helpers::{configuration, logging};

src/console/ci/qbittorrent_e2e/scenario_steps/tracker/verify_tracker_swarm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Context;
2-
use torrust_tracker_axum_rest_api_server::v1::context::torrent::resources::torrent::Torrent;
2+
use torrust_tracker_rest_api_protocol::v1::resources::torrent::Torrent;
33

44
use super::super::super::tracker::TrackerApiClient;
55
use super::super::super::types::InfoHash;

src/console/ci/qbittorrent_e2e/tracker/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
//! future scenario steps can call any REST API endpoint through the same client
55
//! without having to reconstruct connection details each time.
66
use anyhow::Context;
7-
use torrust_tracker_axum_rest_api_server::v1::context::torrent::resources::torrent::Torrent;
87
use torrust_tracker_rest_api_client::connection_info::{ConnectionInfo, Origin};
98
use torrust_tracker_rest_api_client::v1::client::Client;
9+
use torrust_tracker_rest_api_protocol::v1::resources::torrent::Torrent;
1010

1111
use super::super::types::InfoHash;
1212
use super::config_builder::TrackerConfig;

0 commit comments

Comments
 (0)