Commit Graph

56 Commits

Author SHA1 Message Date
charilezhou
76f835a2ad feat(api): StorageService 支持 MINIO_PUBLIC_URL 配置
- 添加 publicUrl 配置支持外部访问地址
- getPresignedUrl 方法自动替换内部地址为公开地址
- 移除已迁移到 file 模块的路径前缀常量

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 13:47:36 +08:00
charilezhou
2914d1e090 feat(api): CrudService 添加配置式过滤和 count 方法
- 新增 FilterOperator、FilterFieldConfig、FilterableField 类型
- 添加 filterableFields 配置项支持声明式过滤字段
- 实现 buildFilterWhere 方法自动构建 where 条件
- 添加 count 方法支持条件计数
- findAll/count 方法支持泛型参数兼容 DTO 类型

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 13:47:09 +08:00
charilezhou
5fab73e514 refactor(api): 优化文件上传验证分层
Controller 层(Multer 配置):
- 添加全局文件大小限制(10MB)和类型过滤
- 在文件写入内存前进行基本验证,防止恶意大文件

Service 层(业务规则):
- 新增 FILE_PURPOSE_CONFIG 配置映射
- 按场景(头像/附件)进行细化验证
- 提取 validateFile 方法,职责清晰

常量重组织:
- storage.constants.ts 只保留全局限制和存储路径
- file.constants.ts 添加场景特定限制配置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 13:07:20 +08:00
charilezhou
c935d0b6aa docs: 更新 CLAUDE.md 项目文档
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:37:18 +08:00
charilezhou
9c65d39dd2 feat(web): 更新 UI 组件和个人资料页
- 更新个人资料页支持头像上传
- 优化 Header、Sidebar、UserNav 组件
- 更新表单验证规则
- 调整常量配置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:37:08 +08:00
charilezhou
4e1be2b494 feat(api): 更新用户模块支持头像功能
- 更新 AuthDto 调整验证规则
- 更新 UserDto 添加头像相关字段
- 更新 UserController 支持更新用户头像

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:36:39 +08:00
charilezhou
d9673e2ba3 chore: 更新配置和依赖
- 添加 MinIO 和邮件服务相关环境变量
- 添加 @nestjs-modules/mailer, minio, multer 等依赖
- 更新 app.module.ts 注册新模块
- docker-compose 添加 MinIO 服务配置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:36:20 +08:00
charilezhou
1627d98be5 feat: 更新数据模型和共享类型
- 更新 Prisma schema 添加 File 模型和相关字段
- 更新共享类型定义,添加文件和密码重置相关类型
- 添加 CaptchaScene.RESET_PASSWORD 场景

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:36:04 +08:00
charilezhou
e008179c03 feat: 添加忘记密码功能
后端:
- 新增 MailService 集成 Nodemailer 发送邮件
- 新增 EmailCodeService 管理邮箱验证码
- 新增 sendResetPasswordEmail 和 resetPassword 接口
- 支持验证码过期和次数限制

前端:
- 新增忘记密码页面 (forgot-password)
- 新增 ForgotPasswordForm 组件,支持邮箱验证和密码重置
- 更新 auth.service.ts 添加相关 API 调用

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:35:24 +08:00
charilezhou
58529f0321 feat: 添加文件上传功能
后端:
- 新增 StorageService 集成 MinIO 对象存储
- 新增 FileService 和 FileController 处理文件上传
- 支持头像上传场景,含文件类型和大小验证
- 支持生成临时访问 URL

前端:
- 新增 AvatarUpload 组件,支持拖拽和点击上传
- 新增 useUploadAvatar 和 useFileUrl hooks
- 新增 file.service.ts 封装文件 API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:34:58 +08:00
charilezhou
b305e49e9b fix(web): 修复 lint 错误
- 调整 permissions/page.tsx 的 import 顺序
- 重命名未使用的 collectAllMenuIds 为 _collectAllMenuIds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:34:32 +08:00
charilezhou
d747f98d08 refactor(api): 优化 PrismaService 类型设计,修复依赖注入问题
- 重构 PrismaService 使其类型包含所有模型访问器
- 使用 PrismaServiceImpl 内部类 + 类型断言导出 PrismaService
- 所有 Service 现在可以直接使用 PrismaService 类型注入
- 修复 NestJS 依赖注入无法识别类型别名的问题
- 统一各 Service 的 PrismaService 导入方式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:34:11 +08:00
charilezhou
57456be013 refactor(api): 移除手动 softDelete 配置,改为基于 schema 自动检测
- 从 CrudServiceOptions 中移除 softDelete 属性
- CrudService 基于 Prisma schema 自动检测模型是否支持软删除
- 新增 supportsSoftDelete getter 用于判断软删除支持
- 更新 findDeleted/restore 方法使用自动检测
- PrismaService 底层已自动处理软删除逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:33:46 +08:00
charilezhou
73db0eb809 chore(deploy): 删除 Knative 部署配置
移除不再使用的 Knative 部署相关文件

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:33:20 +08:00
charilezhou
e9bcdaacce feat(deploy): 添加 Knative 部署配置
- 修改 Next.js 配置启用 standalone 输出模式
- 添加前后端多阶段 Dockerfile
- 添加 Knative Service 配置(支持缩容到 0)
- 添加 Secrets 和 ConfigMap 模板
- 添加构建和部署脚本

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 22:30:36 +08:00
charilezhou
9e5a6355cd fix(web): 修复登录页面 hydration 不匹配问题
- 移除 LoginForm 外层的 Suspense 包裹
- auth layout 中将 AuthRedirect 移到 children 之后渲染

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:57:32 +08:00
charilezhou
25c724f406 fix(web): 登录失败时自动刷新验证码
- Captcha 组件使用 forwardRef 暴露 refresh 方法
- LoginForm 在登录失败的 catch 块中调用 captchaRef.refresh()
- 新增 CaptchaRef 接口类型导出

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:47:50 +08:00
charilezhou
55dbe844af feat(web): 添加和更新其他页面
- 新增 not-found.tsx 404 页面
- 更新 profile 页面
- LoginForm 代码优化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:43:39 +08:00
charilezhou
6ade9b68c9 feat(web): 更新菜单、角色和侧边栏组件
- MenuEditDialog 移除 component 和 permission 字段
- MenusTable 优化显示逻辑
- RoleEditDialog 增强角色编辑功能
- Sidebar 优化菜单渲染逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:42:18 +08:00
charilezhou
d7c4cbc98d refactor(web): 优化认证布局和权限检查
- auth layout 添加智能重定向(检查权限后重定向到可访问页面)
- dashboard layout 优化权限加载和过期检查逻辑
- 支持权限缓存过期后自动刷新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:40:57 +08:00
charilezhou
77bf31146d feat(web): 优化权限缓存和路由检查
- permissionStore 添加缓存过期检查(30分钟 TTL)
- permissionStore 添加 canAccessRoute 方法
- authStore 移除 cookie 同步逻辑
- 移除公开路由配置,改为动态权限检查
- 添加 CACHE_CONFIG 配置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:40:17 +08:00
charilezhou
b58d7b2afa feat(web): 添加用户角色分配功能
- 新增 UserRolesDialog 组件用于分配角色
- UsersTable 添加分配角色操作按钮
- user.service 添加 getUserWithRoles 和 assignRoles 方法
- useUsers hooks 添加 useUserWithRoles 和 useAssignRoles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:39:45 +08:00
charilezhou
4d52346d28 feat(web): 添加权限管理模块
- 新增权限管理页面 /permissions
- 新增权限表格组件 PermissionsTable
- 新增权限编辑对话框 PermissionEditDialog
- 新增 usePermissions hooks
- 更新 permission.service 添加 CRUD 方法
- API 端点改名 MENUS -> PRIVILEGE

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:39:05 +08:00
charilezhou
6369e5c6e7 refactor(api): 调整 seed 数据结构
- 新增权限管理相关权限(permission:create/update/delete)
- 新增权限管理菜单
- 菜单移除 permission 字段
- 清空角色默认权限和菜单(由管理员手动分配)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:38:15 +08:00
charilezhou
c081f5a01f feat(api): 优化认证模块
- 注册时自动分配默认用户角色(user)
- GET /auth/menus 改名为 GET /auth/privilege
- 添加日志记录默认角色不存在的警告

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:37:40 +08:00
charilezhou
fe4ea4121c feat(api): 添加用户角色管理接口
- GET /users/:id/roles 获取用户详情(包含角色)
- PATCH /users/:id/roles 分配角色给用户
- 新增 AssignRolesDto、UserRoleResponseDto、UserWithRolesResponseDto

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:37:01 +08:00
charilezhou
f4c42cee27 refactor(api): 移除菜单的 component 和 permission 字段
- Schema 移除 Menu.component 和 Menu.permission 字段
- isStatic 默认值改为 false
- MenuTreeNode 增加 isExternal、isStatic、isEnabled、sort 字段
- DTO 同步更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:36:27 +08:00
charilezhou
f9563f886c feat(web): 验证码组件支持主题自动跟随
- 自动跟随系统主题(dark/light)
- 支持 theme prop 手动指定主题
- 代码格式化优化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:35:55 +08:00
charilezhou
ce5a96c622 feat(api): 验证码接口支持主题参数
- 新增 theme 查询参数(light/dark)
- dark 主题使用 inverse=true(深色背景浅色文字)
- 默认使用 dark 主题

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:34:47 +08:00
charilezhou
b1496befd7 feat(shared): 添加验证码主题类型和调整菜单类型定义
- 新增 CaptchaTheme 枚举(light/dark)
- MenuResponse 移除 component 和 permission 字段
- MenuTreeNode 增加 isExternal、isStatic、isEnabled、sort 字段
- CreateMenuDto/UpdateMenuDto 移除 component 和 permission 字段

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:34:21 +08:00
charilezhou
d4af3f07b8 fix(web): 修复登录失败时页面刷新而不显示错误提示的问题
登录接口设置了 skipAuth: true,但 401 错误处理没有检查此标志,
导致登录失败时触发 performLogoutWithRedirect 刷新页面。
现在 skipAuth 请求的 401 错误会传递给调用者处理,正常显示 toast。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:31:04 +08:00
charilezhou
fad4842c07 fix(web): 添加登录状态拦截和修复类型错误
- dashboard layout: 未登录时重定向到登录页,携带 redirect 参数
- sidebar: 移除静态菜单 fallback,仅使用动态权限菜单
- MenuEditDialog: 修复 type 字段类型为 MenuType
- RoleEditDialog: 修复 isSystem 属性访问使用 roleDetail

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 16:22:22 +08:00
charilezhou
df69eedcd9 refactor(api): 移除 barrel imports 改用直接导入
- 将所有模块的 barrel imports 改为直接导入具体文件
- 删除不再需要的 index.ts 文件(共 10 个)
- 更新 CLAUDE.md 添加禁止后端使用 barrel imports 的规范
- 避免循环依赖问题,提高代码可追溯性

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:39:33 +08:00
charilezhou
2ea7ae36a4 fix: 调整菜单 hooks 匹配新的服务接口
- 重命名 useMenus 为 useMenuTree 和 useFullMenuTree
- 更新 query keys 和失效逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:11:05 +08:00
charilezhou
279ee53251 fix: 修复菜单模块导入和服务接口调整
- 修复 menu.controller.ts 装饰器导入路径
- 调整 menu.service.ts 接口方法名和参数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:10:14 +08:00
charilezhou
eac425c2fb chore: 更新依赖和配置
- 更新项目依赖
- 调整 next-env.d.ts 类型配置
- 更新全局样式
- 调整首页内容
- 添加 .playwright-mcp/ 到 gitignore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:09:17 +08:00
charilezhou
473c2c1510 feat: 添加 plop 代码生成器模板
添加组件和模块的代码生成器模板,提高开发效率。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:08:56 +08:00
charilezhou
e8780e3c1a refactor(web): 清理和优化代码
- 删除未使用的 proxy.ts
- 优化 RecentActivity 组件
- 调整 uiStore 配置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:08:19 +08:00
charilezhou
2a9e46a3f2 docs: 更新项目文档
- 更新 CLAUDE.md 中 HTTP 客户端说明(apiFetch -> http)
- 更新 docs/web/DESIGN.md 技术栈说明
- 添加任务工作流文档

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:07:35 +08:00
charilezhou
8c35fac857 refactor(web): Dashboard 页面统一改为 CSR 模式
将所有 dashboard 路由组页面改为客户端组件,避免 zustand persist 导致的 hydration mismatch 问题。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:07:13 +08:00
charilezhou
e66518f18f feat(web): 侧边栏支持动态菜单渲染
基于用户权限数据动态渲染侧边栏菜单,支持多级菜单和图标映射。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:06:54 +08:00
charilezhou
213a19ee7f feat(web): 实现角色管理功能
- 添加角色列表页面和管理组件
- 实现角色 CRUD 操作
- 支持角色权限和菜单分配
- 添加角色表单和权限选择器

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:06:34 +08:00
charilezhou
3cfc6bf15c feat(web): 实现菜单管理功能
- 添加菜单列表页面和管理组件
- 实现菜单 CRUD 操作和树形结构展示
- 添加菜单表单(支持创建/编辑)
- 实现图标选择器和动态图标映射

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:06:15 +08:00
charilezhou
ed228860f6 refactor(web): 重构 DataTable 组件并添加高级搜索功能
- 将 DataTable 重构为模块化目录结构
- 添加可展开/收起的高级搜索面板
- 支持多种搜索字段类型(text, select, dateRange 等)
- 添加已选条件标签展示和清除功能
- 更新 UsersTable 使用新的搜索功能

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:05:48 +08:00
charilezhou
b23028615b feat(web): 实现前端权限系统基础设施
- 添加 permissionStore 管理用户菜单和权限状态
- 实现 usePermission hook 和权限服务
- 配置路由权限映射
- 添加 403 页面和权限相关组件
- Dashboard layout 集成权限检查

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:05:26 +08:00
charilezhou
15d6e6e29e feat(api): 实现权限管理系统
- 添加 Menu、Role、Permission 数据模型及关联表
- 实现 PermissionModule 提供菜单、角色、权限 CRUD
- 扩展 AuthController 添加获取用户菜单权限接口
- PrismaService 支持新模型的软删除
- 添加数据库种子脚本

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:05:09 +08:00
charilezhou
ffb16efa62 feat(shared): 扩展权限系统相关类型定义
添加菜单、角色、权限相关的类型和接口定义,支持前后端共享。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:04:49 +08:00
charilezhou
c2d9aaedc9 feat(web): 重构前端架构并完善认证系统
主要变更:
- 使用 shadcn/ui 重构 UI 组件库
- 实现 Zustand 状态管理(authStore、uiStore)
- 使用 axios 封装 HTTP 客户端,支持 token 自动刷新和加密
- 添加登录/注册表单,支持登录后跳转回原页面
- 实现 Dashboard 布局(Sidebar、Header、UserNav)
- 添加用户管理页面(DataTable、分页、编辑弹窗)
- 添加个人中心和系统设置页面
- 实现全局错误边界和 ErrorBoundary 组件
- 使用 Next.js 16 proxy.ts 替代 middleware.ts
- 修复 ThemeToggle 和 LoginForm 的水合错误

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:08:55 +08:00
charilezhou
c958271027 feat: 完善认证系统和前端 Demo 页面
- 添加图形验证码模块(登录/注册需验证码)
- 添加 refresh token 机制和 API 接口
- 认证响应返回 token 有效期
- 添加 Redis 模块支持验证码存储
- 添加前端验证码组件和用户管理 Demo 页面
- 添加 CRUD 基类和分页响应 DTO mixin
- 添加请求/响应加密模块(AES-256-GCM)
- 完善共享类型定义和前后端类型一致性
- 更新 CLAUDE.md 文档

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 19:17:11 +08:00
charilezhou
1c7e2c3a7c chore: 调整环境变量文件管理策略
- .gitignore 移除 .env,允许提交默认开发配置
- .env.example 添加详细注释说明
- 新增 .env 默认开发配置文件

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:58:12 +08:00