fixed issues

This commit is contained in:
Denys Konovalov 2021-12-05 15:26:29 +01:00
parent 3107fea36f
commit f6156559f8

@ -201,6 +201,16 @@ async fn get_tomorrow_timetable(
Json::from(timetable)
}
#[get("/date/<date>")]
async fn get_daily_timetable(
conn: DbConn,
_key: ApiKey<'_>,
date: String,
) -> Json<Vec<timetable_connector::Timetable>> {
let timetable = timetable_connector::get_timetable(conn, format!("PlanKl{}.xml", date)).await;
Json::from(timetable)
}
#[get("/<class>")]
async fn get_latest_class_timetable(
conn: DbConn,
@ -249,7 +259,7 @@ async fn get_tomorrow_class_timetable(
async fn get_daily_class_timetable(
conn: DbConn,
class: String,
key: ApiKey<'_>,
_key: ApiKey<'_>,
date: String,
) -> Json<timetable_connector::TimetableData> {
let timetable =
@ -286,7 +296,9 @@ fn rocket() -> _ {
get_today_timetable,
get_today_class_timetable,
get_tomorrow_timetable,
get_tomorrow_class_timetable
get_tomorrow_class_timetable,
get_daily_timetable,
get_daily_class_timetable
],
)
.mount("/api/classes", routes![get_classes])