From e50ffe1dae24851f36b2603b930eeb66d87a12d9 Mon Sep 17 00:00:00 2001 From: Malted Date: Sun, 21 Jan 2024 23:38:39 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Use=20the=20correct=20record=20orde?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1c1a001..7b6ce6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,7 +78,9 @@ impl Team { let client = reqwest::blocking::Client::new(); let res = client - .get(format!("https://api.airtable.com/v0/{app_id}/Current")) + .get(format!( + "https://api.airtable.com/v0/{app_id}/Current?view=Grid%20view" + )) .header(reqwest::header::AUTHORIZATION, format!("Bearer {token}")) .send() .unwrap() @@ -153,13 +155,13 @@ fn get_team(team: &State>) -> Json { Json(team.read().clone()) } -#[post("/?", format = "json", data = "")] -fn update_team(team: &State>, input: Json, token: String) -> Json { +#[post("/?")] +fn notify_team_change(team: &State>, token: String) -> Json { if token != var("TEAM_SERVER_SECRET").expect("a token") { return Json(String::from("invalid token")); } - *team.write() = Team::from_raw_airtable(input.into_inner()); + *team.write() = Team::fetch(); Json(String::from("success!")) } @@ -174,6 +176,6 @@ fn rocket() -> _ { } rocket::custom(config) - .mount("/", routes![get_team, update_team]) + .mount("/", routes![get_team, notify_team_change]) .manage(RwLock::new(Team::fetch())) }