-
Notifications
You must be signed in to change notification settings - Fork 0
/
vending_machine_domain.go
35 lines (29 loc) · 989 Bytes
/
vending_machine_domain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package vendingMachineDomain
import (
"context"
"github.com/labstack/echo/v4"
vendingMachineDto "github.com/samannsr/vending-machine-control-system/internal/vending_machine/dto"
)
type VendingMachine struct {
ID int `json:"id"`
Status string
Inventory *Inventory
Coins int
}
type Inventory struct {
Cola int
Coffee int
}
type Configurator interface {
Configure(ctx context.Context) error
}
type UseCase interface {
InsertCoin(ctx context.Context, dto *vendingMachineDto.InsertCoinRequestDto) (*vendingMachineDto.InsertCoinResponseDto, error)
SelectProduct(ctx context.Context, dto *vendingMachineDto.SelectProductRequestDto) (*vendingMachineDto.SelectProductResponseDto, error)
GetVendingMachineById(ctx context.Context, dto *vendingMachineDto.GetVendingMachineByIdRequestDto) (*VendingMachine, error)
}
type HttpController interface {
InsertCoin(c echo.Context) error
SelectProduct(c echo.Context) error
GetVendingMachineById(c echo.Context) error
}