1use chrono::NaiveDateTime;
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct ApiKey {
7 pub id: Uuid,
8 pub user_id: Uuid,
9 pub key_prefix: String,
10 pub key_hash: String,
11 pub name: String,
12 pub scopes: Option<serde_json::Value>,
13 pub last_used_at: Option<NaiveDateTime>,
14 pub expires_at: Option<NaiveDateTime>,
15 pub created_at: NaiveDateTime,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct NewApiKey {
20 pub id: Uuid,
21 pub user_id: Uuid,
22 pub key_prefix: String,
23 pub key_hash: String,
24 pub name: String,
25 pub scopes: Option<serde_json::Value>,
26 pub expires_at: Option<NaiveDateTime>,
27 pub created_at: NaiveDateTime,
28}