auth_controller.go 2.8 KB
package controllers

import (
	"github.com/linmadan/egglib-go/web/beego"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/auth/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/auth/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/auth/service"
)

type AuthController struct {
	beego.BaseController
}

func (controller *AuthController) CompanySignUp() {
	authService := service.NewAuthService(nil)
	companySignUpCommand := &command.CompanySignUpCommand{}
	controller.Unmarshal(companySignUpCommand)
	data, err := authService.CompanySignUp(companySignUpCommand)
	controller.Response(data, err)
}

func (controller *AuthController) PhoneAuthCheck() {
	authService := service.NewAuthService(nil)
	phoneAuthCheckCommand := &command.PhoneAuthCheckCommand{}
	controller.Unmarshal(phoneAuthCheckCommand)
	data, err := authService.PhoneAuthCheck(phoneAuthCheckCommand)
	controller.Response(data, err)
}

func (controller *AuthController) PhoneAuthResetPassword() {
	authService := service.NewAuthService(nil)
	phoneAuthResetPasswordCommand := &command.PhoneAuthResetPasswordCommand{}
	controller.Unmarshal(phoneAuthResetPasswordCommand)
	data, err := authService.PhoneAuthResetPassword(phoneAuthResetPasswordCommand)
	controller.Response(data, err)
}

func (controller *AuthController) PhoneAuthChangePassword() {
	authService := service.NewAuthService(nil)
	phoneAuthChangePasswordCommand := &command.PhoneAuthChangePasswordCommand{}
	controller.Unmarshal(phoneAuthChangePasswordCommand)
	data, err := authService.PhoneAuthChangePassword(phoneAuthChangePasswordCommand)
	controller.Response(data, err)
}

func (controller *AuthController) PhoneAuthResetPhone() {
	authService := service.NewAuthService(nil)
	phoneAuthResetPhoneCommand := &command.PhoneAuthResetPhoneCommand{}
	controller.Unmarshal(phoneAuthResetPhoneCommand)
	data, err := authService.PhoneAuthResetPhone(phoneAuthResetPhoneCommand)
	controller.Response(data, err)
}

func (controller *AuthController) DestroyAccount() {
	authService := service.NewAuthService(nil)
	destroyAccountCommand := &command.DestroyAccountCommand{}
	controller.Unmarshal(destroyAccountCommand)
	data, err := authService.DestroyAccount(destroyAccountCommand)
	controller.Response(data, err)
}

func (controller *AuthController) UserInfo() {
	authService := service.NewAuthService(nil)
	userInfoQuery := &query.UserInfoQuery{}
	controller.Unmarshal(userInfoQuery)
	data, err := authService.UserInfo(userInfoQuery)
	controller.Response(data, err)
}

func (controller *AuthController) RefreshIM() {
	authService := service.NewAuthService(nil)
	refreshIMCommand := &command.RefreshIMCommand{}
	controller.Unmarshal(refreshIMCommand)
	data, err := authService.RefreshIM(refreshIMCommand)
	controller.Response(data, err)
}