menu_controller.go 1.2 KB
package web_client

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/service"
)

type MenuController struct {
	baseController
}

func (controller *MenuController) MenuList() {
	menuService := service.NewMenuService(nil)
	menuListQuery := &query.MenuListQuery{}
	menuListQuery.Operator = controller.GetOperator()
	data, err := menuService.MenuList(menuListQuery)
	controller.Response(data, err)
}

func (controller *MenuController) MenuUpdate() {
	menuService := service.NewMenuService(nil)
	menuUpdateQuery := &command.MenuUpdateCommand{}
	controller.Unmarshal(menuUpdateQuery)
	menuUpdateQuery.Operator = controller.GetOperator()
	data, err := menuService.MenuUpdate(menuUpdateQuery)
	controller.Response(data, err)
}

func (controller *MenuController) MenuFavorite() {
	menuService := service.NewMenuService(nil)
	menuFavoriteCommand := &command.MenuFavoriteCommand{}
	controller.Unmarshal(menuFavoriteCommand)
	data, err := menuService.MenuFavorite(menuFavoriteCommand)
	controller.Response(data, err)
}