domain

package
v0.0.0-...-e85e4ab Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR_UNIQUE_CARD_NUMBER_ID = "the card number id must be unique"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Buyer

type Buyer struct {
	ID           int    `json:"id"`
	CardNumberId string `json:"card_number_id"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
}

type BuyerTotalOrders

type BuyerTotalOrders struct {
	ID                  int    `json:"id"`
	CardNumberId        string `json:"card_number_id"`
	FirstName           string `json:"first_name"`
	LastName            string `json:"last_name"`
	PurchaseOrdersCount int    `json:"purchase_orders_count"`
}

type Repository

type Repository interface {
	GetAll(ctx context.Context) ([]Buyer, error)
	Create(ctx context.Context, buyer Buyer) (Buyer, error)
	Update(ctx context.Context, buyer Buyer) (Buyer, error)
	Delete(ctx context.Context, id int) error
	GetById(ctx context.Context, id int) (Buyer, error)
	GetBuyerOrdersById(ctx context.Context, id int) (BuyerTotalOrders, error)
	GetBuyerTotalOrders(ctx context.Context) ([]BuyerTotalOrders, error)
	ValidateCardNumberId(ctx context.Context, id int, cardNumber string) (bool, error)
}

type Service

type Service interface {
	GetAll(ctx context.Context) ([]Buyer, error)
	Create(ctx context.Context, buyer Buyer) (Buyer, error)
	Update(ctx context.Context, buyer Buyer) (Buyer, error)
	Delete(ctx context.Context, id int) error
	GetById(ctx context.Context, id int) (Buyer, error)
	GetBuyerOrdersById(ctx context.Context, id int) (BuyerTotalOrders, error)
	GetBuyerTotalOrders(ctx context.Context) ([]BuyerTotalOrders, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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