Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2754392
D12831.id42598.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12831.id42598.diff
View Options
diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -933,23 +933,31 @@
})
}
+ /// Returns all usernames and wallet addresses from `identity-users` table
async fn get_all_usernames(&self) -> Result<Vec<String>, Error> {
let scan_output = self
.client
.scan()
.table_name(USERS_TABLE)
- .projection_expression(USERS_TABLE_USERNAME_ATTRIBUTE)
+ .projection_expression("#username, #walletAddress")
+ .expression_attribute_names("#username", USERS_TABLE_USERNAME_ATTRIBUTE)
+ .expression_attribute_names(
+ "#walletAddress",
+ USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE,
+ )
.send()
.await
.map_err(|e| Error::AwsSdk(e.into()))?;
let mut result = Vec::new();
- if let Some(attributes) = scan_output.items {
- for mut attribute in attributes {
- if let Ok(username) =
- attribute.take_attr(USERS_TABLE_USERNAME_ATTRIBUTE)
- {
+ if let Some(items) = scan_output.items {
+ for mut item in items {
+ if let Ok(username) = item.take_attr(USERS_TABLE_USERNAME_ATTRIBUTE) {
result.push(username);
+ } else if let Ok(wallet_address) =
+ item.take_attr(USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE)
+ {
+ result.push(wallet_address);
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 19, 7:03 PM (8 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2141942
Default Alt Text
D12831.id42598.diff (1 KB)
Attached To
Mode
D12831: [identity] get all usernames and wallet addresses in get_all_usernames
Attached
Detach File
Event Timeline
Log In to Comment