fixed issues
This commit is contained in:
parent
3107fea36f
commit
f6156559f8
16
src/main.rs
16
src/main.rs
@ -201,6 +201,16 @@ async fn get_tomorrow_timetable(
|
|||||||
Json::from(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>")]
|
#[get("/<class>")]
|
||||||
async fn get_latest_class_timetable(
|
async fn get_latest_class_timetable(
|
||||||
conn: DbConn,
|
conn: DbConn,
|
||||||
@ -249,7 +259,7 @@ async fn get_tomorrow_class_timetable(
|
|||||||
async fn get_daily_class_timetable(
|
async fn get_daily_class_timetable(
|
||||||
conn: DbConn,
|
conn: DbConn,
|
||||||
class: String,
|
class: String,
|
||||||
key: ApiKey<'_>,
|
_key: ApiKey<'_>,
|
||||||
date: String,
|
date: String,
|
||||||
) -> Json<timetable_connector::TimetableData> {
|
) -> Json<timetable_connector::TimetableData> {
|
||||||
let timetable =
|
let timetable =
|
||||||
@ -286,7 +296,9 @@ fn rocket() -> _ {
|
|||||||
get_today_timetable,
|
get_today_timetable,
|
||||||
get_today_class_timetable,
|
get_today_class_timetable,
|
||||||
get_tomorrow_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])
|
.mount("/api/classes", routes![get_classes])
|
||||||
|
Reference in New Issue
Block a user