use surrealdb::types::SurrealValue;
/// A user's role in a team. Its record ID is `membership:[team_id, user_id]`,
/// so a user has one role per team.
#[derive(Debug, Clone, SurrealValue)]
pub struct Membership {
pub team_id: i64,
pub user_id: i64,
/// `owner`, `admin` or `staff`.
pub role: String,
/// For `staff`: the modules they may use, comma-separated (e.g.
/// `catalog,orders`). Empty for owners and admins, who may use all.
pub modules: String,
}
impl Membership {
/// What to select (or `RETURN`) for this struct: its fields, without the
/// record ID, e.g. `SELECT {FIELDS} FROM membership WHERE ...`.
pub const FIELDS: &str = "team_id, user_id, role, modules";
}