From 6f6fb6cf5d5da74bf4f8fc516713b1143c4742d7 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Wed, 15 Mar 2023 09:38:03 +0200 Subject: [PATCH] feat(shared): relocate types, add gamestate consts --- shared/src/api/mod.rs | 1 - shared/src/api/user/mod.rs | 4 ++-- shared/src/lib.rs | 1 + shared/src/types/game.rs | 12 ++++++++++++ shared/src/types/mod.rs | 10 ++++++++++ shared/src/{api/types.rs => types/user.rs} | 0 6 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 shared/src/types/game.rs create mode 100644 shared/src/types/mod.rs rename shared/src/{api/types.rs => types/user.rs} (100%) diff --git a/shared/src/api/mod.rs b/shared/src/api/mod.rs index 0f80c18..bd02a7b 100644 --- a/shared/src/api/mod.rs +++ b/shared/src/api/mod.rs @@ -10,7 +10,6 @@ use reqwest; use serde::{Deserialize, Serialize}; //pub mod game; -pub mod types; pub mod user; mod macros; diff --git a/shared/src/api/user/mod.rs b/shared/src/api/user/mod.rs index 958d563..23cda35 100644 --- a/shared/src/api/user/mod.rs +++ b/shared/src/api/user/mod.rs @@ -9,9 +9,9 @@ use reqwest; use serde::{Deserialize, Serialize}; -use crate::error::api::APIError; +use crate::{error::api::APIError, types::user::User}; -use super::{macros::extract_cookie, types::User}; +use super::macros::extract_cookie; #[derive(Serialize)] pub struct PostLogin { diff --git a/shared/src/lib.rs b/shared/src/lib.rs index c511778..657efa9 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -9,3 +9,4 @@ pub mod api; pub mod error; pub mod server; +pub mod types; diff --git a/shared/src/types/game.rs b/shared/src/types/game.rs new file mode 100644 index 0000000..e028f6a --- /dev/null +++ b/shared/src/types/game.rs @@ -0,0 +1,12 @@ +/* + * This file is part of laurelin/shared + * Copyright (C) 2023 Jonni Liljamo + * + * Licensed under GPL-3.0-only. + * See LICENSE for licensing information. + */ + +pub const GAMESTATE_FORMING: i16 = 0; +pub const GAMESTATE_INPROGRESS: i16 = 1; +pub const GAMESTATE_FINISHED: i16 = 2; +pub const GAMESTATE_CANCELLED: i16 = 3; diff --git a/shared/src/types/mod.rs b/shared/src/types/mod.rs new file mode 100644 index 0000000..7d56ce4 --- /dev/null +++ b/shared/src/types/mod.rs @@ -0,0 +1,10 @@ +/* + * This file is part of laurelin/shared + * Copyright (C) 2023 Jonni Liljamo + * + * Licensed under GPL-3.0-only. + * See LICENSE for licensing information. + */ + +pub mod game; +pub mod user; diff --git a/shared/src/api/types.rs b/shared/src/types/user.rs similarity index 100% rename from shared/src/api/types.rs rename to shared/src/types/user.rs -- 2.44.1