feat: 新增批量移除角色权限接口
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled

- 新增 DELETE /api/admin/roles/:role_id/permissions 接口
- Store 层新增 BatchDelete 方法,单次 SQL 批量软删除
- Service 层新增 BatchRemovePermissions 方法
- Handler 层新增 BatchRemovePermissions 处理函数
- DTO 新增 BatchRemovePermissionsRequest/Params
- 修复 openapi generator 对 DELETE 方法 requestBody 不生成的问题
- RouteSpec 新增 Body 字段,支持显式指定 JSON 请求体

💘 Generated with Crush

Assisted-by: Claude Sonnet 4.6 via Crush <crush@charm.land>
This commit is contained in:
2026-04-09 11:41:58 +08:00
parent a7dfe858c7
commit 384a54164b
8 changed files with 159 additions and 7 deletions

View File

@@ -120,7 +120,7 @@ type FileUploadField struct {
// - output: 响应结构体(可为 nil
// - tags: 标签列表
// - requiresAuth: 是否需要认证
func (g *Generator) AddOperation(method, path, summary, description string, input interface{}, output interface{}, requiresAuth bool, tags ...string) {
func (g *Generator) AddOperation(method, path, summary, description string, input interface{}, body interface{}, output interface{}, requiresAuth bool, tags ...string) {
op := openapi3.Operation{
Summary: &summary,
Tags: tags,
@@ -138,6 +138,18 @@ func (g *Generator) AddOperation(method, path, summary, description string, inpu
}
}
// u663eu5f0fu4f20u5165u7684 JSON bodyuff0cu7528u4e8e DELETE u7b49u65b9u6cd5u4e0du81eau52a8u751fu6210 requestBody u7684u573au666f
if body != nil {
tempOp := openapi3.Operation{}
if err := g.Reflector.SetRequest(&tempOp, body, "POST"); err != nil {
panic(err)
}
if tempOp.RequestBody != nil {
op.RequestBody = tempOp.RequestBody
}
}
// 反射输出 (响应 Body)
if output != nil {
// 将输出包裹在 envelope 中