Changeset View
Changeset View
Standalone View
Standalone View
services/identity/src/database.rs
Show First 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | self | ||||
.put_item() | .put_item() | ||||
.table_name(ACCESS_TOKEN_TABLE) | .table_name(ACCESS_TOKEN_TABLE) | ||||
.set_item(Some(item)) | .set_item(Some(item)) | ||||
.send() | .send() | ||||
.await | .await | ||||
.map_err(|e| Error::AwsSdk(e.into())) | .map_err(|e| Error::AwsSdk(e.into())) | ||||
} | } | ||||
pub async fn username_available( | |||||
&self, | |||||
username: String, | |||||
) -> Result<bool, Error> { | |||||
let result = self | |||||
.get_user_id_from_user_info(username, AuthType::Password) | |||||
.await?; | |||||
Ok(result.is_none()) | |||||
} | |||||
pub async fn get_user_id_from_user_info( | pub async fn get_user_id_from_user_info( | ||||
&self, | &self, | ||||
user_info: String, | user_info: String, | ||||
auth_type: AuthType, | auth_type: AuthType, | ||||
) -> Result<Option<String>, Error> { | ) -> Result<Option<String>, Error> { | ||||
let (index, attribute_name) = match auth_type { | let (index, attribute_name) = match auth_type { | ||||
AuthType::Password => { | AuthType::Password => { | ||||
(USERS_TABLE_USERNAME_INDEX, USERS_TABLE_USERNAME_ATTRIBUTE) | (USERS_TABLE_USERNAME_INDEX, USERS_TABLE_USERNAME_ATTRIBUTE) | ||||
▲ Show 20 Lines • Show All 416 Lines • Show Last 20 Lines |