Skip to main content

drops_messages/
requests.rs

1use crate::user_role::UserRole;
2use chrono::{DateTime, Utc};
3use serde::{Deserialize, Serialize};
4
5#[derive(Deserialize, Serialize, Clone, Debug)]
6pub struct AddChannelRequest {
7    pub name: String,
8}
9
10#[derive(Deserialize, Serialize, Clone, Debug)]
11pub struct AddPlatformRequest {
12    pub name: String,
13}
14
15#[derive(Deserialize, Serialize, Clone, Debug)]
16pub struct AddGameRequest {
17    pub name_id: String,
18    pub name: String,
19    pub description: String,
20    pub author: String,
21    pub default_channel_name: Option<String>,
22}
23
24#[derive(Deserialize, Serialize, Clone, Debug)]
25pub struct GetReleaseRequest {
26    pub game_name_id: String,
27    pub platform: String,
28    pub version: String,
29    pub channel: String,
30}
31
32#[derive(Deserialize, Serialize, Clone, Debug)]
33pub struct AddUserRequest {
34    pub username: String,
35    pub password: String,
36    pub email: String,
37    pub role: UserRole,
38}
39
40#[derive(Deserialize, Serialize, Clone, Debug)]
41pub struct GetGamesRequest {
42    pub platform: Option<String>,
43}
44
45#[derive(Deserialize, Serialize, Clone, Debug)]
46pub struct GetGamesResponse {
47    pub games: Vec<GameInfoResponse>,
48}
49
50#[derive(Deserialize, Serialize, Clone, Debug)]
51pub struct GameInfoResponse {
52    pub name_id: String,
53    pub name: String,
54    pub author: String,
55    pub description: String,
56    pub default_channel: Option<String>,
57    pub release_date: DateTime<Utc>,
58    pub releases: Vec<ReleaseInfoResponse>,
59}
60#[derive(Deserialize, Serialize, Clone, Debug)]
61pub struct ReleaseInfoResponse {
62    pub channel: String,
63    pub version: String,
64    pub platform: String,
65    pub description: String,
66    pub release_date: DateTime<Utc>,
67    pub executable_path: String,
68    pub size_bytes: u64,
69}
70
71#[derive(Deserialize, Serialize, Clone, Debug)]
72pub struct AddGameAccessRequest {
73    pub game_name_id: String,
74    pub username: String,
75}