|
|
|
|
@ -87,6 +87,32 @@ pub struct StartSessionResponse {
|
|
|
|
|
pub question: QuestionResponse,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
|
pub struct LeaderboardResponse {
|
|
|
|
|
pub rank: i32,
|
|
|
|
|
pub player_name: String,
|
|
|
|
|
pub score: i32,
|
|
|
|
|
pub questions_answered: i32,
|
|
|
|
|
pub correct_answers: i32,
|
|
|
|
|
pub success_rate: f64,
|
|
|
|
|
pub duration_seconds: i64,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<LeaderboardEntry> for LeaderboardResponse {
|
|
|
|
|
fn from(entry: LeaderboardEntry) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
rank: entry.rank,
|
|
|
|
|
player_name: entry.player_name,
|
|
|
|
|
score: entry.score,
|
|
|
|
|
questions_answered: entry.questions_answered,
|
|
|
|
|
correct_answers: entry.correct_answers,
|
|
|
|
|
success_rate: entry.success_rate,
|
|
|
|
|
duration_seconds: entry.duration_seconds,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
|
pub struct AdminQuestionResponse {
|
|
|
|
|
|