feat: add is_admin to User, count_users, ProviderConfigRepository trait, admin migration

This commit is contained in:
2026-03-16 03:22:00 +01:00
parent b35054f23e
commit d80d4e9741
6 changed files with 65 additions and 14 deletions

View File

@@ -39,6 +39,24 @@ pub trait UserRepository: Send + Sync {
/// Delete a user by their ID
async fn delete(&self, id: Uuid) -> DomainResult<()>;
/// Count total number of users (used for first-user admin promotion)
async fn count_users(&self) -> DomainResult<u64>;
}
#[derive(Debug, Clone)]
pub struct ProviderConfigRow {
pub provider_type: String,
pub config_json: String,
pub enabled: bool,
pub updated_at: String,
}
#[async_trait]
pub trait ProviderConfigRepository: Send + Sync {
async fn get_all(&self) -> DomainResult<Vec<ProviderConfigRow>>;
async fn upsert(&self, row: &ProviderConfigRow) -> DomainResult<()>;
async fn delete(&self, provider_type: &str) -> DomainResult<()>;
}
/// Repository port for `Channel` persistence.