feat: 实现企业设备授权功能并归档 OpenSpec 变更
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m39s

- 新增企业设备授权模块(Model、DTO、Service、Handler、Store)
- 实现设备授权的创建、查询、更新、删除等完整业务逻辑
- 添加企业卡授权与设备授权的关联关系
- 新增 2 个数据库迁移脚本
- 同步 OpenSpec delta specs 到 main specs
- 归档 add-enterprise-device-authorization 变更
- 更新 API 文档和路由配置
- 新增完整的集成测试和单元测试覆盖
This commit is contained in:
2026-01-29 13:18:49 +08:00
parent e87513541b
commit b02175271a
118 changed files with 14306 additions and 472 deletions

View File

@@ -48,18 +48,17 @@ func TestRoleAPI_Create(t *testing.T) {
assert.Equal(t, int64(1), count)
})
// TODO: 当前 RoleHandler 未实现请求验证,跳过此测试
// t.Run("缺少必填字段返回错误", func(t *testing.T) {
// reqBody := map[string]interface{}{
// "role_desc": "缺少名称",
// }
// jsonBody, _ := json.Marshal(reqBody)
// resp, err := env.AsSuperAdmin().Request("POST", "/api/admin/roles", jsonBody)
// require.NoError(t, err)
// var result response.Response
// json.NewDecoder(resp.Body).Decode(&result)
// assert.NotEqual(t, 0, result.Code)
// })
t.Run("缺少必填字段返回错误", func(t *testing.T) {
reqBody := map[string]interface{}{
"role_desc": "缺少名称",
}
jsonBody, _ := json.Marshal(reqBody)
resp, err := env.AsSuperAdmin().Request("POST", "/api/admin/roles", jsonBody)
require.NoError(t, err)
var result response.Response
json.NewDecoder(resp.Body).Decode(&result)
assert.NotEqual(t, 0, result.Code)
})
}
func TestRoleAPI_Get(t *testing.T) {
@@ -278,7 +277,4 @@ func TestRoleAPI_UpdateStatus(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, errors.CodeRoleNotFound, result.Code)
})
// TODO: 当前 RoleHandler 未实现请求验证,跳过此测试
// t.Run("无效状态值返回错误", func(t *testing.T) { ... })
}