package v1 import "github.com/gogf/gf/v2/frame/g" // MenuItem is one node of the full menu tree (type 1 menu / 2 button). type MenuItem struct { Id uint64 `json:"id"` ParentId uint64 `json:"parentId"` Name string `json:"name"` Icon string `json:"icon"` Type int `json:"type"` // 1 menu, 2 button/api Path string `json:"path"` Component string `json:"component"` Permission string `json:"permission"` Sort int `json:"sort"` Status int `json:"status"` Hidden bool `json:"hidden"` Children []*MenuItem `json:"children,omitempty"` } // MenuTreeReq returns the full menu tree for management. type MenuTreeReq struct { g.Meta `path:"/menus/tree" method:"get" tags:"Admin/Menu" summary:"Full menu tree"` } // MenuTreeRes is the response of MenuTreeReq. type MenuTreeRes struct { Tree []*MenuItem `json:"tree"` } // MenuCreateReq creates a menu or button node. type MenuCreateReq struct { g.Meta `path:"/menus" method:"post" tags:"Admin/Menu" summary:"Create menu"` ParentId uint64 `json:"parentId"` Name string `json:"name" v:"required"` Icon string `json:"icon"` Type int `json:"type" v:"in:1,2#type must be 1 or 2"` Path string `json:"path"` Component string `json:"component"` Permission string `json:"permission" v:"required"` Sort int `json:"sort"` Status int `json:"status"` Hidden bool `json:"hidden"` } // MenuCreateRes is the response of MenuCreateReq. type MenuCreateRes struct { Id uint64 `json:"id"` } // MenuUpdateReq updates a menu or button node. type MenuUpdateReq struct { g.Meta `path:"/menus/{id}" method:"put" tags:"Admin/Menu" summary:"Update menu"` Id uint64 `json:"id" in:"path" v:"required"` ParentId uint64 `json:"parentId"` Name string `json:"name" v:"required"` Icon string `json:"icon"` Type int `json:"type" v:"in:1,2#type must be 1 or 2"` Path string `json:"path"` Component string `json:"component"` Permission string `json:"permission" v:"required"` Sort int `json:"sort"` Status int `json:"status"` Hidden bool `json:"hidden"` } // MenuUpdateRes is the response of MenuUpdateReq. type MenuUpdateRes struct{} // MenuDeleteReq deletes a menu node (soft delete). type MenuDeleteReq struct { g.Meta `path:"/menus/{id}" method:"delete" tags:"Admin/Menu" summary:"Delete menu"` Id uint64 `json:"id" in:"path" v:"required"` } // MenuDeleteRes is the response of MenuDeleteReq. type MenuDeleteRes struct{}