Skip to content

Commit

Permalink
fix(api): clean up impl_success_response (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
grtlr authored May 9, 2022
1 parent 16b4cc5 commit e5097d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
14 changes: 3 additions & 11 deletions bin/inx-chronicle/src/api/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ macro_rules! impl_success_response {
$(
impl IntoResponse for $type {
fn into_response(self) -> axum::response::Response {
SuccessBody::from(self).into_response()
crate::api::responses::SuccessBody::from(self).into_response()
}
}
)*
Expand All @@ -32,20 +32,12 @@ pub struct InfoResponse {
pub is_healthy: bool,
}

impl IntoResponse for InfoResponse {
fn into_response(self) -> axum::response::Response {
SuccessBody::from(self).into_response()
}
}
impl_success_response!(InfoResponse);

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SyncDataResponse(pub SyncData);

impl IntoResponse for SyncDataResponse {
fn into_response(self) -> axum::response::Response {
SuccessBody::from(self).into_response()
}
}
impl_success_response!(SyncDataResponse);

#[derive(Clone, Debug, Serialize, Deserialize, From)]
#[serde(untagged)]
Expand Down
2 changes: 1 addition & 1 deletion bin/inx-chronicle/src/api/stardust/analytics/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use axum::response::IntoResponse;
use serde::{Deserialize, Serialize};

use crate::api::{impl_success_response, responses::SuccessBody};
use crate::api::impl_success_response;

/// Response of `GET /api/v2/analytics/addresses[?start_timestamp=<i64>&end_timestamp=<i64>]`.
#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion bin/inx-chronicle/src/api/stardust/explorer/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use axum::response::IntoResponse;
use serde::{Deserialize, Serialize};

use crate::api::{impl_success_response, responses::Transfer, SuccessBody};
use crate::api::{impl_success_response, responses::Transfer};

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TransactionHistoryResponse {
Expand Down
5 changes: 1 addition & 4 deletions bin/inx-chronicle/src/api/stardust/v2/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use axum::response::IntoResponse;
use chronicle::dto;
use serde::{Deserialize, Serialize};

use crate::api::{
impl_success_response,
responses::{Expansion, SuccessBody},
};
use crate::api::{impl_success_response, responses::Expansion};

/// Response of `GET /api/v2/messages/<message_id>`
/// and `GET /api/v2/transactions/<transaction_id>/included-message`.
Expand Down

0 comments on commit e5097d7

Please sign in to comment.