- Add `FilamentService` for managing filament inventory, including creation, retrieval, updating, and deletion of filaments. - Introduce `SpoolPresetService` for handling spool presets, allowing users to create, update, and delete their custom presets. - Create domain models for `Filament` and `SpoolPreset` with necessary fields and methods. - Define repository interfaces for filament and spool preset persistence. - Implement application configuration management from environment variables. - Set up error handling with a centralized `AppError` type. - Build the Axum router with public and protected routes for user authentication and resource management.
17 lines
730 B
Rust
17 lines
730 B
Rust
use async_trait::async_trait;
|
|
use uuid::Uuid;
|
|
|
|
use crate::{domain::user::User, error::AppError};
|
|
|
|
/// Port (interface) para operações de persistência de usuários.
|
|
/// Implementado pelo adapter `PostgresUserRepository`.
|
|
#[async_trait]
|
|
pub trait UserRepository: Send + Sync {
|
|
async fn find_by_id(&self, id: Uuid) -> Result<Option<User>, AppError>;
|
|
async fn find_by_email(&self, email: &str) -> Result<Option<User>, AppError>;
|
|
async fn find_by_google_id(&self, google_id: &str) -> Result<Option<User>, AppError>;
|
|
async fn create(&self, user: &User) -> Result<User, AppError>;
|
|
async fn update(&self, user: &User) -> Result<User, AppError>;
|
|
async fn verify_email(&self, id: Uuid) -> Result<(), AppError>;
|
|
}
|