Files
AstralRinth/src/models/teams.rs
Aeledfyr c4fb7b7928 General cleanup: fix some bugs, some refactoring (#65)
* Merged mod file upload in version creation, mod creation and
  version file add to one function;  This makes sure that they are
  consistent
* Made some fields on `User` optional: `github_id`, `avatar_url`, `bio`.
    * We may not want to publicly show the `github_id` to everyone
      with access to the API
    * If we allow non-github users, some of those fields would be
      invalid; some oauth providers may not have avatars or bios
* Made CORS origins should configurable
* Made `--reconfigure-indices` and `--reset-indices` exit after
  completion instead of starting the server
2020-09-30 22:07:52 -07:00

31 lines
803 B
Rust

use super::ids::Base62Id;
use crate::models::users::UserId;
use serde::{Deserialize, Serialize};
/// 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, Clone)]
pub struct TeamMember {
/// The ID of the user associated with the member
pub user_id: UserId,
/// The name of the user
pub name: String,
/// The role of the user in the team
pub role: String,
}