Files
schedule-parser-rusted/src/routes/schedule/group_names.rs
n08i40k 5e39fc9acc feat(schedule)!: move schedule parser, downloader, and updater to external library
This can be used to support more schedule formats in the future.
2025-09-02 08:59:59 +04:00

36 lines
856 B
Rust

use self::schema::*;
use crate::AppState;
use actix_web::{get, web};
#[utoipa::path(responses((status = OK, body = Response)))]
#[get("/group-names")]
pub async fn group_names(app_state: web::Data<AppState>) -> Response {
let mut names: Vec<String> = app_state
.get_schedule_snapshot("eng_polytechnic")
.await
.unwrap()
.data
.groups
.keys()
.cloned()
.collect();
names.sort();
Response { names }
}
mod schema {
use actix_macros::ResponderJson;
use serde::Serialize;
use utoipa::ToSchema;
#[derive(Serialize, ToSchema, ResponderJson)]
#[schema(as = GetGroupNames::Response)]
pub struct Response {
/// List of group names sorted in alphabetical order.
#[schema(examples(json!(["ИС-214/23"])))]
pub names: Vec<String>,
}
}