feat(db): client db access
Build Docker Image / build-nightly (push) Successful in 1m46s Details

This commit is contained in:
subcrip 2024-04-09 00:16:23 +08:00
parent 72f4df12ad
commit 96619e7c43
Signed by: subcrip
SSH Key Fingerprint: SHA256:dFPFi68d8C87YkFkEBU4TkcrYRySWpekRR1hbnDWUCw
1 changed files with 8 additions and 0 deletions

View File

@ -114,6 +114,14 @@ impl OAuthDatabase {
self.psql_execute("insert into ResourceDBAccess(resource_db_id, resource_id, resource_db_token, resource_db_desc) values ($1, $2, $3, $4)", &[&hashed.resource_db_id, &hashed.resource_id, &hashed.resource_db_token, &hashed.resource_db_desc]).await?; self.psql_execute("insert into ResourceDBAccess(resource_db_id, resource_id, resource_db_token, resource_db_desc) values ($1, $2, $3, $4)", &[&hashed.resource_db_id, &hashed.resource_id, &hashed.resource_db_token, &hashed.resource_db_desc]).await?;
Ok(access) Ok(access)
} }
pub async fn trusted_issue_client_db_token(&mut self, client_id: &Uuid, description: &String) -> Result<crate::oauth_types::oauth_access::OAuthClientDBAccess, tokio_postgres::Error> {
// TEST: functionality
let access = crate::oauth_types::oauth_access::OAuthClientDBAccess::create(client_id, description);
let hashed = crate::oauth_types::oauth_access::OAuthHashedClientDBAccess::from(&access);
self.psql_execute("insert into ClientDBAccess(client_db_id, client_id, client_db_token, client_db_desc)", &[&hashed.client_db_id, &hashed.client_id, &hashed.client_db_token, &hashed.client_db_desc]).await?;
Ok(access)
}
} }
#[cfg(test)] #[cfg(test)]