Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32432957
D3962.1765356574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D3962.1765356574.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
Wed, Dec 10, 8:49 AM (14 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5862604
Default Alt Text
D3962.1765356574.diff (1 KB)
Attached To
Mode
D3962: [Identity] DatabaseClient method to put tokens in DDB
Attached
Detach File
Event Timeline
Log In to Comment