[client][server] file transfer working, ui not ready for it

This commit is contained in:
2024-11-14 23:26:31 +01:00
parent 942eb8003e
commit 2b64d1e4ba
9 changed files with 334 additions and 39 deletions

View File

@ -1,5 +1,5 @@
use bytes::Bytes;
use lanspread_db::db::Game;
use lanspread_db::db::{Game, GameFileDescription};
use serde::{Deserialize, Serialize};
use tracing::error;
@ -8,6 +8,7 @@ pub enum Request {
Ping,
ListGames,
GetGame { id: String },
GetGameFileData(GameFileDescription),
Invalid(Bytes, String),
}
@ -15,7 +16,7 @@ pub enum Request {
pub enum Response {
Pong,
Games(Vec<Game>),
Game(Game),
GetGame(Vec<GameFileDescription>),
GameNotFound(String),
InvalidRequest(Bytes, String),
EncodingError(String),
@ -74,16 +75,3 @@ impl Message for Response {
}
}
}
// Helper methods for Response
impl Response {
#[must_use]
pub fn games(games: Vec<Game>) -> Self {
Response::Games(games)
}
#[must_use]
pub fn game(game: Game) -> Self {
Response::Game(game)
}
}