business_table_controller.go 2.2 KB
package controllers

import (
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/command"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/query"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/service"
)

func (controller *TableController) ShowBusinessDatabases() {
	tableService := service.NewTableService(nil)
	cmd := &query.ShowBusinessDatabasesRequest{}
	Must(controller.Unmarshal(cmd))
	data, err := tableService.ShowBusinessDatabases(ParseContext(controller.BaseController), cmd)
	controller.Response(data, err)
}

func (controller *TableController) ShowBusinessTables() {
	tableService := service.NewTableService(nil)
	cmd := &query.ShowTablesRequest{}
	Must(controller.Unmarshal(cmd))
	data, err := tableService.ShowBusinessTables(ParseContext(controller.BaseController), cmd)
	controller.Response(data, err)
}

func (controller *TableController) QueryBusinessTable() {
	tableService := service.NewTableService(nil)
	cmd := &query.ShowTableDataRequest{}
	Must(controller.Unmarshal(cmd))
	data, err := tableService.QueryBusinessTable(ParseContext(controller.BaseController), cmd)
	controller.Response(data, err)
}

func (controller *TableController) UpdateBusinessTable() {
	tableService := service.NewTableService(nil)
	cmd := &command.UpdateBusinessTableRequest{}
	Must(controller.Unmarshal(cmd))
	data, err := tableService.UpdateBusinessTable(ParseContext(controller.BaseController), cmd)
	controller.Response(data, err)
}

func (controller *TableController) GenerateBusinessTable() {
	tableService := service.NewTableService(nil)
	cmd := &command.GenerateBusinessTableRequest{}
	Must(controller.Unmarshal(cmd))
	data, err := tableService.GenerateBusinessTable(ParseContext(controller.BaseController), cmd)
	controller.Response(data, err)
}

func (controller *TableController) GenerateBusinessTablesView() {
	tableService := service.NewTableService(nil)
	cmd := &command.GenerateBusinessTableViewRequest{}
	Must(controller.Unmarshal(cmd))
	data, err := tableService.GenerateBusinessTablesView(ParseContext(controller.BaseController), cmd)
	controller.Response(data, err)
}