fix: harden auth flows and align api contracts
This commit is contained in:
@@ -28,7 +28,7 @@ func NewPermissionHandler(permissionService *service.PermissionService) *Permiss
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param request body service.CreatePermissionRequest true "权限信息"
|
||||
// @Success 201 {object} Response{data=domain.Permission} "创建成功"
|
||||
// @Success 201 {object} Response{data=SwaggerPermission} "创建成功"
|
||||
// @Failure 400 {object} Response "请求参数错误"
|
||||
// @Failure 403 {object} Response "无权限"
|
||||
// @Router /api/v1/permissions [post]
|
||||
@@ -58,7 +58,7 @@ func (h *PermissionHandler) CreatePermission(c *gin.Context) {
|
||||
// @Tags 权限管理
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} Response{data=[]domain.Permission} "权限列表"
|
||||
// @Success 200 {object} Response{data=[]SwaggerPermission} "权限列表"
|
||||
// @Router /api/v1/permissions [get]
|
||||
func (h *PermissionHandler) ListPermissions(c *gin.Context) {
|
||||
var req service.ListPermissionRequest
|
||||
@@ -87,7 +87,7 @@ func (h *PermissionHandler) ListPermissions(c *gin.Context) {
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "权限ID"
|
||||
// @Success 200 {object} Response{data=domain.Permission} "权限信息"
|
||||
// @Success 200 {object} Response{data=SwaggerPermission} "权限信息"
|
||||
// @Failure 404 {object} Response "权限不存在"
|
||||
// @Router /api/v1/permissions/{id} [get]
|
||||
func (h *PermissionHandler) GetPermission(c *gin.Context) {
|
||||
@@ -119,7 +119,7 @@ func (h *PermissionHandler) GetPermission(c *gin.Context) {
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "权限ID"
|
||||
// @Param request body service.UpdatePermissionRequest true "更新信息"
|
||||
// @Success 200 {object} Response{data=domain.Permission} "更新成功"
|
||||
// @Success 200 {object} Response{data=SwaggerPermission} "更新成功"
|
||||
// @Failure 400 {object} Response "请求参数错误"
|
||||
// @Failure 403 {object} Response "无权限"
|
||||
// @Failure 404 {object} Response "权限不存在"
|
||||
@@ -237,7 +237,7 @@ func (h *PermissionHandler) UpdatePermissionStatus(c *gin.Context) {
|
||||
// @Tags 权限管理
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} Response{data=[]domain.Permission} "权限树"
|
||||
// @Success 200 {object} Response{data=[]SwaggerPermission} "权限树"
|
||||
// @Router /api/v1/permissions/tree [get]
|
||||
func (h *PermissionHandler) GetPermissionTree(c *gin.Context) {
|
||||
tree, err := h.permissionService.GetPermissionTree(c.Request.Context())
|
||||
|
||||
Reference in New Issue
Block a user