feat(bookmark): 添加 Authorization 请求头支持

为 CORS 配置添加 `Authorization` 请求头,以支持携带认证信息的跨域请求。

feat(user-np): 改进错误信息和用户注册流程

- 在注册 VFS 服务失败时返回更详细的错误信息,包括状态码和响应体内容。
- 用户创建失败时返回具体的错误详情,并确保数据库记录被正确回滚。
- 注销用户时先尝试删除 VFS 服务中的相关资源,再执行数据库删除操作。
- 使用 `Unscoped().Delete()` 确保物理删除用户数据。

feat(vfs): 完善用户目录结构及节点创建逻辑

- 创建用户主目录 `/home/username` 及其子目录 `.Recycle_Bin`。
- 调整 `CreateVFSNode` 方法参数类型为值传递。
- 修复创建用户目录时传参不一致的问题。
- 删除用户时递归清理其在 VFS 中的所有节点,并通过代理删除关联的服务节点。

feat(mage): 新增生成 TypeScript 类型定义的任务

新增 `Gen_TS` Mage 任务用于将 OpenAPI 配置文件转换为 TypeScript 类型定义文件,
支持 `vfs`、`bookmark` 和 `user_np` 模块。
This commit is contained in:
zzy
2025-09-28 12:28:22 +08:00
parent a3033bbf67
commit 429a863b76
6 changed files with 83 additions and 24 deletions

View File

@ -71,3 +71,33 @@ func Build_All() error {
return nil
}
func Gen_TS() error {
// 创建输出目录
if err := os.MkdirAll("./bin/ts", 0755); err != nil {
return fmt.Errorf("failed to create output directory: %w", err)
}
// 定义需要生成 TypeScript 类型的配置
configs := []struct {
Input string
Output string
}{
{"config/vfs/vfs.yaml", "bin/ts/vfs.ts"},
{"config/bookmark/bookmark.yaml", "bin/ts/bookmark.ts"},
{"config/user_np/user_np.yaml", "bin/ts/user_np.ts"},
}
// 为每个配置生成 TypeScript 类型文件
for _, cfg := range configs {
fmt.Printf("Generating TypeScript types for %s -> %s\n", cfg.Input, cfg.Output)
cmd := exec.Command("openapi-typescript",
cfg.Input, "--output", cfg.Output)
if err := cmd.Run(); err != nil {
return fmt.Errorf("failed to generate TypeScript types for %s: %w", cfg.Input, err)
}
}
return nil
}