cooperation_application_controller.go 4.9 KB
package controllers

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/service"
)

type CooperationApplicationController struct {
	BaseController
}

func (controller *CooperationApplicationController) ApplyForCooperation() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	applyForCooperationCommand := &command.ApplyForCooperationCommand{}
	controller.Unmarshal(applyForCooperationCommand)
	data, err := cooperationApplicationService.ApplyForCooperation(applyForCooperationCommand)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) AgreeCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	agreeCooperationApplicationCommand := &command.AgreeCooperationApplicationCommand{}
	controller.Unmarshal(agreeCooperationApplicationCommand)
	data, err := cooperationApplicationService.AgreeCooperationApplication(agreeCooperationApplicationCommand)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) RejectCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	rejectCooperationApplicationCommand := &command.RejectCooperationApplicationCommand{}
	controller.Unmarshal(rejectCooperationApplicationCommand)
	data, err := cooperationApplicationService.RejectCooperationApplication(rejectCooperationApplicationCommand)
	controller.Response(data, err)
}

func (controller *CooperationContractController) BatchApprovalCooperationApplication() {

}

func (controller *CooperationApplicationController) CreateCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	createCooperationApplicationCommand := &command.CreateCooperationApplicationCommand{}
	controller.Unmarshal(createCooperationApplicationCommand)
	data, err := cooperationApplicationService.CreateCooperationApplication(createCooperationApplicationCommand)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) UpdateCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	updateCooperationApplicationCommand := &command.UpdateCooperationApplicationCommand{}
	controller.Unmarshal(updateCooperationApplicationCommand)
	cooperationApplicationId := controller.GetString(":cooperationApplicationId")
	updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
	data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) GetCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{}
	cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
	getCooperationApplicationQuery.CooperationApplicationId = cooperationApplicationId
	data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) RemoveCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	removeCooperationApplicationCommand := &command.RemoveCooperationApplicationCommand{}
	controller.Unmarshal(removeCooperationApplicationCommand)
	cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
	removeCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
	data, err := cooperationApplicationService.RemoveCooperationApplication(removeCooperationApplicationCommand)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) SearchCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	searchCooperationApplicationQuery := &query.SearchCooperationApplicationQuery{}
	data, err := cooperationApplicationService.SearchCooperationApplication(searchCooperationApplicationQuery)
	controller.Response(data, err)
}

func (controller *CooperationApplicationController) ListCooperationApplication() {
	cooperationApplicationService := service.NewCooperationApplicationService(nil)
	listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{}
	offset, _ := controller.GetInt("offset")
	listCooperationApplicationQuery.Offset = offset
	limit, _ := controller.GetInt("limit")
	listCooperationApplicationQuery.Limit = limit
	data, err := cooperationApplicationService.ListCooperationApplication(listCooperationApplicationQuery)
	controller.Response(data, err)
}