Add expires filter to personal sessions list

This commit is contained in:
Olivier 'reivilibre
2025-10-21 10:10:14 +01:00
parent 2bf837257c
commit a8adab1301
3 changed files with 46 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ pub struct PersonalSessionFilter<'a> {
last_active_after: Option<DateTime<Utc>>,
expires_before: Option<DateTime<Utc>>,
expires_after: Option<DateTime<Utc>>,
expires: Option<bool>,
}
/// Filter for what state a personal session is in.
@@ -332,4 +333,20 @@ impl<'a> PersonalSessionFilter<'a> {
pub fn expires_after(&self) -> Option<DateTime<Utc>> {
self.expires_after
}
/// Only return sessions whose access tokens have, or don't have,
/// an expiry time set
#[must_use]
pub fn with_expires(mut self, expires: bool) -> Self {
self.expires = Some(expires);
self
}
/// Get the expires filter
///
/// Returns [`None`] if no expires filter was set
#[must_use]
pub fn expires(&self) -> Option<bool> {
self.expires
}
}