Skip to content

Commit

Permalink
fix: media session get current false positive (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiroaisen authored Dec 21, 2023
2 parents d2300c0 + c6df3ef commit 840e8e7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rs/packages/db/src/models/media_session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,18 @@ impl MediaSession {
pub async fn get_current_for_station(
station_id: &str,
) -> Result<Option<MediaSession>, mongodb::error::Error> {

// TODO: improve this
let open_deployment_ids = crate::deployment::Deployment::cl().distinct(
crate::deployment::Deployment::KEY_ID,
doc! {
crate::deployment::Deployment::KEY_STATE: crate::deployment::DeploymentState::KEY_ENUM_VARIANT_ACTIVE
},
None
).await?;

let filter = doc! {
MediaSession::KEY_DEPLOYMENT_ID: { "$in": open_deployment_ids },
MediaSession::KEY_STATION_ID: station_id,
MediaSession::KEY_STATE: MediaSessionState::KEY_ENUM_VARIANT_OPEN
};
Expand Down

0 comments on commit 840e8e7

Please sign in to comment.