g1t/crates/contracts/src/lib.rs

31 lines912 bytesCodeBlame
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
7pub mod events;
8pub mod identity;
9mod ids;
10mod names;
11mod outcome;
12pub mod repos;
13
14pub use ids::new_id;
15pub use names::{is_valid_namespace, is_valid_repo_name};
16pub use outcome::{Failure, FailureCode, Outcome};
17
18use serde::{Deserialize, Serialize};
19
20#[derive(Clone, Debug, Serialize, Deserialize)]
21pub struct User {
22 pub id: String,
23 pub username: String,
24 /// Whether the account's email address has been confirmed. Unverified
25 /// accounts can sign in but cannot create or change anything.
26 #[serde(default)]
27 pub verified: bool,
28}
29
30/// Who is asking. Every read and write in every service takes one.
31pub type Viewer = Option<User>;