dto

package
v0.0.0-...-786533a Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountResponse

type AccountResponse struct {
	Name string `json:"name"`
}

func FromDomainToDtoAccount

func FromDomainToDtoAccount(account domain.Account) AccountResponse

type CreateProductRequest

type CreateProductRequest struct {
	Name   string  `json:"name"`
	Price  float32 `json:"price"`
	Period string  `json:"period"`
	Active string  `json:"active"`
}

CreateProductRequest is an representation request body to create a new Product

func FromJSONCreateProductRequest

func FromJSONCreateProductRequest(body io.Reader) (*CreateProductRequest, error)

FromJSONCreateProductRequest converts json body request to a CreateProductRequest struct

type PaginationRequestParms

type PaginationRequestParms struct {
	Page    int `json:"page"`
	PerPage int `json:"perPage"`
}

PaginationRequestParms is an representation query string params to filter and paginate products

func FromValuePaginationRequestParams

func FromValuePaginationRequestParams(request *http.Request) (*PaginationRequestParms, error)

FromValuePaginationRequestParams converts query string params to a PaginationRequestParms struct

type PaginationResponse

type PaginationResponse struct {
	Items interface{} `json:"items"`
	Total int32       `json:"total"`
}

Pagination is representation of Fetch methods returns

type ProductResponse

type ProductResponse struct {
	ID     string  `json:"id,omitempty"`
	Name   string  `json:"name,omitempty"`
	Price  float32 `json:"price,omitempty"`
	Period string  `json:"period,omitempty"`
	Active string  `json:"active,omitempty"`
}

Product is entity of table product database column

func FromDomainToDtoProduct

func FromDomainToDtoProduct(product domain.Product) ProductResponse

type PurchaseRequest

type PurchaseRequest struct {
	ProductID string `json:"-"`
	AccountID string `json:"-"`
	Voucher   string `json:"voucher,omitempty" validate:"omitempty,min=3,max=50"`
}

PurchaseRequest is an representation request body to purchase a new Product

func FromJSONPurchaseProductRequest

func FromJSONPurchaseProductRequest(request *http.Request) (*PurchaseRequest, error)

FromJSONPurchaseProductRequest converts json body request to a PurchaseRequest struct

type Subscription

type Subscription struct {
	ID           string  `json:"subscription_id"`
	StartsAt     string  `json:"starts_at,omitempty"`
	EndsAt       string  `json:"ends_at,omitempty"`
	Product      string  `json:"product,omitempty"`
	Account      string  `json:"account,omitempty"`
	Status       string  `json:"status,omitempty"`
	Voucher      string  `json:"voucher,omitempty"`
	PaymentValue float32 `json:"payment_value,omitempty"`
}

Subscription is entity of table subscription database column

func FromDomainToDtoSubscription

func FromDomainToDtoSubscription(subscription domain.Subscription) Subscription

type SubscriptionDetailsResponse

type SubscriptionDetailsResponse struct {
	ID           string          `json:"subscription_id"`
	StartsAt     string          `json:"starts_at,omitempty"`
	EndsAt       string          `json:"ends_at,omitempty"`
	PausedAt     string          `json:"paused_at,omitempty"`
	CancelledAt  string          `json:"cancelled_at,omitempty"`
	Product      ProductResponse `json:"product,omitempty"`
	Account      AccountResponse `json:"account,omitempty"`
	Status       string          `json:"status,omitempty"`
	Voucher      string          `json:"voucher,omitempty"`
	PaymentValue float32         `json:"payment_value,omitempty"`
}

SubscriptionDetails is an representation of entity subscription

func FromDomainToDtoSubscriptionDetails

func FromDomainToDtoSubscriptionDetails(subscription domain.SubscriptionDetails) SubscriptionDetailsResponse

type UpdateSubscriptionStatus

type UpdateSubscriptionStatus struct {
	Status string `json:"status" validate:"required,oneof=PAUSED ACTIVE"`
}

UpdateSubscriptionStatus is an representation request body to update subscription status

func FromJSONUpdateSubscriptionStatusRequest

func FromJSONUpdateSubscriptionStatusRequest(body io.ReadCloser) (*UpdateSubscriptionStatus, error)

FromJSONUpdateSubscriptionStatusRequest converts json body request to a UpdateSubscriptionStatus struct

Jump to

Keyboard shortcuts

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