shuttle_common/models/
team.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use serde::{Deserialize, Serialize};
use strum::{Display, EnumString};

/// Minimal team information
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
pub struct Response {
    /// Team ID
    pub id: String,

    /// Name used for display purposes
    pub display_name: String,

    /// Is this user an admin of the team
    pub is_admin: bool,
}

/// Member of a team
#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct MemberResponse {
    /// User ID
    pub id: String,

    /// Role of the user in the team
    pub role: MemberRole,
}

/// Role of a user in a team
#[derive(Debug, Serialize, Deserialize, PartialEq, Display, EnumString)]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "lowercase")]
pub enum MemberRole {
    Admin,
    Member,
}