27 lines
716 B
Rust
27 lines
716 B
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct ApiKey {
|
|
pub id: i32,
|
|
pub name: String,
|
|
pub key_prefix: String,
|
|
pub permissions_mask: String,
|
|
pub created_at: DateTime<Utc>,
|
|
pub expires_at: Option<DateTime<Utc>>,
|
|
pub last_used_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct CreateApiKey {
|
|
pub name: String,
|
|
pub permissions_mask: Option<String>,
|
|
pub expires_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct UpdateApiKey {
|
|
pub name: Option<String>,
|
|
pub permissions_mask: Option<String>,
|
|
pub expires_at: Option<DateTime<Utc>>,
|
|
}
|