Skip to main content

dvm_api/
user.rs

1use serde::{Deserialize, Serialize};
2
3/// The user signed in: `GET /api/me`.
4#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
5#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
6#[cfg_attr(feature = "typescript", ts(export_to = "controller-api.ts"))]
7pub struct Me {
8    /// Their GitHub login.
9    pub login: String,
10    /// Whether they see everyone's sandboxes, and the runners.
11    pub admin: bool,
12    /// What they may use; `None` for an admin, who has no limits.
13    pub limits: Option<UserLimits>,
14}
15
16/// What a user who isn't an admin may use.
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
18#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
19#[cfg_attr(feature = "typescript", ts(export_to = "controller-api.ts"))]
20pub struct UserLimits {
21    /// Runs they may have going (queued, running or paused) at once.
22    pub active_runs: u32,
23    /// vCPUs a sandbox may have.
24    pub cpus: u32,
25    /// Memory a sandbox may have, in MiB.
26    pub memory_mib: u32,
27}