Skip to content

Commit e07a489

Browse files
committed
feat(db): add ApiKey and Permission representations
1 parent ffe8c85 commit e07a489

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

rustmail/src/db/repr.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,27 @@ pub struct Thread {
55
pub user_name: String,
66
pub channel_id: String,
77
}
8+
9+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
10+
pub struct ApiKey {
11+
pub id: i64,
12+
pub key_hash: String,
13+
pub name: String,
14+
pub permissions: Vec<Permission>,
15+
pub created_at: i64,
16+
pub expires_at: Option<i64>,
17+
pub last_used_at: Option<i64>,
18+
pub is_active: bool,
19+
}
20+
21+
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
22+
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
23+
pub enum Permission {
24+
CreateTicket,
25+
ReadTickets,
26+
UpdateTicket,
27+
DeleteTicket,
28+
ReadConfig,
29+
UpdateConfig,
30+
ManageBot,
31+
}

0 commit comments

Comments
 (0)