model

package
v0.0.0-...-d081b09 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID = errors.New("the ID is not valid")
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code       string
	Err        error
	Who        string
	StatusHTTP int
	Data       interface{}
	APIMessage string
	UserID     string
}

func NewError

func NewError() Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) HasCode

func (e *Error) HasCode() bool

func (*Error) HasData

func (e *Error) HasData() bool

func (*Error) HasStatusHTTP

func (e *Error) HasStatusHTTP() bool

type Invoice

type Invoice struct {
	ID              uuid.UUID `json:"id"`
	UserID          uuid.UUID `json:"user_id"`
	PurchaseOrderID uuid.UUID `json:"purchase_order_id"`
	CreatedAt       int64     `json:"created_at"`
	UpdatedAt       int64     `json:"updated_at"`
}

Invoice model of table invoices

func (Invoice) HasID

func (i Invoice) HasID() bool

type InvoiceDetail

type InvoiceDetail struct {
	ID        uuid.UUID `json:"id"`
	InvoiceID uuid.UUID `json:"invoice_id"`
	ProductID uuid.UUID `json:"product_id"`
	Amount    uint      `json:"amount"`
	UnitPrice float64   `json:"unit_price"`
	CreatedAt int64     `json:"created_at"`
	UpdatedAt int64     `json:"updated_at"`
}

InvoiceDetail model of table invoice_details

func (InvoiceDetail) HasID

func (i InvoiceDetail) HasID() bool

type InvoiceDetails

type InvoiceDetails []InvoiceDetail

InvoiceDetails slice of InvoiceDetail

func (InvoiceDetails) IsEmpty

func (i InvoiceDetails) IsEmpty() bool

type InvoiceDetailsReport

type InvoiceDetailsReport struct {
	InvoiceDetail InvoiceDetail `json:"invoice_detail"`
	Product       Product       `json:"product"`
}

type InvoiceDetailsReports

type InvoiceDetailsReports []InvoiceDetailsReport

type InvoiceReport

type InvoiceReport struct {
	Invoice              Invoice               `json:"invoice"`
	User                 User                  `json:"user"`
	InvoiceDetailsReport InvoiceDetailsReports `json:"invoice_details_report"`
}

type Invoices

type Invoices []Invoice

Invoices slice of Invoice

func (Invoices) IDs

func (i Invoices) IDs() []uuid.UUID

func (Invoices) IsEmpty

func (i Invoices) IsEmpty() bool

type InvoicesReport

type InvoicesReport []InvoiceReport

type JWTCustomClaims

type JWTCustomClaims struct {
	UserID  uuid.UUID `json:"user_id"`
	Email   string    `json:"email"`
	IsAdmin bool      `json:"is_admin"`
	jwt.StandardClaims
}

type Login

type Login struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

Login model of table logins

type MessageResponse

type MessageResponse struct {
	Data     interface{} `json:"data"`
	Errors   Responses   `json:"errors"`
	Messages Responses   `json:"messages"`
}

type PayPalRequestData

type PayPalRequestData struct {
	EventType string `json:"event_type"`
	ID        string `json:"id"`
	Resource  struct {
		ID       string `json:"id"`
		Status   string `json:"status"`
		CustomID string `json:"custom_id"`
		Amount   struct {
			Value string `json:"value"`
		} `json:"amount"`
	} `json:"resource"`
}

type PayPalRequestValidator

type PayPalRequestValidator struct {
	// Headers
	AuthAlgo         string `json:"auth_algo"`
	CertURL          string `json:"cert_url"`
	TransmissionID   string `json:"transmission_id"`
	TransmissionSig  string `json:"transmission_sig"`
	TransmissionTime string `json:"transmission_time"`

	// Body
	WebhookID    string          `json:"webhook_id"`
	WebhookEvent json.RawMessage `json:"webhook_event"`
}

type Product

type Product struct {
	ID          uuid.UUID       `json:"id"`
	ProductName string          `json:"product_name"`
	Price       float64         `json:"price"`
	Images      json.RawMessage `json:"images"`
	Description string          `json:"description"`
	Features    json.RawMessage `json:"features"`
	CreatedAt   int64           `json:"created_at"`
	UpdatedAt   int64           `json:"updated_at"`
}

Product model of table prodcuts

func (Product) HasID

func (p Product) HasID() bool

type ProductToPurchase

type ProductToPurchase struct {
	ProductID uuid.UUID `json:"product_id"`
	Amount    uint      `json:"amount"`
	UnitPrice float64   `json:"unit_price"`
}

type ProductToPurchases

type ProductToPurchases []ProductToPurchase

type Products

type Products []Product

Products slice of Product

func (Products) IsEmpty

func (p Products) IsEmpty() bool

type PurchaseOrder

type PurchaseOrder struct {
	ID        uuid.UUID       `json:"id"`
	UserID    uuid.UUID       `json:"user_id"`
	Products  json.RawMessage `json:"products"`
	CreatedAt int64           `json:"created_at"`
	UpdatedAt int64           `json:"updated_at"`
}

PurchaseOrder model of table purchase_orders

func (PurchaseOrder) HasID

func (p PurchaseOrder) HasID() bool

func (PurchaseOrder) TotalAmount

func (p PurchaseOrder) TotalAmount() float64

func (PurchaseOrder) Validate

func (p PurchaseOrder) Validate() error

type PurchaseOrders

type PurchaseOrders []PurchaseOrder

PurchaseOrders slice of PurchaseOrder

func (PurchaseOrders) IsEmpty

func (p PurchaseOrders) IsEmpty() bool

type Response

type Response struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Responses

type Responses []Response

type User

type User struct {
	ID        uuid.UUID       `json:"id"`
	Email     string          `json:"email"`
	Password  string          `json:"password"`
	IsAdmin   bool            `json:"is_admin"`
	Details   json.RawMessage `json:"details"`
	CreatedAt int64           `json:"created_at"`
	UpdatedAt int64           `json:"updated_at"`
}

type Users

type Users []User

Jump to

Keyboard shortcuts

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