add match page

This commit is contained in:
Robin Appelman 2023-11-19 00:16:50 +01:00
commit 668edc434a
9 changed files with 3614 additions and 7 deletions

2
api-server/Cargo.lock generated
View file

@ -1743,8 +1743,6 @@ dependencies = [
[[package]]
name = "ugc-scraper"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a65a605e079609b2f105c2f8930a0fb6786766fae5ef8776692cbb8a85b2b56"
dependencies = [
"reqwest",
"scraper",

View file

@ -64,6 +64,7 @@ async fn main() -> MainResult {
.route("/team/:id", get(team))
.route("/team/:id/roster", get(team_roster))
.route("/team/:id/matches", get(team_matches))
.route("/match/:id", get(match_page))
.with_state(AppState::default());
// run it
@ -150,3 +151,13 @@ async fn team_matches(
let response = state.client.team_matches(id).await?;
Ok(Json(response))
}
#[instrument(skip(state))]
async fn match_page(
Path(id): Path<u32>,
State(state): State<AppState>,
) -> Result<impl IntoResponse, ApiError> {
debug!(team = id, "requesting match");
let response = state.client.match_info(id).await?;
Ok(Json(response))
}