pr_01m47d24b0e6n91zwymwxg0vpx/crates/contracts/src/lib.rs

33 lines940 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;
13pub mod time;
14pub mod work;
15
16pub use ids::new_id;
17pub use names::{is_valid_namespace, is_valid_repo_name};
18pub use outcome::{Failure, FailureCode, Outcome};
19
20use serde::{Deserialize, Serialize};
21
22#[derive(Clone, Debug, Serialize, Deserialize)]
23pub 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.
33pub type Viewer = Option<User>;