handlers

package
v0.0.0-...-fa32389 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPErrorResponse

func HTTPErrorResponse(w http.ResponseWriter, err error)

func HTTPResponse

func HTTPResponse(w http.ResponseWriter, code int, response []byte)

func Ping

func Ping(w http.ResponseWriter, r *http.Request)

Types

type BidController

type BidController struct {
	// contains filtered or unexported fields
}

func NewBidController

func NewBidController(service bid.Service) *BidController

func (*BidController) CreateBid

func (c *BidController) CreateBid(w http.ResponseWriter, r *http.Request)

func (*BidController) GetBid

func (c *BidController) GetBid(w http.ResponseWriter, r *http.Request)

type CreateBidRequest

type CreateBidRequest struct {
	InvoiceID  uuid.UUID `json:"invoice_id"`
	InvestorID uuid.UUID `json:"investor_id"`
	Amount     float64   `json:"amount"`
}

type CreateInvestorRequest

type CreateInvestorRequest struct {
	Name    string  `json:"name"`
	Balance float64 `json:"balance"`
}

type CreateInvoiceRequest

type CreateInvoiceRequest struct {
	InvoiceDate   time.Time `json:"invoice_date"`
	InvoiceNumber string    `json:"invoice_number"`
	Reference     string    `json:"reference"`
	CompanyName   string    `json:"company_name"`
	CustomerName  string    `json:"customer_name"`
	Currency      string    `json:"currency"`
	TotalAmount   float64   `json:"total_amount"`
	TotalVat      float64   `json:"total_vat"`
	DueDate       time.Time `json:"due_date"`
	IssuerID      uuid.UUID `json:"issuer_id"`
	AskingPrice   float64   `json:"asking_price"`
	InvoiceItems  []struct {
		Description string `json:"description"`
		// quantity might be better as a float
		Quantity  int     `json:"quantity"`
		UnitPrice float64 `json:"unit_price"`
		Amount    float64 `json:"amount"`
		Vat       float64 `json:"vat"`
		Total     float64 `json:"total"`
	} `json:"items"`
}

type CreateIssuerRequest

type CreateIssuerRequest struct {
	Name    string  `json:"name"`
	Balance float64 `json:"balance"`
}

type ErrorDetails

type ErrorDetails struct {
	Status      int    `json:"status"`
	Description string `json:"description"`
	Field       string `json:"field,omitempty"`
}

func ToHTTPError

func ToHTTPError(domainErr error) *ErrorDetails

type InvestorController

type InvestorController struct {
	// contains filtered or unexported fields
}

func NewInvestorController

func NewInvestorController(service investor.Service) *InvestorController

func (*InvestorController) CreateInvestor

func (c *InvestorController) CreateInvestor(w http.ResponseWriter, r *http.Request)

func (*InvestorController) GetInvestor

func (c *InvestorController) GetInvestor(w http.ResponseWriter, r *http.Request)

func (*InvestorController) ListInvestors

func (c *InvestorController) ListInvestors(w http.ResponseWriter, r *http.Request)

type InvoiceController

type InvoiceController struct {
	// contains filtered or unexported fields
}

func NewInvoiceController

func NewInvoiceController(
	service invoice.Service,
	bidService bid.Service,
) *InvoiceController

func (*InvoiceController) ApproveTrade

func (c *InvoiceController) ApproveTrade(w http.ResponseWriter, r *http.Request)

func (*InvoiceController) CreateInvoice

func (c *InvoiceController) CreateInvoice(w http.ResponseWriter, r *http.Request)

func (*InvoiceController) GetBids

func (c *InvoiceController) GetBids(w http.ResponseWriter, r *http.Request)

func (*InvoiceController) GetInvoice

func (c *InvoiceController) GetInvoice(w http.ResponseWriter, r *http.Request)

func (*InvoiceController) ListInvoices

func (c *InvoiceController) ListInvoices(w http.ResponseWriter, r *http.Request)

type IssuerController

type IssuerController struct {
	// contains filtered or unexported fields
}

func NewIssuerController

func NewIssuerController(service issuer.Service) *IssuerController

func (*IssuerController) CreateIssuer

func (c *IssuerController) CreateIssuer(w http.ResponseWriter, r *http.Request)

func (*IssuerController) GetIssuer

func (c *IssuerController) GetIssuer(w http.ResponseWriter, r *http.Request)

func (*IssuerController) ListIssuer

func (c *IssuerController) ListIssuer(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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