summaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/auth-service/Cargo.toml (renamed from crates/auth/Cargo.toml)2
-rw-r--r--crates/auth-service/auth.toml (renamed from crates/auth/auth.toml)6
-rw-r--r--crates/auth-service/migrations/20250723100947_user.sql (renamed from crates/auth/migrations/20250723100947_user.sql)0
-rw-r--r--crates/auth-service/migrations/20250723121223_oauth_account.sql (renamed from crates/auth/migrations/20250723121223_oauth_account.sql)0
-rw-r--r--crates/auth-service/migrations/20250725160900_session.sql (renamed from crates/auth/migrations/20250725160900_session.sql)0
-rw-r--r--crates/auth-service/migrations/20250725161014_token.sql (renamed from crates/auth/migrations/20250725161014_token.sql)0
-rw-r--r--crates/auth-service/src/auth.rs (renamed from crates/auth/src/auth.rs)0
-rw-r--r--crates/auth-service/src/client.rs (renamed from crates/auth/src/client.rs)0
-rw-r--r--crates/auth-service/src/client/discord.rs (renamed from crates/auth/src/client/discord.rs)0
-rw-r--r--crates/auth-service/src/cnfg.rs (renamed from crates/auth/src/cnfg.rs)0
-rw-r--r--crates/auth-service/src/error.rs (renamed from crates/auth/src/error.rs)0
-rw-r--r--crates/auth-service/src/main.rs (renamed from crates/auth/src/main.rs)6
-rw-r--r--crates/auth-service/src/server.rs (renamed from crates/auth/src/server.rs)0
-rw-r--r--crates/auth-service/src/server/csrf_token_validation.rs (renamed from crates/auth/src/server/csrf_token_validation.rs)0
-rw-r--r--crates/auth-service/src/server/grpc.rs (renamed from crates/auth/src/server/grpc.rs)0
-rw-r--r--crates/auth-service/src/server/grpc/auth.rs (renamed from crates/auth/src/server/grpc/auth.rs)0
-rw-r--r--crates/auth-service/src/server/grpc/interceptor.rs (renamed from crates/auth/src/server/grpc/interceptor.rs)0
-rw-r--r--crates/auth-service/src/server/routes.rs (renamed from crates/auth/src/server/routes.rs)0
-rw-r--r--crates/auth-service/src/server/routes/authorised.rs (renamed from crates/auth/src/server/routes/authorised.rs)22
-rw-r--r--crates/auth-service/src/server/routes/discord.rs (renamed from crates/auth/src/server/routes/discord.rs)0
-rw-r--r--crates/auth-service/src/server/routes/discord/discord_auth.rs (renamed from crates/auth/src/server/routes/discord/discord_auth.rs)0
-rw-r--r--crates/auth-service/src/state.rs (renamed from crates/auth/src/state.rs)0
-rw-r--r--crates/profile-service/Cargo.toml18
-rw-r--r--crates/profile-service/migrations/20250726161947_profile.sql32
-rw-r--r--crates/profile-service/profile.toml37
-rw-r--r--crates/profile-service/src/cnfg.rs8
-rw-r--r--crates/profile-service/src/main.rs111
-rw-r--r--crates/profile-service/src/server.rs2
-rw-r--r--crates/profile-service/src/server/interceptor.rs11
-rw-r--r--crates/profile-service/src/server/manager.rs45
-rw-r--r--crates/profile-service/src/state.rs42
-rw-r--r--crates/sellershut/src/server/activities/follow.rs2
-rw-r--r--crates/sellershut/src/server/routes.rs2
-rw-r--r--crates/sellershut/src/server/routes/users/followers.rs2
-rw-r--r--crates/sellershut/src/server/routes/users/get_outbox.rs2
-rw-r--r--crates/sellershut/src/server/routes/users/get_user.rs2
-rw-r--r--crates/sellershut/src/server/routes/users/webfinger.rs2
37 files changed, 322 insertions, 32 deletions
diff --git a/crates/auth/Cargo.toml b/crates/auth-service/Cargo.toml
index cc6d676..bbbb10d 100644
--- a/crates/auth/Cargo.toml
+++ b/crates/auth-service/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "auth-service"
+name = "sellershut-auth"
version = "0.1.0"
edition = "2024"
license.workspace = true
diff --git a/crates/auth/auth.toml b/crates/auth-service/auth.toml
index 3af6fc0..8febe90 100644
--- a/crates/auth/auth.toml
+++ b/crates/auth-service/auth.toml
@@ -31,4 +31,10 @@ host = "localhost"
password = "password"
user = "postgres"
+[cache]
+dsn = "redis://localhost:6379"
+pooled = true
+type = "non-clustered" # clustered, non-clustered or sentinel
+max-connections = 100
+
# vim:ft=toml
diff --git a/crates/auth/migrations/20250723100947_user.sql b/crates/auth-service/migrations/20250723100947_user.sql
index b5566fe..b5566fe 100644
--- a/crates/auth/migrations/20250723100947_user.sql
+++ b/crates/auth-service/migrations/20250723100947_user.sql
diff --git a/crates/auth/migrations/20250723121223_oauth_account.sql b/crates/auth-service/migrations/20250723121223_oauth_account.sql
index 826fbcc..826fbcc 100644
--- a/crates/auth/migrations/20250723121223_oauth_account.sql
+++ b/crates/auth-service/migrations/20250723121223_oauth_account.sql
diff --git a/crates/auth/migrations/20250725160900_session.sql b/crates/auth-service/migrations/20250725160900_session.sql
index c5e76dc..c5e76dc 100644
--- a/crates/auth/migrations/20250725160900_session.sql
+++ b/crates/auth-service/migrations/20250725160900_session.sql
diff --git a/crates/auth/migrations/20250725161014_token.sql b/crates/auth-service/migrations/20250725161014_token.sql
index 68f476c..68f476c 100644
--- a/crates/auth/migrations/20250725161014_token.sql
+++ b/crates/auth-service/migrations/20250725161014_token.sql
diff --git a/crates/auth/src/auth.rs b/crates/auth-service/src/auth.rs
index 04cb60a..04cb60a 100644
--- a/crates/auth/src/auth.rs
+++ b/crates/auth-service/src/auth.rs
diff --git a/crates/auth/src/client.rs b/crates/auth-service/src/client.rs
index 5aa4de0..5aa4de0 100644
--- a/crates/auth/src/client.rs
+++ b/crates/auth-service/src/client.rs
diff --git a/crates/auth/src/client/discord.rs b/crates/auth-service/src/client/discord.rs
index 9217684..9217684 100644
--- a/crates/auth/src/client/discord.rs
+++ b/crates/auth-service/src/client/discord.rs
diff --git a/crates/auth/src/cnfg.rs b/crates/auth-service/src/cnfg.rs
index 9b765a5..9b765a5 100644
--- a/crates/auth/src/cnfg.rs
+++ b/crates/auth-service/src/cnfg.rs
diff --git a/crates/auth/src/error.rs b/crates/auth-service/src/error.rs
index 730f99a..730f99a 100644
--- a/crates/auth/src/error.rs
+++ b/crates/auth-service/src/error.rs
diff --git a/crates/auth/src/main.rs b/crates/auth-service/src/main.rs
index 3f68e2f..50544fc 100644
--- a/crates/auth/src/main.rs
+++ b/crates/auth-service/src/main.rs
@@ -22,7 +22,7 @@ use crate::{
state::{AppState, Services},
};
-/// auth-service
+/// sellershut-auth
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
@@ -68,7 +68,9 @@ async fn main() -> Result<(), AppError> {
let services = Services { postgres };
trace!("running migrations");
- sqlx::migrate!("./migrations").run(&services.postgres).await?;
+ sqlx::migrate!("./migrations")
+ .run(&services.postgres)
+ .await?;
let (state, deletion_task) = AppState::create(services, &config).await?;
diff --git a/crates/auth/src/server.rs b/crates/auth-service/src/server.rs
index 7b66c42..7b66c42 100644
--- a/crates/auth/src/server.rs
+++ b/crates/auth-service/src/server.rs
diff --git a/crates/auth/src/server/csrf_token_validation.rs b/crates/auth-service/src/server/csrf_token_validation.rs
index 94424c8..94424c8 100644
--- a/crates/auth/src/server/csrf_token_validation.rs
+++ b/crates/auth-service/src/server/csrf_token_validation.rs
diff --git a/crates/auth/src/server/grpc.rs b/crates/auth-service/src/server/grpc.rs
index 0fd775b..0fd775b 100644
--- a/crates/auth/src/server/grpc.rs
+++ b/crates/auth-service/src/server/grpc.rs
diff --git a/crates/auth/src/server/grpc/auth.rs b/crates/auth-service/src/server/grpc/auth.rs
index fb00291..fb00291 100644
--- a/crates/auth/src/server/grpc/auth.rs
+++ b/crates/auth-service/src/server/grpc/auth.rs
diff --git a/crates/auth/src/server/grpc/interceptor.rs b/crates/auth-service/src/server/grpc/interceptor.rs
index 155a306..155a306 100644
--- a/crates/auth/src/server/grpc/interceptor.rs
+++ b/crates/auth-service/src/server/grpc/interceptor.rs
diff --git a/crates/auth/src/server/routes.rs b/crates/auth-service/src/server/routes.rs
index 6773962..6773962 100644
--- a/crates/auth/src/server/routes.rs
+++ b/crates/auth-service/src/server/routes.rs
diff --git a/crates/auth/src/server/routes/authorised.rs b/crates/auth-service/src/server/routes/authorised.rs
index 32dd929..4d48299 100644
--- a/crates/auth/src/server/routes/authorised.rs
+++ b/crates/auth-service/src/server/routes/authorised.rs
@@ -180,17 +180,16 @@ pub async fn login_authorised(
),
)?;
- let user_request = CreateUserRequest{
+ let user_request = CreateUserRequest {
email: user_data.email.to_owned(),
- avatar: user_data.avatar.as_ref().map(|value| {
- format!(
- "https://cdn.discordapp.com/avatars/{}/{value}",
- user_data.id
- )
- })
+ avatar: user_data.avatar.as_ref().map(|value| {
+ format!(
+ "https://cdn.discordapp.com/avatars/{}/{value}",
+ user_data.id
+ )
+ }),
};
-
store
.create(&mut Record {
id: session_id,
@@ -218,6 +217,7 @@ pub async fn login_authorised(
let mut profile_client = state.profile_client.clone();
let resp = profile_client.create_user(user_request).await?.into_inner();
+
let user_id = resp.temp_id;
let mut headers = HeaderMap::new();
@@ -228,5 +228,9 @@ pub async fn login_authorised(
transaction.commit().await?;
- Ok((headers, Redirect::to(&format!("/?user={user_id}&token={token}"))).into_response())
+ Ok((
+ headers,
+ Redirect::to(&format!("/?user={user_id}&token={token}")),
+ )
+ .into_response())
}
diff --git a/crates/auth/src/server/routes/discord.rs b/crates/auth-service/src/server/routes/discord.rs
index e1a834f..e1a834f 100644
--- a/crates/auth/src/server/routes/discord.rs
+++ b/crates/auth-service/src/server/routes/discord.rs
diff --git a/crates/auth/src/server/routes/discord/discord_auth.rs b/crates/auth-service/src/server/routes/discord/discord_auth.rs
index a45de86..a45de86 100644
--- a/crates/auth/src/server/routes/discord/discord_auth.rs
+++ b/crates/auth-service/src/server/routes/discord/discord_auth.rs
diff --git a/crates/auth/src/state.rs b/crates/auth-service/src/state.rs
index 5905948..5905948 100644
--- a/crates/auth/src/state.rs
+++ b/crates/auth-service/src/state.rs
diff --git a/crates/profile-service/Cargo.toml b/crates/profile-service/Cargo.toml
index 409110b..e56db3a 100644
--- a/crates/profile-service/Cargo.toml
+++ b/crates/profile-service/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "profile-service"
+name = "sellershut-profiles"
version = "0.1.0"
edition = "2024"
license.workspace = true
@@ -9,16 +9,12 @@ description.workspace = true
[dependencies]
anyhow.workspace = true
-axum = { workspace = true, features = ["macros"] }
-axum-extra = { version = "0.10.1", features = ["typed-header"] }
base64.workspace = true
clap = { workspace = true, features = ["derive"] }
config = { workspace = true, features = ["convert-case", "toml"] }
futures-util.workspace = true
-jsonwebtoken = "9.3.1"
nanoid.workspace = true
-oauth2 = "5.0.0"
-reqwest = { workspace = true, features = ["json", "rustls-tls"] }
+prost.workspace = true
sellershut-core = { workspace = true, features = ["profile", "serde"] }
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
@@ -27,12 +23,10 @@ time = { workspace = true, features = ["parsing", "serde"] }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] }
tonic.workspace = true
tonic-reflection = "0.13.0"
-tower = { workspace = true, features = ["steer", "util"] }
-tower-http = { workspace = true, features = ["map-request-body", "trace", "util"] }
-tower-sessions = "0.14.0"
-tower-sessions-core = { version = "0.14.0", features = ["deletion-task"] }
-tower-sessions-moka-store = "0.15.0"
-tower-sessions-sqlx-store = { version = "0.15.0", features = ["postgres"] }
tracing.workspace = true
url.workspace = true
uuid = { workspace = true, features = ["serde", "v7"] }
+
+[dependencies.stack-up]
+workspace = true
+features = ["api", "cache", "postgres", "tracing"]
diff --git a/crates/profile-service/migrations/20250726161947_profile.sql b/crates/profile-service/migrations/20250726161947_profile.sql
new file mode 100644
index 0000000..15822c8
--- /dev/null
+++ b/crates/profile-service/migrations/20250726161947_profile.sql
@@ -0,0 +1,32 @@
+create table profile (
+ id text primary key,
+ username varchar(30) not null,
+ inbox text not null,
+ outbox text,
+ local boolean not null,
+ avatar_url text,
+ description text,
+ user_type text not null check (
+ user_type IN ('PERSON', 'APPLICATION', 'GROUP', 'ORGANIZATION', 'SERVICE')
+ ),
+ created_at timestamptz not null default now(),
+ updated_at timestamptz not null default now(),
+ public_key text not null
+);
+
+create unique index unique_username_local
+ on profile (username)
+ where local = true;
+
+create or replace function set_updated_at()
+returns trigger as $$
+begin
+ new.updated_at := now();
+ return new;
+end;
+$$ language plpgsql;
+
+create trigger trigger_set_updated_at
+before update on profile
+for each row
+execute function set_updated_at();
diff --git a/crates/profile-service/profile.toml b/crates/profile-service/profile.toml
new file mode 100644
index 0000000..13a5f0a
--- /dev/null
+++ b/crates/profile-service/profile.toml
@@ -0,0 +1,37 @@
+[application]
+env = "development"
+port = 1610
+
+[monitoring]
+log-level = "sellershut_profiles=trace,info"
+
+[misc]
+temp-ttl = 1000
+cache-ttl = 300
+
+[database]
+pool_size = 100
+port = 5432
+name = "profiles"
+host = "localhost"
+password = "password"
+user = "postgres"
+
+[nats]
+hosts = ["nats://localhost:4222"]
+
+[cache]
+dsn = "redis://localhost:6379"
+pooled = true
+type = "non-clustered" # clustered, non-clustered or sentinel
+max-connections = 100
+
+[cache.sentinel]
+master-name = "mymaster"
+nodes = [
+ { host = "127.0.0.1", port = 26379 },
+ { host = "127.0.0.2", port = 26379 },
+ { host = "127.0.0.3", port = 26379 },
+]
+
+# vim:ft=toml
diff --git a/crates/profile-service/src/cnfg.rs b/crates/profile-service/src/cnfg.rs
new file mode 100644
index 0000000..fec4cf7
--- /dev/null
+++ b/crates/profile-service/src/cnfg.rs
@@ -0,0 +1,8 @@
+use serde::Deserialize;
+
+#[derive(Deserialize, Clone)]
+#[serde(rename_all = "kebab-case")]
+pub struct LocalConfig {
+ pub temp_ttl: u64,
+ pub cache_ttl: u64,
+}
diff --git a/crates/profile-service/src/main.rs b/crates/profile-service/src/main.rs
index e7a11a9..5fe1331 100644
--- a/crates/profile-service/src/main.rs
+++ b/crates/profile-service/src/main.rs
@@ -1,3 +1,110 @@
-fn main() {
- println!("Hello, world!");
+mod cnfg;
+mod server;
+mod state;
+use std::net::{Ipv6Addr, SocketAddr};
+
+use clap::Parser;
+use sellershut_core::profile::profile_server::ProfileServer;
+use stack_up::{Configuration, Services, tracing::Tracing};
+use tokio::signal;
+use tonic::transport::{Server, server::TcpIncoming};
+use tracing::{error, info};
+
+use crate::{
+ server::interceptor::MyInterceptor,
+ state::{AppHandle, AppState},
+};
+
+/// sellershut-profiles
+#[derive(Parser, Debug)]
+#[command(version, about, long_about = None)]
+struct Args {
+ /// Path to config file
+ #[arg(short, long)]
+ config_file: Option<std::path::PathBuf>,
+}
+
+#[tokio::main]
+async fn main() -> anyhow::Result<()> {
+ let args = Args::parse();
+ let config = include_str!("../profile.toml");
+
+ let mut config = config::Config::builder()
+ .add_source(config::File::from_str(config, config::FileFormat::Toml));
+
+ if let Some(cf) = args.config_file.as_ref().and_then(|v| v.to_str()) {
+ config = config.add_source(config::File::new(cf, config::FileFormat::Toml));
+ };
+
+ let mut config: Configuration = config.build()?.try_deserialize()?;
+ config.application.name = env!("CARGO_CRATE_NAME").into();
+ config.application.version = env!("CARGO_PKG_VERSION").into();
+
+ let tracing = Tracing::builder().build(&config.monitoring);
+
+ let mut services = Services::builder()
+ .postgres(&config.database)
+ .await
+ .inspect_err(|e| error!("database: {e}"))?
+ .cache(&config.cache)
+ .await
+ .inspect_err(|e| error!("cache: {e}"))?
+ .build();
+
+ let postgres = services
+ .postgres
+ .take()
+ .ok_or_else(|| anyhow::anyhow!("database is not ready"))?;
+
+ let cache = services
+ .cache
+ .take()
+ .ok_or_else(|| anyhow::anyhow!("cache is not ready"))?;
+
+ let services = crate::state::Services { postgres, cache };
+
+ let state = AppState::create(services, &config).await?;
+
+ let addr = SocketAddr::from((Ipv6Addr::UNSPECIFIED, config.application.port));
+
+ let listener = tokio::net::TcpListener::bind(addr).await?;
+
+ info!(addr = ?addr, "starting server");
+
+ Server::builder()
+ .trace_fn(|_| tracing::info_span!(env!("CARGO_PKG_NAME")))
+ // .add_service(QueryUsersServer::new(state.clone()))
+ .add_service(ProfileServer::with_interceptor(
+ state.clone(),
+ MyInterceptor,
+ ))
+ .serve_with_incoming_shutdown(TcpIncoming::from(listener), shutdown_signal(state))
+ .await?;
+
+ Ok(())
+}
+async fn shutdown_signal(state: AppHandle) {
+ let ctrl_c = async {
+ signal::ctrl_c()
+ .await
+ .expect("failed to install Ctrl+C handler");
+ };
+
+ #[cfg(unix)]
+ let terminate = async {
+ signal::unix::signal(signal::unix::SignalKind::terminate())
+ .expect("failed to install signal handler")
+ .recv()
+ .await;
+ };
+
+ #[cfg(not(unix))]
+ let terminate = std::future::pending::<()>();
+
+ tokio::select! {
+ _ = ctrl_c => {
+ },
+ _ = terminate => {
+ },
+ }
}
diff --git a/crates/profile-service/src/server.rs b/crates/profile-service/src/server.rs
new file mode 100644
index 0000000..b2e04f9
--- /dev/null
+++ b/crates/profile-service/src/server.rs
@@ -0,0 +1,2 @@
+pub mod interceptor;
+pub mod manager;
diff --git a/crates/profile-service/src/server/interceptor.rs b/crates/profile-service/src/server/interceptor.rs
new file mode 100644
index 0000000..6fbe7fa
--- /dev/null
+++ b/crates/profile-service/src/server/interceptor.rs
@@ -0,0 +1,11 @@
+use tonic::{Status, service::Interceptor};
+use tracing::Span;
+
+#[derive(Clone, Copy)]
+pub struct MyInterceptor;
+
+impl Interceptor for MyInterceptor {
+ fn call(&mut self, request: tonic::Request<()>) -> Result<tonic::Request<()>, Status> {
+ Ok(request)
+ }
+}
diff --git a/crates/profile-service/src/server/manager.rs b/crates/profile-service/src/server/manager.rs
new file mode 100644
index 0000000..bd7e149
--- /dev/null
+++ b/crates/profile-service/src/server/manager.rs
@@ -0,0 +1,45 @@
+use prost::Message;
+use sellershut_core::profile::{
+ CompleteUserRequest, CreateUserRequest, CreateUserResponse, User, profile_server::Profile,
+};
+use stack_up::redis::AsyncCommands;
+use tonic::{Request, Response, Status, async_trait};
+use tracing::trace;
+use uuid::Uuid;
+
+use crate::state::AppHandle;
+
+#[async_trait]
+impl Profile for AppHandle {
+ #[doc = " Create a new user profile"]
+ async fn create_user(
+ &self,
+ request: Request<CreateUserRequest>,
+ ) -> Result<Response<CreateUserResponse>, Status> {
+ trace!("creating user");
+ let data = request.into_inner();
+ let id = Uuid::now_v7().to_string();
+
+ let bytes = data.encode_to_vec();
+ let mut cache = self
+ .services
+ .cache
+ .get()
+ .await
+ .map_err(|e| Status::internal("storage not ready"))?;
+ cache
+ .set_ex::<_, _, ()>(&id, &bytes, self.local_config.temp_ttl)
+ .await
+ .map_err(|e| Status::internal("storage not ready"))?;
+
+ Ok(Response::new(CreateUserResponse { temp_id: id }))
+ }
+
+ #[doc = " Complete Profile"]
+ async fn complete_profile(
+ &self,
+ request: Request<CompleteUserRequest>,
+ ) -> Result<Response<User>, Status> {
+ todo!()
+ }
+}
diff --git a/crates/profile-service/src/state.rs b/crates/profile-service/src/state.rs
new file mode 100644
index 0000000..1ccfbfd
--- /dev/null
+++ b/crates/profile-service/src/state.rs
@@ -0,0 +1,42 @@
+use std::sync::Arc;
+
+use sqlx::PgPool;
+use stack_up::{Configuration, cache::RedisManager};
+
+use crate::cnfg::LocalConfig;
+
+#[derive(Clone)]
+pub struct AppHandle(Arc<AppState>);
+
+impl std::ops::Deref for AppHandle {
+ type Target = Arc<AppState>;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+#[derive(Clone)]
+pub struct Services {
+ pub postgres: PgPool,
+ pub cache: RedisManager,
+}
+
+pub struct AppState {
+ pub services: Services,
+ pub local_config: LocalConfig,
+}
+
+impl AppState {
+ pub async fn create(
+ services: Services,
+ configuration: &Configuration,
+ ) -> Result<AppHandle, anyhow::Error> {
+ let local_config: LocalConfig = serde_json::from_value(configuration.misc.clone())?;
+
+ Ok(AppHandle(Arc::new(Self {
+ services,
+ local_config,
+ })))
+ }
+}
diff --git a/crates/sellershut/src/server/activities/follow.rs b/crates/sellershut/src/server/activities/follow.rs
index 90b3aff..19bc4e7 100644
--- a/crates/sellershut/src/server/activities/follow.rs
+++ b/crates/sellershut/src/server/activities/follow.rs
@@ -122,13 +122,13 @@ impl Activity for Follow {
#[cfg(test)]
mod tests {
+ use crate::state::Services;
use axum::{
body::Body,
http::{Request, StatusCode},
};
use sqlx::PgPool;
use tower::ServiceExt;
- use crate::state::Services;
use crate::{
server::{self, test_config},
diff --git a/crates/sellershut/src/server/routes.rs b/crates/sellershut/src/server/routes.rs
index fc34ff0..c771f94 100644
--- a/crates/sellershut/src/server/routes.rs
+++ b/crates/sellershut/src/server/routes.rs
@@ -10,12 +10,12 @@ pub async fn health_check() -> impl IntoResponse {
#[cfg(test)]
mod tests {
+ use crate::state::Services;
use axum::{
body::Body,
http::{Request, StatusCode},
};
use sqlx::PgPool;
- use crate::state::Services;
use tower::ServiceExt;
use crate::{
diff --git a/crates/sellershut/src/server/routes/users/followers.rs b/crates/sellershut/src/server/routes/users/followers.rs
index 3b6f2ea..9f2b147 100644
--- a/crates/sellershut/src/server/routes/users/followers.rs
+++ b/crates/sellershut/src/server/routes/users/followers.rs
@@ -55,6 +55,7 @@ pub async fn http_get_followers(
#[cfg(test)]
mod tests {
+ use crate::state::Services;
use axum::{
body::Body,
http::{Request, StatusCode},
@@ -62,7 +63,6 @@ mod tests {
use serde::{Deserialize, Serialize};
use serde_json::Value;
use sqlx::PgPool;
- use crate::state::Services;
use tower::ServiceExt;
use url::Url;
diff --git a/crates/sellershut/src/server/routes/users/get_outbox.rs b/crates/sellershut/src/server/routes/users/get_outbox.rs
index 48d2e04..b1a132b 100644
--- a/crates/sellershut/src/server/routes/users/get_outbox.rs
+++ b/crates/sellershut/src/server/routes/users/get_outbox.rs
@@ -24,12 +24,12 @@ pub async fn http_get_outbox(
#[cfg(test)]
mod tests {
+ use crate::state::Services;
use axum::{
body::Body,
http::{Request, StatusCode},
};
use sqlx::PgPool;
- use crate::state::Services;
use tower::ServiceExt;
use crate::{
diff --git a/crates/sellershut/src/server/routes/users/get_user.rs b/crates/sellershut/src/server/routes/users/get_user.rs
index 32cee42..1d8048f 100644
--- a/crates/sellershut/src/server/routes/users/get_user.rs
+++ b/crates/sellershut/src/server/routes/users/get_user.rs
@@ -47,12 +47,12 @@ pub async fn read_user(
#[cfg(test)]
mod tests {
+ use crate::state::Services;
use axum::{
body::Body,
http::{Request, StatusCode},
};
use sqlx::PgPool;
- use crate::state::Services;
use tower::ServiceExt;
use crate::{
diff --git a/crates/sellershut/src/server/routes/users/webfinger.rs b/crates/sellershut/src/server/routes/users/webfinger.rs
index 3096a03..c503c0e 100644
--- a/crates/sellershut/src/server/routes/users/webfinger.rs
+++ b/crates/sellershut/src/server/routes/users/webfinger.rs
@@ -33,12 +33,12 @@ pub async fn webfinger(
#[cfg(test)]
mod tests {
+ use crate::state::Services;
use axum::{
body::Body,
http::{Request, StatusCode},
};
use sqlx::PgPool;
- use crate::state::Services;
use tower::ServiceExt;
use crate::{