models

package
v0.0.0-...-c0bcdf1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID        int       `gorm:"column:id;primary_key" json:"id"`
	UserID    int       `gorm:"column:user_id" json:"user_id" binding:"required"`
	Name      string    `gorm:"column:name" json:"name" binding:"required"`
	Lastname  string    `gorm:"column:lastname" json:"lastname" binding:"required"`
	Email     string    `gorm:"column:email" json:"email" binding:"required"`
	Phone     string    `gorm:"column:phone" json:"phone" binding:"required"`
	Address   string    `gorm:"column:address" json:"address" binding:"required"`
	Zipcode   string    `gorm:"column:zipcode" json:"zipcode" binding:"required"`
	City      string    `gorm:"column:city" json:"city" binding:"required"`
	Country   string    `gorm:"column:country" json:"country" binding:"required"`
	CreatedAt null.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt null.Time `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt null.Time `gorm:"column:deleted_at" json:"deleted_at"`
}

Customer represents the customer that purchase the grocery

func (*Customer) TableName

func (c *Customer) TableName() string

TableName sets the insert table name for this struct type

type Invoice

type Invoice struct {
	Number     string      `gorm:"column:number;primary_key" json:"number"`
	OrderID    int         `gorm:"column:order_id" json:"order_id" binding:"required"`
	StatusCode string      `gorm:"column:status_code" json:"status_code" binding:"required"`
	Placed     time.Time   `gorm:"column:placed" json:"placed" binding:"required"`
	Details    null.String `gorm:"column:details" json:"details"`
	CreatedAt  null.Time   `gorm:"column:created_at" json:"created_at"`
	UpdatedAt  null.Time   `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt  null.Time   `gorm:"column:deleted_at" json:"deleted_at"`
}

Invoice is the struct to represent the invoice sent to the customer

func (*Invoice) TableName

func (i *Invoice) TableName() string

TableName sets the insert table name for this struct type

type Order

type Order struct {
	ID            int        `gorm:"column:id;primary_key" json:"id"`
	CustomerID    int        `gorm:"column:customer_id" json:"customer_id" binding:"required"`
	StatusCode    StatusCode `` /* 143-byte string literal not displayed */
	Products      []Product  `json:"products" validate:"required"`
	Amount        float64    `json:"amount" validate:"required"`
	Tip           float64    `json:"tip" validate:"required"`
	Remarks       string     `json:"remarks" validate:"required"`
	PaymentMethod string     `json:"paymentMethod" validate:"required"`
	Issuer        string     `json:"issuer"`
	Fee           float64    `json:"deliveryFee" validate:"required"`
	Time          time.Time  `json:"deliveryTime" validate:"required"`
	Address       string     `json:"deliveryAddress" validate:"required"`
	Postcode      string     `json:"deliveryPostcode" validate:"required"`
	City          string     `json:"deliveryCity" validate:"required"`
	PhoneNumber   string     `json:"phoneNumber" validate:"required"`
	OrderNumber   string     `gorm:"unique_index"`
	CreatedAt     null.Time  `gorm:"column:created_at" json:"created_at"`
	UpdatedAt     null.Time  `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt     null.Time  `gorm:"column:deleted_at" json:"deleted_at"`
}

Order is the struct that creates the order from the customer

func (*Order) TableName

func (o *Order) TableName() string

TableName sets the insert table name for this struct type

type OrderItem

type OrderItem struct {
	ID          int       `gorm:"column:id;primary_key" json:"id"`
	ProductID   int       `gorm:"column:product_id" json:"product_id" binding:"required"`
	OrderNumber string    `gorm:"column:order_number;index" json:"order_number"`
	StatusCode  string    `gorm:"column:status_code" json:"status_code" binding:"required"`
	Quantity    int       `gorm:"column:quantity" json:"quantity" binding:"required"`
	Price       float64   `gorm:"column:price" json:"price" binding:"required"`
	CreatedAt   null.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   null.Time `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt   null.Time `gorm:"column:deleted_at" json:"deleted_at"`
}

OrderItem represents the object that creates basically an order

func (*OrderItem) TableName

func (o *OrderItem) TableName() string

TableName sets the insert table name for this struct type

type Payment

type Payment struct {
	ID            int       `gorm:"column:id;primary_key" json:"id"`
	InvoiceNumber string    `gorm:"column:invoice_number" json:"invoice_number" binding:"required"`
	Placed        time.Time `gorm:"column:placed" json:"placed" binding:"required"`
	Amount        float64   `gorm:"column:amount" json:"amount" binding:"required"`
}

Payment is the struct that contains the payment details

func (*Payment) TableName

func (p *Payment) TableName() string

TableName sets the insert table name for this struct type

type Product

type Product struct {
	ID          int         `gorm:"column:id;primary_key" json:"id"`
	StoreID     int         `gorm:"column:store_id;index" json:"store_id" binding:"required"`
	Name        string      `gorm:"column:name" json:"name" binding:"required"`
	Price       string      `gorm:"column:price" json:"price" binding:"required"`
	Description null.String `gorm:"column:description" json:"description"`
	Category    string      `gorm:"column:category" json:"category" binding:"required" validate:"required"`
	Weight      string      `gorm:"column:weight" json:"weight" binding:"required" validate:"required"`
	Frozen      bool        `gorm:"column:frozen" json:"frozen" binding:"required"`
	ImageURL    string      `gorm:"column:image_url" json:"imageUrl" binding:"required" validate:"required"`
	Quantity    uint        `gorm:"column:quantity" json:"quantity"`
	CreatedAt   null.Time   `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   null.Time   `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt   null.Time   `gorm:"column:deleted_at" json:"deleted_at"`
}

Product is the generic object that represent a single item of the store

func (*Product) TableName

func (p *Product) TableName() string

TableName sets the insert table name for this struct type

type Products

type Products struct {
	Data []Product `json:"products"`
}

Products is a set of product

type RefInvoiceStatusCode

type RefInvoiceStatusCode struct {
	StatusCode string      `gorm:"column:status_code;primary_key" json:"status_code"`
	Details    null.String `gorm:"column:details" json:"details"`
}

RefInvoiceStatusCode is a reference table

func (*RefInvoiceStatusCode) TableName

func (r *RefInvoiceStatusCode) TableName() string

TableName sets the insert table name for this struct type

type RefOrderItemStatusCode

type RefOrderItemStatusCode struct {
	StatusCode  StatusCode  `gorm:"column:status_code;primary_key" json:"status_code"`
	Description null.String `gorm:"column:description" json:"description"`
}

RefOrderItemStatusCode is a reference table

func (*RefOrderItemStatusCode) TableName

func (r *RefOrderItemStatusCode) TableName() string

TableName sets the insert table name for this struct type

type Shipment

type Shipment struct {
	ID             int         `gorm:"column:id;primary_key" json:"id"`
	OrderID        int         `gorm:"column:order_id" json:"order_id" binding:"required"`
	InvoiceNumber  string      `gorm:"column:invoice_number" json:"invoice_number" binding:"required"`
	TrackingNumber string      `gorm:"column:tracking_number" json:"tracking_number" binding:"required"`
	Placed         time.Time   `gorm:"column:placed" json:"placed" binding:"required"`
	Details        null.String `gorm:"column:details" json:"details"`
	CreatedAt      null.Time   `gorm:"column:created_at" json:"created_at"`
	UpdatedAt      null.Time   `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt      null.Time   `gorm:"column:deleted_at" json:"deleted_at"`
}

Shipment is the object that represents the tracking of the order

func (*Shipment) TableName

func (s *Shipment) TableName() string

TableName sets the insert table name for this struct type

type ShipmentItem

type ShipmentItem struct {
	ShipmentID  int `gorm:"column:shipment_id;primary_key" json:"shipment_id"`
	OrderItemID int `gorm:"column:order_item_id" json:"order_item_id"`
}

ShipmentItem is a reference table

func (*ShipmentItem) TableName

func (s *ShipmentItem) TableName() string

TableName sets the insert table name for this struct type

type StatusCode

type StatusCode string
const (
	Open     StatusCode = "OPEN"
	Pending  StatusCode = "PENDING"
	Expired  StatusCode = "EXPIRED"
	Canceled StatusCode = "CANCELED"
	Failed   StatusCode = "FAILED"
)

func (*StatusCode) Scan

func (sc *StatusCode) Scan(value interface{}) error

Scan converts the object StatusCode into bytes

func (StatusCode) Value

func (sc StatusCode) Value() (driver.Value, error)

Value returns the correct string representation of a StatusCode

type Store

type Store struct {
	ID          int       `gorm:"column:id;primary_key" json:"id"`
	UserID      int       `gorm:"column:user_id" json:"user_id" binding:"required"`
	Name        string    `gorm:"column:name" json:"name" binding:"required"`
	Description string    `gorm:"column:description" json:"description" binding:"required"`
	Address     string    `gorm:"column:address" json:"address" binding:"required"`
	Zipcode     string    `gorm:"column:zipcode" json:"zipcode" binding:"required"`
	City        string    `gorm:"column:city" json:"city" binding:"required"`
	Latitude    float64   `gorm:"column:latitude" json:"latitude"`
	Longitude   float64   `gorm:"column:longitude" json:"longitude"`
	Picture     string    `gorm:"column:picture" json:"picture" binding:"required"`
	CreatedAt   null.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   null.Time `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt   null.Time `gorm:"column:deleted_at" json:"deleted_at"`
}

Store is the object that represents the store itself

func (*Store) TableName

func (s *Store) TableName() string

TableName sets the insert table name for this struct type

type User

type User struct {
	ID        int       `gorm:"column:id;primary_key" json:"id"`
	Username  string    `gorm:"column:username;unique" json:"username" binding:"required"`
	CreatedAt null.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt null.Time `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt null.Time `gorm:"column:deleted_at" json:"deleted_at"`
}

User is the generic object that can be either a customer or a store

func (*User) TableName

func (u *User) TableName() string

TableName sets the insert table name for this struct type

Jump to

Keyboard shortcuts

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