Skip to main content

shared/application/auth/
account_service.rs

1use crate::error::Result;
2
3use crate::domain::model::Account;
4use crate::intern::auth::AuthService;
5
6impl AuthService {
7    #[tracing::instrument(
8        name = "auth.find_account", skip(self), fields(user.id = user_id)
9    )]
10    pub async fn find_account(&self, user_id: &str) -> Result<Account> {
11        self.account_repository.find(user_id).await
12    }
13
14    #[tracing::instrument(
15        name = "auth.update_user_password", skip(self, hash), fields(user.id = id)
16    )]
17    pub async fn update_user_password(&self, id: &str, hash: &str) -> Result<Account> {
18        self.account_repository.update_password(id, hash).await
19    }
20
21    #[tracing::instrument(
22        name = "auth.unlock_account", skip(self), fields(user.id = id)
23    )]
24    pub async fn unlock_account(&self, id: &str) -> Result<Account> {
25        self.account_repository.unlock_account(id).await
26    }
27
28    #[tracing::instrument(
29        name = "auth.validate_account",
30        skip(self),
31        fields(user.id = id)
32    )]
33    pub async fn validate_account(&self, id: &str) -> Result<()> {
34        self.account_repository.validate_account(id).await
35    }
36}