repositories

package
v0.0.0-...-1aaf8f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorSummaryNotFound              = "Summary with id=%d not found"
	ErrorSummaryForSKUNotFound        = "Summary for sku=%s not found"
	ErrorSummaryForItemByTypeNotFound = "Summary for stock item with id=%d and type=%s not found"
)
View Source
const (
	ErrorAddressNotFound = "Address with id=%d not found"
)
View Source
const (
	ErrorCarrierNotFound = "Carrier with id=%d not found"
)
View Source
const (
	ErrorNotEnoughStockItemUnits = "Not enough units of status %s for stock item %d of type %v."
)
View Source
const (
	ErrorShipmentLineItemNotFound = "Shipment line item with id=%d not found"
)
View Source
const (
	ErrorShipmentNotFound = "Shipment with id=%d not found"
)
View Source
const (
	ErrorShippingMethodNotFound = "Shipping method with id=%d not found"
)
View Source
const (
	ErrorStockItemNotFound = "Stock item with id=%d not found"
)
View Source
const (
	ErrorStockLocationNotFound = "Stock location with id=%d not found"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GeneralRepositoryTestSuite

type GeneralRepositoryTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

type IAddressRepository

type IAddressRepository interface {
	GetAddressByID(id uint) (*models.Address, error)
	CreateAddress(address *models.Address) (*models.Address, error)
	DeleteAddress(id uint) error
}

func NewAddressRepository

func NewAddressRepository(db *gorm.DB) IAddressRepository

type ICarrierRepository

type ICarrierRepository interface {
	GetCarriers() ([]*models.Carrier, error)
	GetCarrierByID(id uint) (*models.Carrier, error)
	CreateCarrier(carrier *models.Carrier) (*models.Carrier, error)
	UpdateCarrier(carrier *models.Carrier) (*models.Carrier, error)
	DeleteCarrier(id uint) error
}

func NewCarrierRepository

func NewCarrierRepository(db *gorm.DB) ICarrierRepository

type IShipmentLineItemRepository

type IShipmentLineItemRepository interface {
	GetShipmentLineItemsByShipmentID(id uint) ([]*models.ShipmentLineItem, error)
	CreateShipmentLineItem(shipmentLineItem *models.ShipmentLineItem) (*models.ShipmentLineItem, error)
	UpdateShipmentLineItem(shipmentLineItem *models.ShipmentLineItem) (*models.ShipmentLineItem, error)
	DeleteShipmentLineItem(id uint) error
}

func NewShipmentLineItemRepository

func NewShipmentLineItemRepository(db *gorm.DB) IShipmentLineItemRepository

type IShipmentRepository

type IShipmentRepository interface {
	WithTransaction(txn *gorm.DB) IShipmentRepository
	GetShipmentsByOrder(orderRefNum string) ([]*models.Shipment, error)
	GetShipmentByID(ref uint) (*models.Shipment, error)
	CreateShipment(shipment *models.Shipment) (*models.Shipment, error)
	UpdateShipment(shipment *models.Shipment) (*models.Shipment, error)
	DeleteShipment(id uint) error
}

func NewShipmentRepository

func NewShipmentRepository(db *gorm.DB) IShipmentRepository

type IShippingMethodRepository

type IShippingMethodRepository interface {
	GetShippingMethods() ([]*models.ShippingMethod, error)
	GetShippingMethodByID(id uint) (*models.ShippingMethod, error)
	CreateShippingMethod(shippingMethod *models.ShippingMethod) (*models.ShippingMethod, error)
	UpdateShippingMethod(shippingMethod *models.ShippingMethod) (*models.ShippingMethod, error)
	DeleteShippingMethod(id uint) error
}

func NewShippingMethodRepository

func NewShippingMethodRepository(db *gorm.DB) IShippingMethodRepository

type IStockItemRepository

type IStockItemRepository interface {
	GetStockItems() ([]*models.StockItem, error)
	GetStockItemById(id uint) (*models.StockItem, error)
	GetStockItemsBySKUs(skus []string) ([]*models.StockItem, error)
	GetAFSByID(id uint, unitType models.UnitType) (*models.AFS, error)
	GetAFSBySKU(sku string, unitType models.UnitType) (*models.AFS, error)
	GetAFSBySkuId(skuId uint) (*[]models.AfsByType, error)

	UpsertStockItem(item *models.StockItem) error
	DeleteStockItem(stockItemId uint) error
}

func NewStockItemRepository

func NewStockItemRepository(db *gorm.DB) IStockItemRepository

type IStockItemUnitRepository

type IStockItemUnitRepository interface {
	WithTransaction(txn *gorm.DB) IStockItemUnitRepository
	GetStockItemUnitIDs(stockItemID uint, unitStatus models.UnitStatus, unitType models.UnitType, count int) ([]uint, error)
	GetUnitsInOrder(refNum string) ([]*models.StockItemUnit, error)
	GetUnitForLineItem(refNum string, sku string) (*models.StockItemUnit, error)
	GetQtyForOrder(refNum string) ([]*models.Release, error)

	HoldUnits(orderRefNum string, skuCode string, qty uint) ([]*models.StockItemUnit, error)
	ReserveUnit(orderRefNum string, skuCode string) (*models.StockItemUnit, error)

	HoldUnitsInOrder(refNum string, ids []uint) (int, error)
	ReserveUnitsInOrder(refNum string) (int, error)
	UnsetUnitsInOrder(refNum string) (int, error)
	ShipUnitsInOrder(refNum string) (int, error)
	DeleteUnitsInOrder(refNum string) (int, error)

	CreateUnits(units []*models.StockItemUnit) error
	DeleteUnits(ids []uint) error
}

func NewStockItemUnitRepository

func NewStockItemUnitRepository(db *gorm.DB) IStockItemUnitRepository

type IStockLocationRepository

type IStockLocationRepository interface {
	GetLocations() ([]*models.StockLocation, error)
	GetLocationByID(id uint) (*models.StockLocation, error)
	CreateLocation(location *models.StockLocation) (*models.StockLocation, error)
	UpdateLocation(location *models.StockLocation) (*models.StockLocation, error)
	DeleteLocation(id uint) error
}

func NewStockLocationRepository

func NewStockLocationRepository(db *gorm.DB) IStockLocationRepository

type ISummaryRepository

type ISummaryRepository interface {
	WithTransaction(txn *gorm.DB) ISummaryRepository

	GetSummary() ([]*models.StockItemSummary, error)
	GetSummaryBySKU(sku string) ([]*models.StockItemSummary, error)

	GetSummaryItemByType(stockItemId uint, unitType models.UnitType) (*models.StockItemSummary, error)

	CreateStockItemSummary(summary []*models.StockItemSummary) error
	UpdateStockItemSummary(summary *models.StockItemSummary) error

	CreateStockItemTransaction(transaction *models.StockItemTransaction) error
	UpdateSummariesFromTransactions(transactions []*models.StockItemTransaction) error
}

func NewSummaryRepository

func NewSummaryRepository(db *gorm.DB) ISummaryRepository

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL