mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 10:14:11 +02:00
add match page
This commit is contained in:
parent
caf376ac42
commit
668edc434a
9 changed files with 3614 additions and 7 deletions
2
api-server/Cargo.lock
generated
2
api-server/Cargo.lock
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue