added date-specific timetable request

This commit is contained in:
Denys Konovalov 2021-12-05 15:18:19 +01:00
parent 548cb37759
commit 3107fea36f
2 changed files with 13 additions and 1 deletions

@ -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>"]

@ -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;