You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
graphql: allow filtering appsessions on device_id
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
//! Repositories to interact with all kinds of sessions
|
||||
|
||||
use async_trait::async_trait;
|
||||
use mas_data_model::{CompatSession, Session, User};
|
||||
use mas_data_model::{CompatSession, Device, Session, User};
|
||||
|
||||
use crate::{repository_impl, Page, Pagination};
|
||||
|
||||
@ -57,6 +57,7 @@ pub enum AppSession {
|
||||
pub struct AppSessionFilter<'a> {
|
||||
user: Option<&'a User>,
|
||||
state: Option<AppSessionState>,
|
||||
device_id: Option<&'a Device>,
|
||||
}
|
||||
|
||||
impl<'a> AppSessionFilter<'a> {
|
||||
@ -79,6 +80,19 @@ impl<'a> AppSessionFilter<'a> {
|
||||
self.user
|
||||
}
|
||||
|
||||
/// Set the device ID filter
|
||||
#[must_use]
|
||||
pub fn for_device(mut self, device_id: &'a Device) -> Self {
|
||||
self.device_id = Some(device_id);
|
||||
self
|
||||
}
|
||||
|
||||
/// Get the device ID filter
|
||||
#[must_use]
|
||||
pub fn device(&self) -> Option<&'a Device> {
|
||||
self.device_id
|
||||
}
|
||||
|
||||
/// Only return active compatibility sessions
|
||||
#[must_use]
|
||||
pub fn active_only(mut self) -> Self {
|
||||
|
Reference in New Issue
Block a user