api_service

package
v0.0.0-...-e764b3d Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIService

type APIService struct {
	// contains filtered or unexported fields
}

func New

func New(repo restaurantRepository) *APIService

func (*APIService) CreateReport

func (svc *APIService) CreateReport(ctx context.Context, request CreateReportRequest) (Report, error)

func (*APIService) GetCustomerOrderHistory

func (svc *APIService) GetCustomerOrderHistory(ctx context.Context, request GetCustomerOrdersHistoryRequest) (history GetCustomerOrderHistoryResponse, err error)

func (*APIService) GetDishesByIngredients

func (svc *APIService) GetDishesByIngredients(ctx context.Context, ingredient string) (dishes []dish.RecieveDish, err error)

func (*APIService) GetDishesWithIngredients

func (svc *APIService) GetDishesWithIngredients(ctx context.Context) (dishes []dish.Dish, err error)

func (*APIService) GetEmployeesOrdersCount

func (svc *APIService) GetEmployeesOrdersCount(ctx context.Context, request GetEmployeesOrdersCountRequest) (employees []GetEmployeesOrdersCountResponse, err error)

func (*APIService) GetExpiringProducts

func (svc *APIService) GetExpiringProducts(ctx context.Context) (products []GetExpiringSoonProductsResponse, err error)

func (*APIService) GetMostPopularDishes

func (svc *APIService) GetMostPopularDishes(ctx context.Context) (dishes []GetMostPopularDishesResponse, err error)

func (*APIService) GetSuppliersByProduct

func (svc *APIService) GetSuppliersByProduct(ctx context.Context, productName string) (suppliers []supplier.Supplier, err error)

func (*APIService) GetUnorderedDishes

func (svc *APIService) GetUnorderedDishes(ctx context.Context) (dishes []dish.RecieveDish, err error)

type CreateReportRequest

type CreateReportRequest struct {
	DateFrom time.Time
	DateTo   time.Time
}

type Dish

type Dish struct {
	DishName string  `json:"name"`
	Quantity int     `json:"dish_quantity"`
	Price    float64 `json:"dish_price"`
}

type GetCustomerOrderHistoryResponse

type GetCustomerOrderHistoryResponse struct {
	CustomerID  int64   `json:"customer_id" db:"customer_id"`
	FirstName   string  `json:"first_name"  db:"first_name"`
	LastName    string  `json:"last_name"   db:"last_name"`
	PhoneNumber string  `json:"phone_number" db:"phone_number"`
	Email       string  `json:"email" db:"email"`
	Discount    int     `json:"discount" db:"discount"`
	OrdersBytes []byte  `db:"orders"`
	Orders      []Order `json:"orders"`
}

type GetCustomerOrdersHistoryRequest

type GetCustomerOrdersHistoryRequest struct {
	CustomerID int       `json:"customer_id"`
	DateFrom   time.Time `json:"date_from"`
	DateTo     time.Time `json:"date_to"`
}

type GetEmployeesOrdersCountRequest

type GetEmployeesOrdersCountRequest struct {
	DateFrom time.Time `json:"date_from"`
	DateTo   time.Time `json:"date_to"`
}

type GetEmployeesOrdersCountResponse

type GetEmployeesOrdersCountResponse struct {
	EmployeeID   int64   `json:"employee_id" db:"employee_id"`
	PositionID   int     `json:"position_id" db:"position_id"`
	FirstName    string  `json:"first_name" db:"first_name"`
	LastName     string  `json:"last_name" db:"last_name"`
	PositionName string  `json:"position_name" db:"position_name"`
	Salary       float64 `json:"salary" db:"salary"`
	PhoneNumber  string  `json:"phone_number" db:"phone_number"`
	OrdersCount  int     `json:"orders_count" db:"orders_count"`
}

type GetExpiringSoonProductsResponse

type GetExpiringSoonProductsResponse struct {
	ProductID        int64  `db:"product_id" json:"product_id"`
	Name             string `db:"name" json:"name"`
	DateOfProduction string `db:"date_of_production" json:"date_of_production"`
	DateOfExpiry     string `db:"date_of_expiry" json:"date_of_expiry"`
	Status           string `db:"status" json:"status"`
}

type GetMostPopularDishesResponse

type GetMostPopularDishesResponse struct {
	DishID       int64   `json:"dish_id" db:"dish_id"`
	DishName     string  `json:"dish_name" db:"dish_name"`
	Price        float64 `json:"price" db:"price"`
	OrderedCount int     `json:"ordered_count" db:"ordered_count"`
}

type Order

type Order struct {
	OrderID       int64   `json:"order_id"`
	CustomerID    int64   `json:"customer_id"`
	TransactionID int64   `json:"transaction_id"`
	CreatedAt     string  `json:"created_at"`
	Price         float64 `json:"price"`
	Dishes        []Dish  `json:"dishes"`
}

type Report

type Report struct {
	LostRevenue        float64   `json:"lost_revenue"`
	NetProfit          float64   `json:"net_profit"`
	AverageSupplyCheck float64   `json:"average_supply_check"`
	AverageOrderCheck  float64   `json:"average_order_check"`
	AmountSupplyCosts  float64   `json:"amount_supply_costs"`
	DateFrom           time.Time `json:"date_from"`
	DateTo             time.Time `json:"date_to"`
}

Jump to

Keyboard shortcuts

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