assignmentlib/jsonb/
game_progress.rsuse serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::dto::game_progress_response::GameProgressResponse;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct GameProgress {
pub question_id: Uuid,
pub answers: Vec<String>,
pub player1_status: bool,
pub player2_status: bool,
pub answerer_id: Uuid,
}
impl GameProgress {
pub fn to_response(&self, game_id: Uuid) -> GameProgressResponse {
GameProgressResponse {
id: self.question_id.clone(),
game_id: game_id.clone(),
player1_status: self.player1_status.clone(),
player2_status: self.player2_status.clone(),
answerer_id: self.answerer_id.clone(),
}
}
}