added date-specific timetable request
This commit is contained in:
parent
548cb37759
commit
3107fea36f
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "api"
|
||||
version = "0.7.5"
|
||||
version = "0.7.6"
|
||||
edition = "2018"
|
||||
license = "AGPL-3.0-or-later"
|
||||
authors = ["Denys Konovalov <denys.konovalov@protonmail.com>"]
|
||||
|
12
src/main.rs
12
src/main.rs
@ -245,6 +245,18 @@ async fn get_tomorrow_class_timetable(
|
||||
Json::from(timetable)
|
||||
}
|
||||
|
||||
#[get("/<class>/<date>")]
|
||||
async fn get_daily_class_timetable(
|
||||
conn: DbConn,
|
||||
class: String,
|
||||
key: ApiKey<'_>,
|
||||
date: String,
|
||||
) -> Json<timetable_connector::TimetableData> {
|
||||
let timetable =
|
||||
timetable_connector::get_class_timetable(conn, class, format!("PlanKl{}.xml", date)).await;
|
||||
Json::from(timetable)
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
async fn get_classes(_key: ApiKey<'_>) -> Json<Vec<String>> {
|
||||
let class_list = timetable_connector::get_classes().await;
|
||||
|
Reference in New Issue
Block a user