Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3113684
D3962.id13185.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
D3962.id13185.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
@@ -158,6 +158,64 @@
}
}
}
+
+ pub async fn put_token(
+ &self,
+ token: AccessToken,
+ ) -> Result<PutItemOutput, Error> {
+ let input = PutItemInput {
+ table_name: "identity-tokens".to_string(),
+ item: HashMap::from([
+ (
+ "userID".to_string(),
+ AttributeValue {
+ s: Some(token.user_id),
+ ..Default::default()
+ },
+ ),
+ (
+ "deviceID".to_string(),
+ AttributeValue {
+ s: Some(token.device_id),
+ ..Default::default()
+ },
+ ),
+ (
+ "token".to_string(),
+ AttributeValue {
+ s: Some(token.token),
+ ..Default::default()
+ },
+ ),
+ (
+ "created".to_string(),
+ AttributeValue {
+ s: Some(token.created.to_rfc3339()),
+ ..Default::default()
+ },
+ ),
+ (
+ "authType".to_string(),
+ AttributeValue {
+ s: Some(match token.auth_type {
+ AuthType::Password => "password".to_string(),
+ AuthType::Wallet => "wallet".to_string(),
+ }),
+ ..Default::default()
+ },
+ ),
+ (
+ "valid".to_string(),
+ AttributeValue {
+ bool: Some(token.valid),
+ ..Default::default()
+ },
+ ),
+ ]),
+ ..PutItemInput::default()
+ };
+ self.client.put_item(input).await.map_err(Error::RusotoPut)
+ }
}
#[derive(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 1, 6:20 PM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2400488
Default Alt Text
D3962.id13185.diff (1 KB)
Attached To
Mode
D3962: [Identity] DatabaseClient method to put tokens in DDB
Attached
Detach File
Event Timeline
Log In to Comment