pub struct UserUseCases { /* private fields */ }Implementations§
Source§impl UserUseCases
impl UserUseCases
pub fn new( user_repo: Arc<dyn UserRepository>, role_repo: Arc<dyn UserRoleRepository>, ) -> Self
Sourcepub async fn list_all(&self) -> Result<Vec<UserResponse>, String>
pub async fn list_all(&self) -> Result<Vec<UserResponse>, String>
List all users with their roles.
Sourcepub async fn create(
&self,
email: String,
password_hash: String,
first_name: String,
last_name: String,
primary_role: UserRole,
primary_org: Option<Uuid>,
role_assignments: Vec<UserRoleAssignment>,
) -> Result<UserResponse, String>
pub async fn create( &self, email: String, password_hash: String, first_name: String, last_name: String, primary_role: UserRole, primary_org: Option<Uuid>, role_assignments: Vec<UserRoleAssignment>, ) -> Result<UserResponse, String>
Create a new user with role assignments.
Returns Err("email_exists") on duplicate email.
Sourcepub async fn update(
&self,
id: Uuid,
email: String,
first_name: String,
last_name: String,
primary_role: UserRole,
primary_org: Option<Uuid>,
password_hash: Option<String>,
role_assignments: Vec<UserRoleAssignment>,
) -> Result<Option<UserResponse>, String>
pub async fn update( &self, id: Uuid, email: String, first_name: String, last_name: String, primary_role: UserRole, primary_org: Option<Uuid>, password_hash: Option<String>, role_assignments: Vec<UserRoleAssignment>, ) -> Result<Option<UserResponse>, String>
Update an existing user. Returns None if not found.
Returns Err("email_exists") on duplicate email.
Sourcepub async fn activate(&self, id: Uuid) -> Result<Option<UserResponse>, String>
pub async fn activate(&self, id: Uuid) -> Result<Option<UserResponse>, String>
Activate a user. Returns None if not found.
Sourcepub async fn deactivate(&self, id: Uuid) -> Result<Option<UserResponse>, String>
pub async fn deactivate(&self, id: Uuid) -> Result<Option<UserResponse>, String>
Deactivate a user. Returns None if not found.
Auto Trait Implementations§
impl Freeze for UserUseCases
impl !RefUnwindSafe for UserUseCases
impl Send for UserUseCases
impl Sync for UserUseCases
impl Unpin for UserUseCases
impl !UnwindSafe for UserUseCases
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.