repository.go 3.5 KB
package factory

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

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

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

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

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

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

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

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

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

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

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