disputes

package
v0.0.0-...-2127833 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DisputeImages

type DisputeImages struct {
	gorm.Model
	ID        uuid.UUID `gorm:"primaryKey"`
	Dispute   Disputes  `gorm:"foreignKey:DisputeID"`
	DisputeID uuid.UUID `gorm:"not null"`
	Image     string    `gorm:"not null"`
}

func (*DisputeImages) BeforeCreate

func (d *DisputeImages) BeforeCreate(tx *gorm.DB) (err error)

type DisputeRequest

type DisputeRequest struct {
	OrderID string `json:"orderID"`
	Dispute string `json:"dispute"`
}

type Disputes

type Disputes struct {
	gorm.Model
	ID       uuid.UUID       `gorm:"not null"`
	OrderID  uuid.UUID       `gorm:"not null"`
	Order    Orders          `gorm:"foreignKey:OrderID"`
	Dispute  string          `gorm:"not null"`
	Resolved bool            `gorm:"default:false"`
	Images   []DisputeImages `gorm:"foreignKey:DisputeID"`
}

func (*Disputes) BeforeCreate

func (d *Disputes) BeforeCreate(tx *gorm.DB) (err error)

type Handler

type Handler interface {
	// CreateDispute handles a request to create a dispute
	CreateDispute(w http.ResponseWriter, r *http.Request)
	// GetDispute handles a request to get a dispute
	GetDispute(w http.ResponseWriter, r *http.Request)
	// CloseDispute handles a request to close a dispute
	CloseDispute(w http.ResponseWriter, r *http.Request)
}

func NewDisputesHandler

func NewDisputesHandler(i *do.Injector) (Handler, error)

type Orders

type Orders struct {
	gorm.Model
	ID        uuid.UUID `gorm:"primaryKey"`
	ProductID uuid.UUID `gorm:"not null"`
	BuyerID   uuid.UUID `gorm:"not null"`
	Buyer     Users     `gorm:"foreignKey:BuyerID"`
	Quantity  int       `gorm:"not null"`
	Total     float64   `gorm:"not null"`
	TxHash    string
}

type Service

type Service interface {
	CreateDispute(userId string, d *Disputes) (string, error)

	GetDispute(userId string, id string) (*Disputes, error)

	CloseDispute(userId string, id string) error

	CreateDisputeImage(userId string, d *DisputeImages) error

	SaveFile(file *multipart.FileHeader, bucket string) (string, error)
}

func NewDisputesService

func NewDisputesService(i *do.Injector) (Service, error)

type Users

type Users struct {
	gorm.Model
	ID            uuid.UUID `gorm:"primaryKey"`
	FirstName     string    `gorm:"not null"`
	LastName      string    `gorm:"not null"`
	Address       string
	Email         string `gorm:"not null, unique"`
	EmailVerified bool   `gorm:"default:false"`
	Password      string `gorm:"not null"`
	WalletAddress string
}

Jump to

Keyboard shortcuts

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