repository.go 6.6 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)
}

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

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

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

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

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

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

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

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

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