repository.go 4.5 KB
package factory

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

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

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

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

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

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

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

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

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

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

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

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

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

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