Skip to content

Commit

Permalink
style: harmonize import ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
roeap committed Jan 28, 2024
1 parent 6464b6f commit e6aa282
Show file tree
Hide file tree
Showing 30 changed files with 78 additions and 166 deletions.
3 changes: 1 addition & 2 deletions src/bootstrap/aws.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::{Context, Result};
use rusoto_credential::ProfileProvider;

pub fn new(profile: &str) -> Result<ProfileProvider> {
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/gcp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::{Context, Result};
use tame_gcs::signing::ServiceAccount;

pub fn new(path: &str) -> Result<ServiceAccount> {
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ pub(crate) mod aws;
pub(crate) mod gcp;

mod postgres;
use anyhow::Context;
use anyhow::Result;
use anyhow::{Context, Result};
use rusoto_credential::ProfileProvider;
use sqlx::PgPool;
use tame_gcs::signing::ServiceAccount;
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/postgres.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::server::utilities::bootstrap::Utility as BootstrapUtility;
use anyhow::Context;
use anyhow::Result;
use anyhow::{Context, Result};
use sqlx::PgPool;

use crate::server::utilities::bootstrap::Utility as BootstrapUtility;

pub async fn connect(url: &str) -> Result<PgPool> {
tracing::info!("connecting to database");
let pool = PgPool::connect(url)
Expand Down
4 changes: 1 addition & 3 deletions src/config/fetcher.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use config::Config;
use config::Environment;
use config::File;
use config::{Config, Environment, File};
use glob::glob;
use once_cell::sync::Lazy;

Expand Down
1 change: 1 addition & 0 deletions src/logging/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod tracing;

use crate::config;

pub fn setup() {
Expand Down
18 changes: 5 additions & 13 deletions src/logging/tracing.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
use std::fmt::{Debug, Display, Result as FmtResult};

use chrono::SecondsFormat;
use colored::Colorize;
use std::fmt::Debug;
use std::fmt::Display;
use std::fmt::Result as FmtResult;
use tracing::field::Field;
use tracing::field::Visit;
use tracing::Event;
use tracing::Level;
use tracing::Subscriber;
use tracing::field::{Field, Visit};
use tracing::{Event, Level, Subscriber};
use tracing_log::NormalizeEvent;
use tracing_subscriber::field::RecordFields;
use tracing_subscriber::fmt;
use tracing_subscriber::fmt::format::Writer;
use tracing_subscriber::fmt::FmtContext;
use tracing_subscriber::fmt::FormatEvent;
use tracing_subscriber::fmt::FormatFields;
use tracing_subscriber::fmt::FormattedFields;
use tracing_subscriber::fmt::{self, FmtContext, FormatEvent, FormatFields, FormattedFields};
use tracing_subscriber::prelude::*;
use tracing_subscriber::registry::LookupSpan;
use tracing_subscriber::EnvFilter;
Expand Down
15 changes: 4 additions & 11 deletions src/server/entities/account.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
use anyhow::anyhow;
use anyhow::Result;
use anyhow::{anyhow, Result};
use argon2::password_hash::rand_core::OsRng;
use argon2::password_hash::PasswordHash;
use argon2::password_hash::PasswordHasher;
use argon2::password_hash::PasswordVerifier;
use argon2::password_hash::SaltString;
use argon2::password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString};
use argon2::Argon2;
use getset::Getters;
use getset::Setters;
use getset::{Getters, Setters};
use sqlx::postgres::PgQueryResult;
use sqlx::PgPool;
use uuid::Uuid;
use validator::Validate;

use crate::impl_i64_property;
use crate::impl_string_property;
use crate::impl_uuid_property;
use crate::server::repositories::account::Repository;
use crate::{impl_i64_property, impl_string_property, impl_uuid_property};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Id {
Expand Down
6 changes: 2 additions & 4 deletions src/server/entities/schema.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use anyhow::Result;
use getset::Getters;
use getset::Setters;
use getset::{Getters, Setters};
use sqlx::postgres::PgQueryResult;
use sqlx::PgPool;
use uuid::Uuid;
use validator::Validate;

use crate::impl_string_property;
use crate::impl_uuid_property;
use crate::server::entities::account::Id as AccountId;
use crate::server::entities::share::Id as ShareId;
use crate::server::repositories::schema::Repository;
use crate::{impl_string_property, impl_uuid_property};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Id {
Expand Down
6 changes: 2 additions & 4 deletions src/server/entities/share.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
use anyhow::Result;
use getset::Getters;
use getset::Setters;
use getset::{Getters, Setters};
use sqlx::postgres::PgQueryResult;
use sqlx::PgPool;
use uuid::Uuid;
use validator::Validate;

use crate::impl_string_property;
use crate::impl_uuid_property;
use crate::server::entities::account::Id as AccountId;
use crate::server::repositories::share::Repository;
use crate::{impl_string_property, impl_uuid_property};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Id {
Expand Down
6 changes: 2 additions & 4 deletions src/server/entities/table.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use anyhow::Result;
use getset::Getters;
use getset::Setters;
use getset::{Getters, Setters};
use sqlx::postgres::PgQueryResult;
use sqlx::PgPool;
use uuid::Uuid;
use validator::Validate;

use crate::impl_string_property;
use crate::impl_uuid_property;
use crate::server::entities::account::Id as AccountId;
use crate::server::entities::schema::Id as SchemaId;
use crate::server::repositories::table::Repository;
use crate::{impl_string_property, impl_uuid_property};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Id {
Expand Down
6 changes: 2 additions & 4 deletions src/server/entities/token.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use anyhow::Result;
use getset::Getters;
use getset::Setters;
use getset::{Getters, Setters};
use sqlx::postgres::PgQueryResult;
use sqlx::PgPool;
use uuid::Uuid;
use validator::Validate;

use crate::impl_string_property;
use crate::impl_uuid_property;
use crate::server::entities::account::Id as AccountId;
use crate::server::middlewares::jwt::Role;
use crate::server::repositories::token::Repository;
use crate::{impl_string_property, impl_uuid_property};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Id {
Expand Down
19 changes: 8 additions & 11 deletions src/server/middlewares/jwt.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use crate::config::JWT_SECRET;
use crate::server::entities::account::Entity as AccountEntity;
use crate::server::entities::account::Name as AccountName;
use crate::server::routers::SharedState;
use crate::server::services::error::Error;
use anyhow::anyhow;
use axum::headers::authorization::Bearer;
use axum::headers::Authorization;
use axum::headers::HeaderMapExt;
use axum::headers::{Authorization, HeaderMapExt};
use axum::http::Request;
use axum::middleware::Next;
use axum::response::Response;
use jsonwebtoken::decode;
use jsonwebtoken::DecodingKey;
use jsonwebtoken::EncodingKey;
use jsonwebtoken::Validation;
use jsonwebtoken::{decode, DecodingKey, EncodingKey, Validation};

use crate::config::JWT_SECRET;
use crate::server::entities::account::Entity as AccountEntity;
use crate::server::entities::account::Name as AccountName;
use crate::server::routers::SharedState;
use crate::server::services::error::Error;

#[derive(Debug, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
9 changes: 3 additions & 6 deletions src/server/repositories/account.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use anyhow::Context;
use anyhow::Result;
use chrono::DateTime;
use chrono::Utc;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use sqlx::postgres::PgQueryResult;
use uuid::Uuid;

use crate::server::entities::account::Entity;
use crate::server::entities::account::Name;
use crate::server::entities::account::{Entity, Name};
use crate::server::utilities::postgres::PgAcquire;

#[derive(Debug, Clone, serde::Serialize, sqlx::FromRow)]
Expand Down
10 changes: 3 additions & 7 deletions src/server/repositories/schema.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use anyhow::Context;
use anyhow::Result;
use chrono::DateTime;
use chrono::Utc;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use sqlx::postgres::PgQueryResult;
use uuid::Uuid;

use crate::server::entities::schema::Entity;
use crate::server::entities::schema::Name;
use crate::server::entities::schema::{Entity, Name};
use crate::server::entities::share::Id as ShareId;

use crate::server::utilities::postgres::PgAcquire;

#[derive(Debug, Clone, serde::Serialize, sqlx::FromRow)]
Expand Down
9 changes: 3 additions & 6 deletions src/server/repositories/share.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use anyhow::Context;
use anyhow::Result;
use chrono::DateTime;
use chrono::Utc;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use sqlx::postgres::PgQueryResult;
use uuid::Uuid;

use crate::server::entities::share::Entity;
use crate::server::entities::share::Name;
use crate::server::entities::share::{Entity, Name};
use crate::server::utilities::postgres::PgAcquire;

#[derive(Debug, Clone, serde::Serialize, sqlx::FromRow)]
Expand Down
9 changes: 3 additions & 6 deletions src/server/repositories/table.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use anyhow::Context;
use anyhow::Result;
use chrono::DateTime;
use chrono::Utc;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use sqlx::postgres::PgQueryResult;
use uuid::Uuid;

use crate::server::entities::schema::Id as SchemaId;
use crate::server::entities::table::Entity;
use crate::server::entities::table::Name;
use crate::server::entities::table::{Entity, Name};
use crate::server::utilities::postgres::PgAcquire;

#[derive(Debug, Clone, serde::Serialize, sqlx::FromRow)]
Expand Down
6 changes: 2 additions & 4 deletions src/server/repositories/token.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use anyhow::Context;
use anyhow::Result;
use chrono::DateTime;
use chrono::Utc;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use sqlx::postgres::PgQueryResult;
use uuid::Uuid;

Expand Down
6 changes: 2 additions & 4 deletions src/server/routers/admin.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::{Extension, Json};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use axum::response::{IntoResponse, Response};
use utoipa::ToSchema;

use crate::server::entities::account::Entity as AccountEntity;
Expand Down
11 changes: 3 additions & 8 deletions src/server/routers/admin/accounts.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::Path;
use axum::extract::Query;
use axum::extract::{Extension, Json, Path, Query};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use utoipa::IntoParams;
use utoipa::ToSchema;
use axum::response::{IntoResponse, Response};
use utoipa::{IntoParams, ToSchema};

use crate::server::entities::account::Entity as AccountEntity;
use crate::server::entities::account::Name as AccountName;
Expand Down
6 changes: 2 additions & 4 deletions src/server/routers/admin/shares.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::{Extension, Json};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use axum::response::{IntoResponse, Response};
use utoipa::ToSchema;

use crate::server::entities::account::Entity as AccountEntity;
Expand Down
10 changes: 3 additions & 7 deletions src/server/routers/admin/shares/schemas.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::Path;
use axum::extract::{Extension, Json, Path};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use utoipa::IntoParams;
use utoipa::ToSchema;
use axum::response::{IntoResponse, Response};
use utoipa::{IntoParams, ToSchema};

use crate::server::entities::account::Entity as AccountEntity;
use crate::server::entities::schema::Entity as SchemaEntity;
Expand Down
10 changes: 3 additions & 7 deletions src/server/routers/admin/shares/schemas/tables.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::Path;
use axum::extract::{Extension, Json, Path};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use utoipa::IntoParams;
use utoipa::ToSchema;
use axum::response::{IntoResponse, Response};
use utoipa::{IntoParams, ToSchema};

use crate::server::entities::account::Entity as AccountEntity;
use crate::server::entities::schema::Entity as SchemaEntity;
Expand Down
11 changes: 3 additions & 8 deletions src/server/routers/shares.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::Path;
use axum::extract::Query;
use axum::extract::{Extension, Json, Path, Query};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use utoipa::IntoParams;
use utoipa::ToSchema;
use axum::response::{IntoResponse, Response};
use utoipa::{IntoParams, ToSchema};

use crate::server::entities::share::Name as ShareName;
use crate::server::routers::SharedState;
Expand Down
11 changes: 3 additions & 8 deletions src/server/routers/shares/all_tables.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use anyhow::anyhow;
use axum::extract::Extension;
use axum::extract::Json;
use axum::extract::Path;
use axum::extract::Query;
use axum::extract::{Extension, Json, Path, Query};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::response::Response;
use utoipa::IntoParams;
use utoipa::ToSchema;
use axum::response::{IntoResponse, Response};
use utoipa::{IntoParams, ToSchema};

use crate::server::entities::share::Entity as ShareEntity;
use crate::server::entities::share::Name as ShareName;
Expand Down
Loading

0 comments on commit e6aa282

Please sign in to comment.