Skip to content

Commit

Permalink
style: import cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-hagemann committed Dec 7, 2023
1 parent 3952941 commit b84bae7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 32 deletions.
3 changes: 1 addition & 2 deletions src/app/interfaces/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use http::header;
use tonic::{Request, Status};
use tracing::error;

use crate::app::context::AppContext;
use crate::app::RequestContext;
use crate::app::{context::AppContext, RequestContext};

pub fn authentication(req: Request<()>) -> Result<Request<()>, Status> {
let app_ctx = req.extensions().get::<AppContext>().unwrap().clone();
Expand Down
3 changes: 1 addition & 2 deletions src/app/interfaces/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::pin::Pin;

use hyper::service::Service;
use hyper::Body;
use hyper::{service::Service, Body};
use tonic::body::BoxBody;
use tower::Layer;

Expand Down
7 changes: 4 additions & 3 deletions src/features/app/infrastructure.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::{app::AppContext, features::common::entities::VoteSummary};
use crate::{
app::AppContext,
features::{app::errors::AppError, common::entities::VoteSummary},
};
use tracing::error;

use super::errors::AppError;

pub(crate) async fn get_votes_by_snap_id(
app_ctx: &AppContext,
snap_id: &str,
Expand Down
9 changes: 4 additions & 5 deletions src/features/app/interface.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::app::AppContext;

use crate::features::pb::app::{GetRatingRequest, GetRatingResponse};
use crate::features::{
app::{service::AppService, use_cases},
pb::app::{app_server::App, GetRatingRequest, GetRatingResponse},
};
use tonic::{Request, Response, Status};

use crate::features::pb::app::app_server::App;

use super::{service::AppService, use_cases};

#[tonic::async_trait]
impl App for AppService {
#[tracing::instrument]
Expand Down
7 changes: 4 additions & 3 deletions src/features/chart/entities.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::features::{
common::entities::{calculate_band, Rating, VoteSummary},
pb::chart as pb,
};
use sqlx::FromRow;

use crate::features::common::entities::{calculate_band, Rating, VoteSummary};
use crate::features::pb::chart as pb;

pub struct Chart {
pub timeframe: pb::Timeframe,
pub chart_data: Vec<ChartData>,
Expand Down
9 changes: 4 additions & 5 deletions src/features/chart/infrastructure.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::app::AppContext;
use crate::features::common::entities::VoteSummary;
use crate::features::pb::chart::Timeframe;
use crate::{
app::AppContext,
features::{chart::errors::ChartError, common::entities::VoteSummary, pb::chart::Timeframe},
};
use tracing::error;

use super::errors::ChartError;

pub(crate) async fn get_votes_summary_by_timeframe(
app_ctx: &AppContext,
timeframe: Timeframe,
Expand Down
15 changes: 7 additions & 8 deletions src/features/chart/interface.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::app::AppContext;

use crate::features::pb::chart::{GetChartRequest, GetChartResponse, Timeframe};
use crate::{
app::AppContext,
features::{
chart::{errors::ChartError, service::ChartService, use_cases},
pb::chart::{chart_server::Chart, GetChartRequest, GetChartResponse, Timeframe},
},
};
use tonic::{Request, Response, Status};

use crate::features::pb::chart::chart_server::Chart;

use super::errors::ChartError;
use super::{service::ChartService, use_cases};

#[tonic::async_trait]
impl Chart for ChartService {
#[tracing::instrument]
Expand Down
8 changes: 4 additions & 4 deletions src/features/chart/use_cases.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::{errors::ChartError, infrastructure::get_votes_summary_by_timeframe};
use crate::app::AppContext;
use crate::features::chart::entities::Chart;
use crate::features::pb::chart::Timeframe;
use crate::{
app::AppContext,
features::{chart::entities::Chart, pb::chart::Timeframe},
};
use tracing::error;
// use super::{entities::Rating, errors::AppError, infrastructure::get_votes_by_snap_id};

pub async fn get_chart(app_ctx: &AppContext, timeframe: Timeframe) -> Result<Chart, ChartError> {
let votes = get_votes_summary_by_timeframe(app_ctx, timeframe)
Expand Down

0 comments on commit b84bae7

Please sign in to comment.