validators

package
v0.0.0-...-f266b67 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: LGPL-2.1, LGPL-2.1-or-later Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCreateCategory

func ValidateCreateCategory(ctx echo.Context) (*models.Category, error)

func ValidateCreateCollection

func ValidateCreateCollection(ctx echo.Context) (*models.Collection, error)

func ValidateCreateStore

func ValidateCreateStore(ctx echo.Context) (*models.Store, error)

func ValidateCreateStoreStaff

func ValidateCreateStoreStaff(ctx echo.Context) (*string, *string, error)

func ValidateLogin

func ValidateLogin(ctx echo.Context) (*reqLogin, error)

func ValidateRegister

func ValidateRegister(ctx echo.Context) (*models.User, error)

func ValidateResetPassword

func ValidateResetPassword(ctx echo.Context) (*reqResetPassword, error)

func ValidateUpdateLocation

func ValidateUpdateLocation(ctx echo.Context, single bool) (*reqUpdateLocation, error)

func ValidateUpdateStore

func ValidateUpdateStore(ctx echo.Context) (*reqStoreUpdate, error)

func ValidateUpdateStoreStaff

func ValidateUpdateStoreStaff(ctx echo.Context) (*string, error)

func ValidateUpdateStoreStatus

func ValidateUpdateStoreStatus(ctx echo.Context) (*models.StoreStatus, *int64, error)

func ValidateUserUpdate

func ValidateUserUpdate(ctx echo.Context) (*reqUserUpdate, error)

func ValidateUserUpdatePermission

func ValidateUserUpdatePermission(ctx echo.Context) (*reqUserUpdatePermission, error)

func ValidateUserUpdateStatus

func ValidateUserUpdateStatus(ctx echo.Context) (*reqUserUpdateStatus, error)

Types

type ReqAddProductAttribute

type ReqAddProductAttribute struct {
	Key   string `json:"key" valid:"required"`
	Value string `json:"value" valid:"required"`
}

func ValidateAddProductAttribute

func ValidateAddProductAttribute(ctx echo.Context) (*ReqAddProductAttribute, error)

type ReqAddressCreate

type ReqAddressCreate struct {
	Name      string `json:"name" valid:"required"`
	Address   string `json:"address" valid:"required"`
	State     string `json:"state"`
	City      string `json:"city" valid:"required"`
	CountryID int64  `json:"country_id" valid:"required"`
	Postcode  string `json:"postcode" valid:"required"`
	Email     string `json:"email"`
	Phone     string `json:"phone"`
}

func ValidateCreateAddress

func ValidateCreateAddress(ctx echo.Context) (*ReqAddressCreate, error)

type ReqBrainTreeCreatePayment

type ReqBrainTreeCreatePayment struct {
	Nonce *string `json:"nonce" valid:"required,stringlength(1|1000)"`
}

func ValidateCreateReqBrainTreePayment

func ValidateCreateReqBrainTreePayment(ctx echo.Context) (*ReqBrainTreeCreatePayment, error)

type ReqCategoryUpdate

type ReqCategoryUpdate struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
	Image       *string `json:"image"`
	IsPublished *bool   `json:"is_published"`
}

func ValidateUpdateCategory

func ValidateUpdateCategory(ctx echo.Context) (*ReqCategoryUpdate, error)

type ReqCollectionUpdate

type ReqCollectionUpdate struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
	Image       *string `json:"image"`
	IsPublished *bool   `json:"is_published"`
}

func ValidateUpdateCollection

func ValidateUpdateCollection(ctx echo.Context) (*ReqCollectionUpdate, error)

type ReqCreateBusinessAccountType

type ReqCreateBusinessAccountType struct {
	Name        string `json:"name" valid:"required,stringlength(1|100)"`
	IsPublished bool   `json:"is_published"`
}

func ValidateCreateBusinessAccountType

func ValidateCreateBusinessAccountType(ctx echo.Context) (*ReqCreateBusinessAccountType, error)

type ReqCreateCoupon

type ReqCreateCoupon struct {
	Code            string            `json:"code" valid:"required,stringlength(1|100)"`
	IsActive        bool              `json:"is_active"`
	DiscountAmount  int64             `json:"discount_amount" valid:"required,range(1|100000000)"`
	IsFlatDiscount  bool              `json:"is_flat_discount"`
	IsUserSpecific  bool              `json:"is_user_specific"`
	MaxDiscount     int64             `json:"max_discount" valid:"range(0|100000000)"`
	MaxUsage        int               `json:"max_usage" valid:"required,range(1|100000000)"`
	MaxUsagePerUser int               `json:"max_usage_per_user" valid:"range(0|100000000)"`
	MinOrderValue   int64             `json:"min_order_value" valid:"range(0|100000000)"`
	DiscountType    models.CouponType `json:"discount_type" valid:"required"`
	StartAt         string            `json:"start_at" valid:"required"`
	EndAt           string            `json:"end_at" valid:"required"`
}

func ValidateCreateCoupon

func ValidateCreateCoupon(ctx echo.Context) (*ReqCreateCoupon, error)

type ReqCreateOrUpdatePayoutSettings

type ReqCreateOrUpdatePayoutSettings struct {
	CountryID              int64  `json:"country_id" valid:"required"`
	AccountTypeID          string `json:"account_type_id" valid:"required"`
	BusinessName           string `json:"business_name" valid:"required"`
	BusinessAddressID      string `json:"business_address_id" valid:"required"`
	VatNumber              string `json:"vat_number"`
	PayoutMethodID         string `json:"payout_method_id" valid:"required"`
	PayoutMethodDetails    string `json:"payout_method_details" valid:"required"`
	PayoutMinimumThreshold int64  `json:"payout_minimum_threshold"`
}

func ValidateCreateOrUpdatePayoutSettings

func ValidateCreateOrUpdatePayoutSettings(ctx echo.Context) (*ReqCreateOrUpdatePayoutSettings, error)

type ReqCreatePayoutEntry

type ReqCreatePayoutEntry struct {
	Amount int64  `json:"amount" valid:"range(1|1000000)"`
	Note   string `json:"note"`
}

func ValidateCreatePayoutEntry

func ValidateCreatePayoutEntry(ctx echo.Context) (*ReqCreatePayoutEntry, error)

type ReqCreatePayoutMethod

type ReqCreatePayoutMethod struct {
	Name        string `json:"name" valid:"required,stringlength(1|100)"`
	Inputs      string `json:"inputs"`
	IsPublished bool   `json:"is_published"`
}

func ValidateCreatePayoutMethod

func ValidateCreatePayoutMethod(ctx echo.Context) (*ReqCreatePayoutMethod, error)

type ReqOrderCreate

type ReqOrderCreate struct {
	Items             []ReqOrderItem `json:"items" valid:"required"`
	ShippingAddressID *string        `json:"shipping_address_id"`
	BillingAddressID  string         `json:"billing_address_id" valid:"required"`
	PaymentMethodID   string         `json:"payment_method_id" valid:"required"`
	ShippingMethodID  *string        `json:"shipping_method_id"`
	UserID            string         `json:"user_id"`
	CouponCode        *string        `json:"coupon_code"`
}

func ValidateCreateOrder

func ValidateCreateOrder(ctx echo.Context) (*ReqOrderCreate, error)

type ReqOrderItem

type ReqOrderItem struct {
	ID         string   `json:"id" valid:"required"`
	Quantity   int      `json:"quantity" valid:"range(1|10000000)"`
	Attributes []string `json:"attributes"`
}

type ReqOrderUpdate

type ReqOrderUpdate struct {
	Status models.OrderStatus `json:"status"`
}

func ValidateUpdateOrder

func ValidateUpdateOrder(ctx echo.Context) (*ReqOrderUpdate, error)

type ReqPaymentMethodCreate

type ReqPaymentMethodCreate struct {
	Name             string `json:"name" valid:"required"`
	IsPublished      bool   `json:"is_published"`
	IsFlat           bool   `json:"is_flat"`
	ProcessingFee    int64  `json:"processing_fee"`
	MinProcessingFee int64  `json:"min_processing_fee"`
	MaxProcessingFee int64  `json:"max_processing_fee"`
	IsOfflinePayment bool   `json:"is_offline_payment"`
}

func ValidateCreatePaymentMethod

func ValidateCreatePaymentMethod(ctx echo.Context) (*ReqPaymentMethodCreate, error)

type ReqPaymentStatusUpdate

type ReqPaymentStatusUpdate struct {
	Status models.PaymentStatus `json:"status"`
}

func ValidateUpdatePaymentStatus

func ValidateUpdatePaymentStatus(ctx echo.Context) (*ReqPaymentStatusUpdate, error)

type ReqProductCreate

type ReqProductCreate struct {
	Name             string   `json:"name" valid:"required,stringlength(3|100)"`
	Description      string   `json:"description" valid:"required,stringlength(3|100000)"`
	IsPublished      bool     `json:"is_published"`
	CategoryID       *string  `json:"category_id"`
	Image            string   `json:"image"`
	IsShippable      bool     `json:"is_shippable"`
	IsDigital        bool     `json:"is_digital"`
	SKU              string   `json:"sku" valid:"required,stringlength(1|100)"`
	Stock            int      `json:"stock" valid:"range(0|100000)"`
	Unit             string   `json:"unit" valid:"required,stringlength(1|20)"`
	Price            int64    `json:"price" valid:"range(0|10000000)"`
	MaxQuantityCount int      `json:"max_quantity_count"`
	ProductCost      int64    `json:"product_cost" valid:"range(0|10000000)"`
	AdditionalImages []string `json:"additional_images"`
}

func ValidateCreateProduct

func ValidateCreateProduct(ctx echo.Context) (*ReqProductCreate, error)

type ReqProductUpdate

type ReqProductUpdate struct {
	Name                *string  `json:"name" valid:"required,stringlength(3|100)"`
	Description         *string  `json:"description" valid:"required,stringlength(3|100000)"`
	IsPublished         *bool    `json:"is_published"`
	CategoryID          *string  `json:"category_id"`
	Image               *string  `json:"image"`
	IsShippable         *bool    `json:"is_shippable"`
	IsDigital           *bool    `json:"is_digital"`
	SKU                 *string  `json:"sku" valid:"required,stringlength(1|100)"`
	Stock               *int     `json:"stock" valid:"range(0|100000)"`
	Unit                *string  `json:"unit" valid:"required,stringlength(1|20)"`
	Price               *int64   `json:"price" valid:"range(0|10000000)"`
	ProductCost         *int64   `json:"product_cost" valid:"range(0|10000000)"`
	MaxQuantityCount    *int     `json:"max_quantity_count" valid:"range(0,10000)"`
	DigitalDownloadLink *string  `json:"digital_download_link" valid:"stringlength(1|1000000)"`
	AdditionalImages    []string `json:"additional_images"`
}

func ValidateUpdateProduct

func ValidateUpdateProduct(ctx echo.Context) (*ReqProductUpdate, error)

type ReqReviewCreate

type ReqReviewCreate struct {
	Rating      int    `json:"rating" valid:"required,range(1|5)"`
	Description string `json:"description" valid:"required,stringlength(2|100000)"`
}

func ValidateCreateReview

func ValidateCreateReview(ctx echo.Context) (*ReqReviewCreate, error)

type ReqSettingsUpdate

type ReqSettingsUpdate struct {
	Name                         *string                `json:"name"`
	Website                      *string                `json:"website"`
	Status                       *models.PlatformStatus `json:"status"`
	EnabledAutoStoreConfirmation *bool                  `json:"enabled_auto_store_confirmation"`
	CompanyAddressID             *string                `json:"company_address_id"`
	IsSignUpEnabled              *bool                  `json:"is_sign_up_enabled"`
	IsStoreCreationEnabled       *bool                  `json:"is_store_creation_enabled"`
	DefaultCommissionRate        *int64                 `json:"default_commission_rate"`
	TagLine                      *string                `json:"tag_line"`
}

func ValidateUpdateSettings

func ValidateUpdateSettings(ctx echo.Context) (*ReqSettingsUpdate, error)

type ReqShippingMethodCreate

type ReqShippingMethodCreate struct {
	Name                    string            `json:"name" valid:"required"`
	ApproximateDeliveryTime int               `json:"approximate_delivery_time" valid:"required"`
	DeliveryCharge          int64             `json:"delivery_charge" valid:"required"`
	IsPublished             bool              `json:"is_published"`
	IsFlat                  bool              `json:"is_flat"`
	WeightUnit              models.WeightUnit `json:"weight_unit" valid:"required"`
}

func ValidateCreateShippingMethod

func ValidateCreateShippingMethod(ctx echo.Context) (*ReqShippingMethodCreate, error)

type ReqUpdateBusinessAccountType

type ReqUpdateBusinessAccountType struct {
	Name        *string `json:"name"`
	IsPublished *bool   `json:"is_published"`
}

func ValidateUpdateBusinessAccountType

func ValidateUpdateBusinessAccountType(ctx echo.Context) (*ReqUpdateBusinessAccountType, error)

type ReqUpdateCoupon

type ReqUpdateCoupon struct {
	Code            *string            `json:"code"`
	IsActive        *bool              `json:"is_active"`
	DiscountAmount  *int64             `json:"discount_amount"`
	IsFlatDiscount  *bool              `json:"is_flat_discount"`
	IsUserSpecific  *bool              `json:"is_user_specific"`
	MaxDiscount     *int64             `json:"max_discount"`
	MaxUsage        *int               `json:"max_usage"`
	MaxUsagePerUser *int               `json:"max_usage_per_user"`
	MinOrderValue   *int64             `json:"min_order_value"`
	DiscountType    *models.CouponType `json:"discount_type"`
	StartAt         *string            `json:"start_at"`
	EndAt           *string            `json:"end_at"`
}

func ValidateUpdateCoupon

func ValidateUpdateCoupon(ctx echo.Context) (*ReqUpdateCoupon, error)

type ReqUpdatePayoutEntry

type ReqUpdatePayoutEntry struct {
	Amount        *int64                   `json:"amount"`
	Status        *models.PayoutSendStatus `json:"status"`
	Highlights    *string                  `json:"highlights"`
	FailureReason *string                  `json:"failure_reason"`
}

func ValidateUpdatePayoutEntry

func ValidateUpdatePayoutEntry(ctx echo.Context) (*ReqUpdatePayoutEntry, error)

type ReqUpdatePayoutMethod

type ReqUpdatePayoutMethod struct {
	Name        *string `json:"name"`
	Inputs      *string `json:"inputs"`
	IsPublished *bool   `json:"is_published"`
}

func ValidateReqUpdatePayoutMethod

func ValidateReqUpdatePayoutMethod(ctx echo.Context) (*ReqUpdatePayoutMethod, error)

Jump to

Keyboard shortcuts

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