2025-09-26 23:15:33 +07:00
|
|
|
/*!
|
|
|
|
|
# imphnen-libs
|
|
|
|
|
|
|
|
|
|
A collection of utility libraries and services for the imphnen project, providing integrations
|
|
|
|
|
with various external services and common functionality.
|
|
|
|
|
|
|
|
|
|
This crate includes modules for:
|
|
|
|
|
- Password hashing with Argon2 (`argon`)
|
|
|
|
|
- Axum web framework utilities (`axum`)
|
|
|
|
|
- Environment configuration (`environment`)
|
|
|
|
|
- JWT token handling (`jsonwebtoken`)
|
|
|
|
|
- Email sending with Lettre (`lettre`)
|
|
|
|
|
- MinIO object storage client (`minio`)
|
|
|
|
|
- Service abstractions (`services`)
|
|
|
|
|
- SurrealDB database client (`surrealdb`)
|
|
|
|
|
*/
|
|
|
|
|
|
2025-09-26 15:05:45 +07:00
|
|
|
use std::sync::Arc;
|
2025-04-06 13:25:44 +07:00
|
|
|
|
2025-02-07 22:26:32 +07:00
|
|
|
pub mod argon;
|
2025-02-03 21:53:42 +07:00
|
|
|
pub mod axum;
|
2025-09-26 23:15:33 +07:00
|
|
|
pub mod environment;
|
2025-02-07 22:26:32 +07:00
|
|
|
pub mod jsonwebtoken;
|
2025-02-16 01:09:55 +07:00
|
|
|
pub mod lettre;
|
2025-08-14 13:16:39 +07:00
|
|
|
pub mod minio;
|
2025-09-26 15:05:45 +07:00
|
|
|
pub mod services;
|
2025-02-25 02:00:19 +07:00
|
|
|
pub mod surrealdb;
|
2025-02-07 22:26:32 +07:00
|
|
|
|
2025-09-26 17:35:30 +07:00
|
|
|
pub use argon::{hash_password, verify_password};
|
|
|
|
|
pub use axum::axum_init;
|
2025-09-26 23:15:33 +07:00
|
|
|
pub use environment::{ENV, Env};
|
2025-09-26 17:35:30 +07:00
|
|
|
pub use imphnen_entities::{
|
|
|
|
|
MessageResponseDto,
|
|
|
|
|
MetaRequestDto,
|
|
|
|
|
MetaResponseDto,
|
|
|
|
|
ResponseSuccessDto,
|
|
|
|
|
ResponseListSuccessDto,
|
|
|
|
|
CountResult,
|
|
|
|
|
Error,
|
|
|
|
|
ExperienceDto,
|
|
|
|
|
EducationDto,
|
|
|
|
|
UsersDetailQueryDto,
|
|
|
|
|
PermissionsEnum,
|
|
|
|
|
PermissionsItemDto,
|
|
|
|
|
PermissionsQueryDto,
|
|
|
|
|
};
|
|
|
|
|
pub use jsonwebtoken::{
|
|
|
|
|
Claims, encode_access_token, encode_refresh_token, decode_access_token,
|
|
|
|
|
decode_refresh_token, encode_reset_password_token, generate_jwt
|
|
|
|
|
};
|
|
|
|
|
pub use lettre::send_email;
|
|
|
|
|
pub use minio::*; // Minio has many useful exports, keeping for now
|
|
|
|
|
pub use services::{UserLookupService, AuthRepositoryTrait};
|
|
|
|
|
pub use surrealdb::{
|
|
|
|
|
surrealdb_init_ws, surrealdb_init_mem, SurrealWsClient, SurrealMemClient,
|
|
|
|
|
ResourceEnum
|
|
|
|
|
};
|
2025-09-26 15:05:45 +07:00
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub struct AppState {
|
|
|
|
|
pub surrealdb_ws: SurrealWsClient,
|
|
|
|
|
pub surrealdb_mem: SurrealMemClient,
|
|
|
|
|
pub user_lookup_service: Arc<dyn UserLookupService>,
|
|
|
|
|
pub auth_repository: Arc<dyn AuthRepositoryTrait>,
|
|
|
|
|
}
|