refactor game proto

This commit is contained in:
code002lover 2025-12-02 14:24:31 +01:00
parent 0222332d3f
commit cccd5a9d83
2 changed files with 22 additions and 10 deletions

View File

@ -1,5 +1,7 @@
use rocket::fs::FileServer; use rocket::fs::FileServer;
use crate::items::Game;
#[macro_use] #[macro_use]
extern crate rocket; extern crate rocket;
@ -65,21 +67,24 @@ async fn index_fallback() -> Option<rocket::fs::NamedFile> {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
let mut game_list: Vec<Game> = Vec::new();
let mut user_list: Vec<User> = Vec::new(); let mut user_list: Vec<User> = Vec::new();
game_list.push(Game {
title: "Naramo Nuclear Plant V2".to_string(),
source: items::Source::Roblox.into(),
multiplayer: true,
min_players: 1,
max_players: 90,
price: 0,
remote_id: 0,
});
user_list.push(User { user_list.push(User {
person: items::Person { person: items::Person {
name: "John".to_string(), name: "John".to_string(),
opinion: vec![items::Opinion { opinion: vec![items::Opinion {
game: Some(items::Game { title: "Naramo Nuclear Plant V2".to_string(),
title: "Naramo Nuclear Plant V2".to_string(),
source: items::Source::Roblox.into(),
multiplayer: true,
min_players: 1,
max_players: 90,
price: 0,
remote_id: 0,
}),
would_play: true, would_play: true,
}], }],
}, },

View File

@ -8,7 +8,7 @@ message Person {
} }
message Opinion { message Opinion {
Game game = 1; string title = 1;
bool would_play = 2; bool would_play = 2;
} }
@ -61,3 +61,10 @@ service AuthService {
rpc Logout(LogoutRequest) returns (LogoutResponse); rpc Logout(LogoutRequest) returns (LogoutResponse);
rpc GetAuthStatus(AuthStatusRequest) returns (AuthStatusResponse); rpc GetAuthStatus(AuthStatusRequest) returns (AuthStatusResponse);
} }
message GameRequest { string title = 1; }
service MainService {
rpc GetGame(GameRequest) returns (Game);
rpc AddOpinion(GameRequest) returns (Person);
}