This commit is contained in:
2025-10-09 22:41:04 +02:00
parent 768f8cb21c
commit 4a428b9af6
13 changed files with 1019 additions and 50 deletions
+9 -4
View File
@@ -1,6 +1,5 @@
use std::sync::Arc;
use aws_sdk_s3::Client as S3Client;
use diesel::{
pg::PgConnection,
r2d2::{ConnectionManager, PooledConnection},
@@ -11,6 +10,7 @@ use crate::{
config::AppConfig,
db::PgPool,
error::{AppError, AppResult},
storage::ObjectStorage,
};
type PgPooledConnection = PooledConnection<ConnectionManager<PgConnection>>;
@@ -19,16 +19,21 @@ type PgPooledConnection = PooledConnection<ConnectionManager<PgConnection>>;
pub struct AppState {
pub pool: PgPool,
pub config: Arc<AppConfig>,
pub s3: S3Client,
pub storage: Arc<dyn ObjectStorage>,
pub jwt: JwtService,
}
impl AppState {
pub fn new(pool: PgPool, config: AppConfig, s3: S3Client, jwt: JwtService) -> Self {
pub fn new(
pool: PgPool,
config: AppConfig,
storage: Arc<dyn ObjectStorage>,
jwt: JwtService,
) -> Self {
Self {
pool,
config: Arc::new(config),
s3,
storage,
jwt,
}
}