refactoring hexagonal and clean architecture
This commit is contained in:
@@ -15,6 +15,7 @@ use crate::{
|
||||
ports::share_ports::ShareUseCase
|
||||
},
|
||||
common::errors::ErrorKind,
|
||||
interfaces::middleware::auth::AuthUser,
|
||||
};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -31,10 +32,10 @@ pub struct VerifyPasswordRequest {
|
||||
/// Create a new shared link
|
||||
pub async fn create_shared_link(
|
||||
State(share_use_case): State<Arc<dyn ShareUseCase>>,
|
||||
auth_user: AuthUser,
|
||||
Json(dto): Json<CreateShareDto>,
|
||||
) -> impl IntoResponse {
|
||||
// For now, we'll use a default user ID until auth is implemented
|
||||
let user_id = "default-user";
|
||||
let user_id = &auth_user.id;
|
||||
match share_use_case.create_shared_link(&user_id, dto).await {
|
||||
Ok(share) => (StatusCode::CREATED, Json(share)).into_response(),
|
||||
Err(err) => {
|
||||
@@ -68,10 +69,10 @@ pub async fn get_shared_link(
|
||||
/// Get all shared links created by the current user
|
||||
pub async fn get_user_shares(
|
||||
State(share_use_case): State<Arc<dyn ShareUseCase>>,
|
||||
auth_user: AuthUser,
|
||||
Query(query): Query<GetSharesQuery>,
|
||||
) -> impl IntoResponse {
|
||||
// For now, we'll use a default user ID until auth is implemented
|
||||
let user_id = "default-user";
|
||||
let user_id = &auth_user.id;
|
||||
let page = query.page.unwrap_or(1);
|
||||
let per_page = query.per_page.unwrap_or(20);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user