models

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllRole = []Role{
	RoleAdmin,
	RoleUser,
}

Functions

This section is empty.

Types

type AuthResponse added in v0.0.6

type AuthResponse struct {
	UserID   int    `json:"userId"`
	Username string `json:"username"`
	Token    string `json:"token"`
}

type Coffee

type Coffee struct {
	ID          string        `json:"id"`
	Name        *string       `json:"name"`
	Image       *string       `json:"image"`
	Teaser      *string       `json:"teaser"`
	Collection  *string       `json:"collection"`
	Origin      *string       `json:"origin"`
	Color       *string       `json:"color"`
	Description *string       `json:"description"`
	Price       *float64      `json:"price"`
	Ingredients []*Ingredient `json:"ingredients"`
}

func CoffeeFromProductsAPI

func CoffeeFromProductsAPI(cof []hashicups.Coffee) ([]*Coffee, error)

CoffeeFromProductsAPI is an adaptor function which converts the products api model into the local model

type CoffeeInput added in v0.0.6

type CoffeeInput struct {
	ID string `json:"id"`
}

type Currency

type Currency string
const (
	CurrencyUsd Currency = "USD"
	CurrencyEur Currency = "EUR"
	CurrencyGbp Currency = "GBP"
)

func (Currency) IsValid

func (e Currency) IsValid() bool

func (Currency) MarshalGQL

func (e Currency) MarshalGQL(w io.Writer)

func (Currency) String

func (e Currency) String() string

func (*Currency) UnmarshalGQL

func (e *Currency) UnmarshalGQL(v interface{}) error

type Ingredient

type Ingredient struct {
	ID       string  `json:"id"`
	Name     *string `json:"name"`
	Quantity *int    `json:"quantity"`
	Unit     *string `json:"unit"`
}

func IngredientsFromProductAPI added in v0.0.6

func IngredientsFromProductAPI(pIngs []hashicups.Ingredient) ([]*Ingredient, error)

IngredientsFromProductAPI is an adaptor function which converts the Ingredients API model into the local model

type Order added in v0.0.6

type Order struct {
	ID    string       `json:"id"`
	Items []*OrderItem `json:"items"`
}

func OrderFromProductsAPI added in v0.0.6

func OrderFromProductsAPI(po *hashicups.Order) (*Order, error)

OrderFromProductsAPI is an adaptor function which converts the Order API model into the local model

func OrdersFromProductsAPI added in v0.0.6

func OrdersFromProductsAPI(pOrders *[]hashicups.Order) ([]*Order, error)

OrdersFromProductsAPI is an adaptor function which converts the Orders API model into the local model

type OrderItem added in v0.0.6

type OrderItem struct {
	Coffee   *Coffee `json:"coffee"`
	Quantity int     `json:"quantity"`
}

type OrderItemInput added in v0.0.6

type OrderItemInput struct {
	Coffee   *CoffeeInput `json:"coffee"`
	Quantity int          `json:"quantity"`
}

type PaymentDetails added in v0.0.2

type PaymentDetails struct {
	Name   string  `json:"name"`
	Type   string  `json:"type"`
	Number string  `json:"number"`
	Expiry string  `json:"expiry"`
	Cv2    int     `json:"cv2"`
	Amount float64 `json:"amount"`
}

type PaymentResponse added in v0.0.2

type PaymentResponse struct {
	ID             string `json:"id"`
	Message        string `json:"message"`
	CardPlaintext  string `json:"card_plaintext"`
	CardCiphertext string `json:"card_ciphertext"`
}

type Role

type Role string
const (
	RoleAdmin Role = "ADMIN"
	RoleUser  Role = "USER"
)

func (Role) IsValid

func (e Role) IsValid() bool

func (Role) MarshalGQL

func (e Role) MarshalGQL(w io.Writer)

func (Role) String

func (e Role) String() string

func (*Role) UnmarshalGQL

func (e *Role) UnmarshalGQL(v interface{}) error

type User

type User struct {
	ID   string  `json:"id"`
	Name *string `json:"name"`
}

type UserAuth added in v0.0.6

type UserAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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