models

package
v0.0.0-...-aeb9f2e Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: CC-BY-4.0 Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewItemResponseListRenderer

func NewItemResponseListRenderer(items ItemList) []render.Renderer

Types

type AccessToken

type AccessToken struct {
	AccessToken string `json:"access_token"`
}

func (*AccessToken) Bind

func (at *AccessToken) Bind(request *http.Request) error

func (*AccessToken) Render

func (at *AccessToken) Render(writer http.ResponseWriter, request *http.Request) error

type AuthObj

type AuthObj struct {
	UserId string `json:"user_id"`
}

func (*AuthObj) Bind

func (ao *AuthObj) Bind(request *http.Request) error

func (*AuthObj) Render

func (ao *AuthObj) Render(writer http.ResponseWriter, request *http.Request) error

type Invitation

type Invitation struct {
	UserId    string `json:"user_id"`
	Items     []uint `json:"items"`
	Recipient string `json:"recipient"`
}

func (*Invitation) Bind

func (invitation *Invitation) Bind(request *http.Request) error

func (*Invitation) Render

func (Invitation *Invitation) Render(writer http.ResponseWriter, request *http.Request) error

type Item

type Item struct {
	ID            uint      `gorm:"primary_key" json:"id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	Name          string    `gorm:"type:varchar(255); not null" json:"name"`
	Price         float32   `sql:"type:decimal(10,2); not null" json:"price"`                   // TODO better to rid of this in the future
	Vendor        string    `gorm:"type:varchar(100); not null" json:"vendor"`                  // TODO future table called Vendor, foreign key here
	VendorID      string    `gorm:"type:varchar(255); unique_index; not null" json:"vendor_id"` // TODO ID given by the vendor better name
	HasBeenBaught bool      `gorm:"type:bool; default:false; not null" json:"has_been_baught"`
}

func (*Item) Bind

func (i *Item) Bind(r *http.Request) error

func (*Item) Render

func (*Item) Render(w http.ResponseWriter, r *http.Request) error

func (*Item) TableName

func (*Item) TableName() string

type ItemList

type ItemList []Item

func (*ItemList) Bind

func (*ItemList) Bind(r *http.Request) error

type ItemResponse

type ItemResponse struct {
	ID            uint      `json:"id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	Name          string    `json:"name"`
	Price         float32   `json:"price"`
	Vendor        string    `json:"vendor"`
	VendorID      string    `json:"vendor_id"`
	HasBeenBaught bool      `json:"has_been_baught"`
}

func NewItemReponse

func NewItemReponse(item Item) ItemResponse

func (*ItemResponse) Render

type ItemResponseList

type ItemResponseList []ItemResponse

type ItemUpdate

type ItemUpdate struct {
	Name          string  `json:"name"`
	Price         float32 `json:"price"`
	VendorID      string  `json:"vendor_id"`
	HasBeenBaught bool    `json:"has_been_baught"`
}

func (*ItemUpdate) Bind

func (i *ItemUpdate) Bind(r *http.Request) error

func (*ItemUpdate) Render

func (*ItemUpdate) TableName

func (*ItemUpdate) TableName() string

func (ItemUpdate) ToMap

func (update ItemUpdate) ToMap() map[string]interface{}

type Mail

type Mail struct {
	Recipient string `json:"recipient"`
	Body      string `json:"body"`
}

func (*Mail) Bind

func (mail *Mail) Bind(request *http.Request) error

func (*Mail) Render

func (mail *Mail) Render(writer http.ResponseWriter, request *http.Request) error

type SuccessMessage

type SuccessMessage struct {
	Message string `json:"message"`
}

func (*SuccessMessage) Bind

func (m *SuccessMessage) Bind(request *http.Request) error

func (*SuccessMessage) Render

type User

type User struct {
	ID        uuid.UUID `gorm:"primary_key; unique; type:uuid; column:id; default:uuid_generate_v4()" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Items     []Item    `gorm:"many2many:user_items; constraint:OnDelete:CASCADE;" json:"items"`
}

func (*User) Bind

func (u *User) Bind(r *http.Request) error

func (*User) Render

func (*User) Render(w http.ResponseWriter, r *http.Request) error

func (*User) TableName

func (*User) TableName() string

type UserVerification

type UserVerification struct {
	IsVerified bool `json:"is_verified"`
}

func (*UserVerification) Bind

func (uv *UserVerification) Bind(request *http.Request) error

func (*UserVerification) Render

func (uv *UserVerification) Render(writer http.ResponseWriter, request *http.Request) error

type Wishlist

type Wishlist struct {
	ID     string         `json:"id"`
	Vendor string         `json:"vendor"`
	Name   string         `json:"name"`
	Items  []WishlistItem `json:"items"`
}

The wishlist model is only used for scraping

func (*Wishlist) Bind

func (whishlist *Wishlist) Bind(request *http.Request) error

func (*Wishlist) Render

func (whishlist *Wishlist) Render(writer http.ResponseWriter, request *http.Request) error

type WishlistItem

type WishlistItem struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Price  float32 `json:"price"`
	Vendor string  `json:"vendor"`
}

This wishlist item is only used for scraping

func (*WishlistItem) Bind

func (item *WishlistItem) Bind(r *http.Request) error

Jump to

Keyboard shortcuts

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