| 1 | //! Types and service interfaces shared by every g1t service. |
| 2 | //! |
| 3 | //! Each service has a module here holding the data it exchanges and the |
| 4 | //! arguments of each of its methods. Services and their callers depend on |
| 5 | //! this crate, never on each other's code. |
| 6 | |
| 7 | pub mod events; |
| 8 | pub mod identity; |
| 9 | mod ids; |
| 10 | mod names; |
| 11 | mod outcome; |
| 12 | pub mod repos; |
| 13 | pub mod time; |
| 14 | pub mod work; |
| 15 | |
| 16 | pub use ids::new_id; |
| 17 | pub use names::{is_valid_namespace, is_valid_repo_name}; |
| 18 | pub use outcome::{Failure, FailureCode, Outcome}; |
| 19 | |
| 20 | use serde::{Deserialize, Serialize}; |
| 21 | |
| 22 | #[derive(Clone, Debug, Serialize, Deserialize)] |
| 23 | pub struct User { |
| 24 | pub id: String, |
| 25 | pub username: String, |
| 26 | /// Whether the account's email address has been confirmed. Unverified |
| 27 | /// accounts can sign in but cannot create or change anything. |
| 28 | #[serde(default)] |
| 29 | pub verified: bool, |
| 30 | } |
| 31 | |
| 32 | /// Who is asking. Every read and write in every service takes one. |
| 33 | pub type Viewer = Option<User>; |