kra-oa/internal/modules/system/dto/menu.go

144 lines
4.9 KiB
Go

package dto
import "time"
type MenuMetaRequest struct {
ActiveName string `json:"activeName"`
KeepAlive bool `json:"keepAlive"`
DefaultMenu bool `json:"defaultMenu"`
Title string `json:"title"`
Icon string `json:"icon"`
CloseTab bool `json:"closeTab"`
TransitionType string `json:"transitionType"`
}
type MenuButtonRequest struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
Name string `json:"name"`
Description string `json:"desc"`
SysBaseMenuID uint `json:"sysBaseMenuID"`
}
type MenuParameterRequest struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
SysBaseMenuID uint `json:"SysBaseMenuID"`
Type string `json:"type"`
Key string `json:"key"`
Value string `json:"value"`
}
type MenuRequest struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
ParentID uint `json:"parentId"`
Path string `json:"path"`
Name string `json:"name"`
Hidden bool `json:"hidden"`
Component string `json:"component"`
Sort int `json:"sort"`
Meta MenuMetaRequest `json:"meta"`
MenuButtons []MenuButtonRequest `json:"menuBtn"`
Parameters []MenuParameterRequest `json:"parameters"`
}
type DeleteMenuRequest struct {
ID int `json:"id"`
}
type GetMenuRequest struct {
ID int `json:"id"`
}
type SetAuthorityMenusRequest struct {
AuthorityID uint `json:"authorityId"`
Menus []MenuRequest `json:"menus"`
}
type GetAuthorityMenusRequest struct {
AuthorityID uint `json:"authorityId"`
}
type SetMenuRolesRequest struct {
MenuID uint `json:"menuId" form:"menuId"`
AuthorityIDs []uint `json:"authorityIds"`
}
type MenuMetaResponse struct {
ActiveName string `json:"activeName"`
KeepAlive bool `json:"keepAlive"`
DefaultMenu bool `json:"defaultMenu"`
Title string `json:"title"`
Icon string `json:"icon"`
CloseTab bool `json:"closeTab"`
TransitionType string `json:"transitionType"`
}
type MenuButtonResponse struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
Name string `json:"name"`
Description string `json:"desc"`
SysBaseMenuID uint `json:"sysBaseMenuID"`
}
type MenuParameterResponse struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
SysBaseMenuID uint `json:"SysBaseMenuID"`
Type string `json:"type"`
Key string `json:"key"`
Value string `json:"value"`
}
type MenuResponse struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
MenuID uint `json:"menuId,omitempty"`
ParentID uint `json:"parentId"`
Path string `json:"path"`
Name string `json:"name"`
Hidden bool `json:"hidden"`
Component string `json:"component"`
Sort int `json:"sort"`
Meta MenuMetaResponse `json:"meta"`
Children []*MenuResponse `json:"children"`
Parameters []MenuParameterResponse `json:"parameters"`
MenuButtons []MenuButtonResponse `json:"menuBtn"`
Authorities []*AuthorityResponse `json:"authoritys"`
}
type DynamicMenuResponse struct {
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
ID uint `json:"ID"`
MenuID uint `json:"menuId"`
ParentID uint `json:"parentId"`
Path string `json:"path"`
Name string `json:"name"`
Hidden bool `json:"hidden"`
Component string `json:"component"`
Sort int `json:"sort"`
Meta MenuMetaResponse `json:"meta"`
Children []*DynamicMenuResponse `json:"children"`
Parameters []MenuParameterResponse `json:"parameters"`
MenuButtons []MenuButtonResponse `json:"menuBtn"`
Buttons map[string]uint `json:"btns"`
Authorities []*AuthorityResponse `json:"authoritys"`
}
type AuthorityMenuResponse struct {
// The administration response embeds the base-menu fields, so menu fields are
// flat in the response (there is no sysBaseMenu envelope). Keep the
// authority ID internal, matching the compatible json:"-" field.
*DynamicMenuResponse
AuthorityID uint `json:"-"`
}