feat: 完善管理员系统和用户管理模块

- 更新管理员控制器和数据库管理功能
- 完善管理员操作日志系统
- 添加全面的属性测试覆盖
- 优化用户管理和用户档案服务
- 更新代码检查规范文档

功能改进:
- 增强管理员权限验证
- 完善操作日志记录
- 优化数据库管理接口
- 提升系统安全性和可维护性
This commit is contained in:
moyin
2026-01-09 17:05:08 +08:00
parent 8816b29b0a
commit 5f662ef091
30 changed files with 3881 additions and 599 deletions

View File

@@ -24,6 +24,7 @@
*/
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, Index } from 'typeorm';
import { OPERATION_TYPES, OPERATION_RESULTS } from './admin_constants';
@Entity('admin_operation_logs')
@Index(['admin_user_id', 'created_at'])
@@ -41,7 +42,7 @@ export class AdminOperationLog {
admin_username: string;
@Column({ type: 'varchar', length: 50, comment: '操作类型 (CREATE/UPDATE/DELETE/QUERY/BATCH)' })
operation_type: 'CREATE' | 'UPDATE' | 'DELETE' | 'QUERY' | 'BATCH';
operation_type: keyof typeof OPERATION_TYPES;
@Column({ type: 'varchar', length: 100, comment: '目标资源类型 (users/user_profiles/zulip_accounts)' })
target_type: string;
@@ -65,7 +66,7 @@ export class AdminOperationLog {
after_data?: Record<string, any>;
@Column({ type: 'varchar', length: 20, comment: '操作结果 (SUCCESS/FAILED)' })
operation_result: 'SUCCESS' | 'FAILED';
operation_result: keyof typeof OPERATION_RESULTS;
@Column({ type: 'text', nullable: true, comment: '错误信息' })
error_message?: string;