reafctor: all code without stream

This commit is contained in:
2026-06-02 18:30:39 +02:00
parent 974be437af
commit 28352d8bdb
90 changed files with 3581 additions and 2434 deletions
+27
View File
@@ -0,0 +1,27 @@
use uuid::Uuid;
#[derive(Debug)]
pub struct CreateApiKeyRequest {
pub user_id: Uuid,
pub name: String,
pub roles: Vec<KeyRole>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum KeyRole {
User,
Admin,
}
#[derive(Debug, Clone)]
pub struct AuthContext {
pub user_id: Uuid,
pub _api_key_id: Uuid,
pub roles: Vec<KeyRole>,
}
impl AuthContext {
pub fn has_role(&self, role: &KeyRole) -> bool {
self.roles.iter().any(|r| r == role)
}
}