Skip to content

Commit 1e188f4

Browse files
committed
feat(http): add queue status endpoint
1 parent 51ac06c commit 1e188f4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/adapters/http/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl HttpAdapter {
3939
});
4040

4141
let app = Router::new()
42+
.route("/{guild_id}/status", get(queue_status))
4243
.route("/{guild_id}/queue", get(list_queue))
4344
.route("/{guild_id}/queue/ws", any(list_queue_ws))
4445
.layer(ServiceBuilder::new().layer(TraceLayer::new_for_http()))
@@ -51,6 +52,12 @@ impl HttpAdapter {
5152
}
5253
}
5354

55+
async fn queue_status(State(state): State<Arc<AppState>>, Path(guild_id): Path<String>) -> String {
56+
let is_open = state.queue.is_open(&guild_id);
57+
let status = if is_open { "open" } else { "closed" };
58+
status.to_string()
59+
}
60+
5461
async fn list_queue(
5562
State(state): State<Arc<AppState>>,
5663
Path(guild_id): Path<String>,

0 commit comments

Comments
 (0)