Skip to main content

authx_core/models/
organization.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Organization {
7    pub id: Uuid,
8    pub name: String,
9    pub slug: String,
10    pub metadata: serde_json::Value,
11    pub created_at: DateTime<Utc>,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct Role {
16    pub id: Uuid,
17    pub org_id: Uuid,
18    pub name: String,
19    pub permissions: Vec<String>,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct Membership {
24    pub id: Uuid,
25    pub user_id: Uuid,
26    pub org_id: Uuid,
27    pub role: Role,
28    pub created_at: DateTime<Utc>,
29}
30
31#[derive(Debug, Clone)]
32pub struct CreateOrg {
33    pub name: String,
34    pub slug: String,
35    pub metadata: Option<serde_json::Value>,
36}