storage: introduce find_active_for_session for PATs
This commit is contained in:
@@ -50,6 +50,22 @@ pub trait PersonalAccessTokenRepository: Send + Sync {
|
||||
access_token: &str,
|
||||
) -> Result<Option<PersonalAccessToken>, Self::Error>;
|
||||
|
||||
/// Find the active access token belonging to a given session.
|
||||
///
|
||||
/// Returns the active access token if it exists, `None` otherwise
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `session_id`: The ID of the session to lookup
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns [`Self::Error`] if the underlying repository fails
|
||||
async fn find_active_for_session(
|
||||
&mut self,
|
||||
session_id: Ulid,
|
||||
) -> Result<Option<PersonalAccessToken>, Self::Error>;
|
||||
|
||||
/// Add a new access token to the database
|
||||
///
|
||||
/// Returns the newly created access token
|
||||
@@ -102,6 +118,11 @@ repository_impl!(PersonalAccessTokenRepository:
|
||||
access_token: &str,
|
||||
) -> Result<Option<PersonalAccessToken>, Self::Error>;
|
||||
|
||||
async fn find_active_for_session(
|
||||
&mut self,
|
||||
session_id: Ulid,
|
||||
) -> Result<Option<PersonalAccessToken>, Self::Error>;
|
||||
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
|
||||
Reference in New Issue
Block a user