fase(9): auth module with casl rbac and session management

This commit is contained in:
debian
2026-03-05 09:57:49 -05:00
parent 39a5e41f75
commit 7526a5bc15
77 changed files with 3588 additions and 41 deletions

View File

@@ -154,6 +154,53 @@ export interface JobTable {
updated_at: string;
}
export interface UserTable {
id: string;
email: string;
name: string;
password_hash: string;
role: string;
org_id: string | null;
created_at: number;
updated_at: number;
}
export interface OrganizationTable {
id: string;
name: string;
slug: string;
created_at: number;
}
export interface OrgMemberTable {
id: string;
org_id: string;
user_id: string;
role: string;
joined_at: number;
}
export interface ApiKeyTable {
id: string;
user_id: string;
org_id: string;
name: string;
key_hash: string;
key_prefix: string;
permissions: string;
expires_at: number | null;
last_used_at: number | null;
created_at: number;
}
export interface AuthSessionTable {
id: string;
user_id: string;
token: string;
expires_at: number;
created_at: number;
}
export interface Database {
sessions: SessionTable;
states: StateTable;
@@ -166,6 +213,11 @@ export interface Database {
performance_metrics: PerformanceMetricTable;
findings: FindingTable;
jobs: JobTable;
users: UserTable;
organizations: OrganizationTable;
org_members: OrgMemberTable;
api_keys: ApiKeyTable;
auth_sessions: AuthSessionTable;
}
export function createDatabase(config: { driver: string; path: string; url?: string }): Kysely<Database> {