85 lines
2.0 KiB
Rust
85 lines
2.0 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::ids::{InvitationId, PlatformApiKeyId, UserId, WorkspaceId};
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum UserStatus {
|
|
Active,
|
|
Disabled,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum MembershipRole {
|
|
Owner,
|
|
Admin,
|
|
Operator,
|
|
Viewer,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum InvitationStatus {
|
|
Pending,
|
|
Accepted,
|
|
Revoked,
|
|
Expired,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum PlatformApiKeyStatus {
|
|
Active,
|
|
Revoked,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum PlatformApiKeyScope {
|
|
Read,
|
|
Write,
|
|
Deploy,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct User {
|
|
pub id: UserId,
|
|
pub email: String,
|
|
pub display_name: String,
|
|
pub status: UserStatus,
|
|
pub created_at: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct Membership {
|
|
pub workspace_id: WorkspaceId,
|
|
pub user_id: UserId,
|
|
pub role: MembershipRole,
|
|
pub created_at: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct InvitationToken {
|
|
pub id: InvitationId,
|
|
pub workspace_id: WorkspaceId,
|
|
pub email: String,
|
|
pub role: MembershipRole,
|
|
pub status: InvitationStatus,
|
|
pub token_hash: String,
|
|
pub expires_at: String,
|
|
pub created_at: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct PlatformApiKey {
|
|
pub id: PlatformApiKeyId,
|
|
pub workspace_id: WorkspaceId,
|
|
pub name: String,
|
|
pub prefix: String,
|
|
pub scopes: Vec<PlatformApiKeyScope>,
|
|
pub status: PlatformApiKeyStatus,
|
|
pub created_at: String,
|
|
pub last_used_at: Option<String>,
|
|
}
|