Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3174357
D13225.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
D13225.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
@@ -436,6 +436,41 @@
Ok(())
}
+ pub async fn update_wallet_user_social_proof(
+ &self,
+ user_id: &str,
+ social_proof: SocialProof,
+ ) -> Result<(), Error> {
+ self
+ .client
+ .update_item()
+ .table_name(USERS_TABLE)
+ .key(
+ USERS_TABLE_PARTITION_KEY,
+ AttributeValue::S(user_id.to_string()),
+ )
+ .update_expression("SET #social_proof = :v")
+ .condition_expression("attribute_exists(#social_proof)")
+ .expression_attribute_names(
+ "#social_proof",
+ USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME,
+ )
+ .expression_attribute_values(":v", social_proof.into())
+ .send()
+ .await
+ .map_err(|e| {
+ // ConditionalCheckFailedException means we're updating
+ // non-wallet user (DB item without social proof)
+ error!(
+ errorType = error_types::GENERIC_DB_LOG,
+ "DynamoDB client failed to update social proof: {:?}", e
+ );
+ Error::AwsSdk(e.into())
+ })?;
+
+ Ok(())
+ }
+
pub async fn get_keyserver_keys_for_user(
&self,
user_id: &str,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 4:18 PM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444550
Default Alt Text
D13225.diff (1 KB)
Attached To
Mode
D13225: [identity] Add function to update social proof
Attached
Detach File
Event Timeline
Log In to Comment