items

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetStatus

type GetStatus struct {
	DB *gorm.DB
}

func (GetStatus) GetItem

func (r GetStatus) GetItem(itemId string) (status ItemStatus, err error)

type IGetStatus

type IGetStatus interface {
	GetItem(itemId string) (ItemStatus, error)
}

type IRepository

type IRepository interface {
	GetItemOverview(itemId string) (Overview, error)
	GetPreviewList(pageNum int, pageSize int, conditions map[string]interface{}, tags []string) ([]Preview, int, error)
}

type IRequests

type IRequests interface {
	GetOverview(itemId string) (Overview, error)
	GetSearchPreviewList(ctx *gin.Context) ([]Preview, int, error)
}

type IUpdater

type IUpdater interface {
	ReduceStock(itemId string, Quantity int) error
	StatusUpdate(itemId string, State Status)
}

type IUtils

type IUtils interface {
	InspectSearchConditions(ctx *gin.Context) (pageNum int, pageSize int, conditions map[string]interface{}, tags []string, err error)
}

type ItemRepository

type ItemRepository struct {
	DB *gorm.DB
}

func (ItemRepository) GetItemOverview

func (r ItemRepository) GetItemOverview(itemId string) (overview Overview, err error)

func (ItemRepository) GetPreviewList

func (r ItemRepository) GetPreviewList(pageNum int, pageSize int, conditions map[string]interface{}, tags []string) ([]Preview, int, error)

type ItemStatus

type ItemStatus struct {
	Stock  int
	Status Status
}

type ItemUtils

type ItemUtils struct {
}

func (ItemUtils) InspectSearchConditions

func (i ItemUtils) InspectSearchConditions(ctx *gin.Context) (int, int, map[string]interface{}, []string, error)

type ManufacturerDetails

type ManufacturerDetails struct {
	Name            string `json:"name"`
	Description     string `json:"description"`
	StripeAccountId string `json:"stripe_account_id"`
	UserId          string
}

type Overview

type Overview struct {
	Item_id      string              `json:"item_id"`
	Properties   OverviewProperties  `json:"properties"`
	Manufacturer ManufacturerDetails `json:"manufacturer"`
}

type OverviewDetails

type OverviewDetails struct {
	Status      Status   `json:"status"`
	Stock       int      `json:"stock"`
	Size        int      `json:"size"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
}

type OverviewProperties

type OverviewProperties struct {
	Name    string          `json:"name"`
	Price   int             `json:"price"`
	Details OverviewDetails `json:"details"`
}

type Preview

type Preview struct {
	Item_id    string            `json:"item_id"`
	Properties PreviewProperties `json:"properties"`
}

type PreviewDetails

type PreviewDetails struct {
	Status Status `json:"status"`
}

type PreviewProperties

type PreviewProperties struct {
	Name    string         `json:"name"`
	Price   int            `json:"price"`
	Details PreviewDetails `json:"details"`
}

type Requests

type Requests struct {
	ItemRepository IRepository
	ItemUtils      IUtils
}

func (Requests) GetOverview

func (r Requests) GetOverview(itemId string) (Overview, error)

func (Requests) GetSearchPreviewList

func (r Requests) GetSearchPreviewList(ctx *gin.Context) ([]Preview, int, error)

type Status

type Status string
const (
	Available Status = "Available"
	Expired   Status = "Expired"
	Ready     Status = "Ready"
)

type Updater

type Updater struct {
	DB *gorm.DB
}

func (Updater) ReduceStock

func (r Updater) ReduceStock(itemId string, Quantity int) error

func (Updater) StatusUpdate

func (r Updater) StatusUpdate(itemId string, State Status)

Jump to

Keyboard shortcuts

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