Skip to main content

api/services/action/
start_next_round.rs

1#[cfg(feature = "server")]
2use dioxus::fullstack::extract::State;
3use dioxus::prelude::*;
4
5#[cfg(feature = "server")]
6use crate::ServerStateExtractor;
7use crate::{
8    dto::{GameIdDTO, UserIdDTO},
9    error::ApiError,
10};
11
12#[post("/api/{user_id}/game/{game_id}/start_next_round", State(server_state): State<ServerStateExtractor>)]
13pub async fn start_next_round(user_id: UserIdDTO, game_id: GameIdDTO) -> Result<(), ApiError> {
14    use server::{
15        action::start_next_round,
16        domain::{GameId, UserId},
17    };
18
19    let user_id = UserId::from(user_id.value());
20    let game_id = GameId::from(game_id.value());
21
22    start_next_round(server_state.0, user_id, game_id).await?;
23    Ok(())
24}