You've already forked AstralRinth
forked from didirus/AstralRinth
* feat(schema): add basic structs for schema * feat(schema): implement base62 id parsing * docs(schema): add documentation for schema structs fix(schema): prevent integer overflow in base62 decoding * refactor(schema): move ids into submodules, reexport from ids mod * feat(schema): add random generation of base62 ids style: run rustfmt
34 lines
916 B
Rust
34 lines
916 B
Rust
use super::ids::Base62Id;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// The ID of a specific user, encoded as base62 for usage in the API
|
|
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(from = "Base62Id")]
|
|
#[serde(into = "Base62Id")]
|
|
pub struct UserId(pub u64);
|
|
|
|
/// The ID of a team
|
|
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(from = "Base62Id")]
|
|
#[serde(into = "Base62Id")]
|
|
pub struct TeamId(pub u64);
|
|
|
|
// TODO: permissions, role names, etc
|
|
/// A team of users who control a mod
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct Team {
|
|
/// The id of the team
|
|
pub id: TeamId,
|
|
/// A list of the members of the team
|
|
pub members: Vec<TeamMember>,
|
|
}
|
|
|
|
/// A member of a team
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct TeamMember {
|
|
/// The ID of the user associated with the member
|
|
pub user_id: UserId,
|
|
/// The name of the user
|
|
pub name: String,
|
|
}
|