repository.go 3.0 KB
package factory

import (
	"github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/repository"
)

func CreateMenuRepository(options map[string]interface{}) (domain.MenuRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewMenuRepository(transactionContext)
}

func CreateOrgRepository(options map[string]interface{}) (domain.OrgRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewOrgRepository(transactionContext)
}

func CreateRoleRepository(options map[string]interface{}) (domain.RoleRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewRoleRepository(transactionContext)
}

func CreateUserBaseRepository(options map[string]interface{}) (domain.UserBaseRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewUserBaseRepository(transactionContext)
}

func CreateUserRepository(options map[string]interface{}) (domain.UserRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewUserRepository(transactionContext)
}

func CreateCompanyRepository(options map[string]interface{}) (domain.CompanyRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewCompanyRepository(transactionContext)
}

func CreateCustomizeMenuRepository(options map[string]interface{}) (domain.CustomizeMenuRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewCustomizeMenuRepository(transactionContext)
}

func CreateAccountDestroyRecordRepository(options map[string]interface{}) (domain.AccountDestroyRecordRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewAccountDestroyRecordRepository(transactionContext)
}

func CreateUpChainRepository(options map[string]interface{}) (domain.UpChainRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewUpChainRepository(transactionContext)
}