models

package
v0.0.0-...-d7022d5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 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 ErrorCode

type ErrorCode int32
const (
	Unknown ErrorCode = iota
	Internal
	InvalidArgument
	Unauthenticated
	Conflict
	NotFound
	Canceled
	DeadlineExceeded
	PermissionDenied
)

func Code

func Code(err error) ErrorCode

func (ErrorCode) String

func (t ErrorCode) String() string

type Order

type Order struct {
	ID          string    `json:"id"`
	Tickets     []Ticket  `json:"tickets"`
	ScreeningID int64     `json:"screening_id"`
	Date        time.Time `json:"order_date"`
}

type OrderItem

type OrderItem struct {
	ID     string          `bson:"_id"`
	Status OrderItemStatus `bson:"status"`
}

type OrderItemStatus

type OrderItemStatus string
const (
	OrderItemStatusPaid            OrderItemStatus = "PAID"
	OrderItemStatusPaymentRequired OrderItemStatus = "PAYMENT_REQUIRED"
	OrderItemStatusRefundAwaiting  OrderItemStatus = "REFUND_AWAITING"
	OrderItemStatusCanceled        OrderItemStatus = "CANCELED"
	OrderItemStatusUsed            OrderItemStatus = "USED"
	OrderItemStatusRefunded        OrderItemStatus = "REFUNDED"
)

func GetAllowedPreviousOrderStatuses

func GetAllowedPreviousOrderStatuses(status OrderItemStatus) (allowed []OrderItemStatus)

func OrderItemStatusFromString

func OrderItemStatusFromString(str string) (status OrderItemStatus, err error)

type OrderPreview

type OrderPreview struct {
	OrderID     string    `bson:"_id"`
	OrderDate   time.Time `bson:"order_date"`
	TotalPrice  uint32    `bson:"total_price"`
	ScreeningID int64     `bson:"screening_id"`
}

type Place

type Place struct {
	Row  int32 `bson:"row" json:"row"`
	Seat int32 `bson:"seat" json:"seat"`
}

type ProcessOrderDTO

type ProcessOrderDTO struct {
	Places      []ProcessOrderPlace
	ID          string
	OwnerID     string
	ScreeningID int64
}

type ProcessOrderPlace

type ProcessOrderPlace struct {
	Place Place
	Price uint32
}

type ServiceError

type ServiceError struct {
	Msg  string
	Code ErrorCode
}

func Error

func Error(code ErrorCode, msg string) *ServiceError

func Errorf

func Errorf(code ErrorCode, format string, a ...any) *ServiceError

func (*ServiceError) Error

func (e *ServiceError) Error() string

type SortDTO

type SortDTO struct {
	FieldName    string
	SortOrdering SortOrdering
}

type SortOrdering

type SortOrdering string
const (
	ASC  SortOrdering = "ASC"
	DESC SortOrdering = "DESC"
)

type Ticket

type Ticket struct {
	ID     string          `json:"id"`
	Place  Place           `json:"place"`
	Price  uint32          `json:"price"`
	Status OrderItemStatus `json:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳