Initial commit: SQL audit platform v0.1.0
FastAPI backend with auth, user, instance, ticket, query, dashboard APIs. React + TypeScript frontend with mock data UI (10 pages). SQLite + async SQLAlchemy, JWT auth, role-based access control. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
commit
439155c92e
290 files changed
+61950
No files matched your search
@@ -0,0 +1,178 @@
|
||||
export interface User {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
role: 'admin' | 'dba' | 'developer' | 'guest';
|
||||
roleName: string;
|
||||
department: string;
|
||||
lastLogin: string;
|
||||
status: 'active' | 'disabled';
|
||||
avatar: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
iconClass: string;
|
||||
userCount: number;
|
||||
permissionCount: number;
|
||||
permissions: string[];
|
||||
}
|
||||
|
||||
export interface DBInstance {
|
||||
id: number;
|
||||
name: string;
|
||||
host: string;
|
||||
port: number;
|
||||
status: 'online' | 'offline' | 'warning';
|
||||
dbType: string;
|
||||
version: string;
|
||||
env: 'prod' | 'test' | 'dev';
|
||||
connections: number;
|
||||
qps: number;
|
||||
latency: number;
|
||||
cpu: number;
|
||||
memory: number;
|
||||
disk: number;
|
||||
uptime: string;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface Ticket {
|
||||
id: string;
|
||||
title: string;
|
||||
dbType: string;
|
||||
instance: string;
|
||||
applicant: string;
|
||||
approver?: string;
|
||||
status: 'pending' | 'reviewing' | 'approved' | 'rejected' | 'executing' | 'success' | 'failed' | 'rollback';
|
||||
priority: 'high' | 'medium' | 'low';
|
||||
sql: string;
|
||||
rollbackSql?: string;
|
||||
reason: string;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
executeTime?: string;
|
||||
auditScore?: number;
|
||||
auditResults?: AuditResultItem[];
|
||||
workflowSteps?: WorkflowStep[];
|
||||
approvalRecords?: ApprovalRecord[];
|
||||
}
|
||||
|
||||
export interface AuditResultItem {
|
||||
rule: string;
|
||||
level: 'error' | 'warning' | 'info' | 'success';
|
||||
description: string;
|
||||
suggestion?: string;
|
||||
}
|
||||
|
||||
export interface WorkflowStep {
|
||||
name: string;
|
||||
status: 'completed' | 'active' | 'pending';
|
||||
time?: string;
|
||||
assignee?: string;
|
||||
}
|
||||
|
||||
export interface ApprovalRecord {
|
||||
step: number;
|
||||
approver: string;
|
||||
action: 'approve' | 'reject';
|
||||
comment: string;
|
||||
time: string;
|
||||
}
|
||||
|
||||
export interface QueryAudit {
|
||||
id: string;
|
||||
sql: string;
|
||||
sqlPreview: string;
|
||||
dbType: string;
|
||||
instance: string;
|
||||
user: string;
|
||||
executeTime: number;
|
||||
rowCount: number;
|
||||
scanRows: number;
|
||||
affectedRows: number;
|
||||
status: 'success' | 'slow' | 'failed';
|
||||
hasSensitive: boolean;
|
||||
timestamp: string;
|
||||
resultColumns?: ResultColumn[];
|
||||
resultSet?: Record<string, unknown>[];
|
||||
clientIp: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
export interface ResultColumn {
|
||||
prop: string;
|
||||
label: string;
|
||||
sensitive?: boolean;
|
||||
}
|
||||
|
||||
export interface AuditRule {
|
||||
id: string;
|
||||
name: string;
|
||||
level: 'error' | 'warning' | 'info';
|
||||
dbTypes: string[];
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
category: string;
|
||||
}
|
||||
|
||||
export interface Workflow {
|
||||
id: number;
|
||||
name: string;
|
||||
dbTypes: string[];
|
||||
steps: number;
|
||||
mode: 'any' | 'all';
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
conditions?: string[];
|
||||
}
|
||||
|
||||
export interface NotificationChannel {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
webhook?: string;
|
||||
events?: string[];
|
||||
}
|
||||
|
||||
export interface DataPermission {
|
||||
id: number;
|
||||
user: string;
|
||||
instance: string;
|
||||
database: string;
|
||||
table: string;
|
||||
columns: string;
|
||||
rowFilter: string;
|
||||
operations: string[];
|
||||
}
|
||||
|
||||
export interface PermissionNode {
|
||||
id: string;
|
||||
label: string;
|
||||
children?: PermissionNode[];
|
||||
}
|
||||
|
||||
export interface DashboardStats {
|
||||
todayTickets: number;
|
||||
todayTicketsTrend: number;
|
||||
pendingApproval: number;
|
||||
pendingTrend: number;
|
||||
queryAuditCount: number;
|
||||
queryTrend: number;
|
||||
slowQueries: number;
|
||||
slowQueryTrend: number;
|
||||
}
|
||||
|
||||
export interface MenuItem {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
section?: string;
|
||||
children?: MenuItem[];
|
||||
}
|
||||
Reference in new issue
Block a user