Documentation
¶
Index ¶
- func ActivateCurrency(currencySvc *currencysvc.Service) fiber.Handler
- func CheckCurrencySupported(currencySvc *currencysvc.Service) fiber.Handler
- func DeactivateCurrency(currencySvc *currencysvc.Service) fiber.Handler
- func GetCurrency(currencySvc *currencysvc.Service) fiber.Handler
- func GetCurrencyStatistics(currencySvc *currencysvc.Service) fiber.Handler
- func GetDefaultCurrency(currencySvc *currencysvc.Service) fiber.Handler
- func ListCurrencies(currencySvc *currencysvc.Service) fiber.Handler
- func ListSupportedCurrencies(currencySvc *currencysvc.Service) fiber.Handler
- func RegisterCurrency(currencySvc *currencysvc.Service) fiber.Handler
- func Routes(r fiber.Router, currencySvc *currencysvc.Service, authSvc *authsvc.Service, ...)
- func SearchCurrencies(currencySvc *currencysvc.Service) fiber.Handler
- func SearchCurrenciesByRegion(currencySvc *currencysvc.Service) fiber.Handler
- func UnregisterCurrency(currencySvc *currencysvc.Service) fiber.Handler
- type CurrencyResponse
- type RegisterRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivateCurrency ¶
func ActivateCurrency( currencySvc *currencysvc.Service, ) fiber.Handler
ActivateCurrency activates a currency (admin only) @Summary Activate currency @Description Activate a currency (admin only) @Tags currencies @Accept json @Produce json @Param code path string true "Currency code" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 404 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/admin/{code}/activate [put]
func CheckCurrencySupported ¶
func CheckCurrencySupported( currencySvc *currencysvc.Service, ) fiber.Handler
CheckCurrencySupported checks if a currency is supported @Summary Check if currency is supported @Description Check if a currency code is supported @Tags currencies @Accept json @Produce json @Param code path string true "Currency code (e.g., USD, EUR)" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Router /api/currencies/{code}/supported [get]
func DeactivateCurrency ¶
func DeactivateCurrency( currencySvc *currencysvc.Service, ) fiber.Handler
DeactivateCurrency deactivates a currency (admin only) @Summary Deactivate currency @Description Deactivate a currency (admin only) @Tags currencies @Accept json @Produce json @Param code path string true "Currency code" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 404 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/admin/{code}/deactivate [put]
func GetCurrency ¶
func GetCurrency( currencySvc *currencysvc.Service, ) fiber.Handler
GetCurrency returns currency information by code @Summary Get currency by code @Description Get currency information by ISO 4217 code @Tags currencies @Accept json @Produce json @Param code path string true "Currency code (e.g., USD, EUR)" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 404 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/{code} [get]
func GetCurrencyStatistics ¶
func GetCurrencyStatistics( currencySvc *currencysvc.Service, ) fiber.Handler
GetCurrencyStatistics returns currency statistics @Summary Get currency statistics @Description Get currency registry statistics @Tags currencies @Accept json @Produce json @Success 200 {object} common.Response @Failure 500 {object} common.ProblemDetails @Router /api/currencies/statistics [get]
func GetDefaultCurrency ¶
func GetDefaultCurrency( currencySvc *currencysvc.Service, ) fiber.Handler
GetDefaultCurrency returns the default currency information @Summary Get default currency @Description Get the default currency information @Tags currencies @Accept json @Produce json @Success 200 {object} common.Response @Failure 500 {object} common.ProblemDetails @Router /api/currencies/default [get]
func ListCurrencies ¶
func ListCurrencies( currencySvc *currencysvc.Service, ) fiber.Handler
ListCurrencies returns a Fiber handler for listing all available currencies. @Summary List all currencies @Description Get a list of all available currencies in the system @Tags currencies @Accept json @Produce json @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 429 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /currency [get] @Security Bearer
func ListSupportedCurrencies ¶
func ListSupportedCurrencies( currencySvc *currencysvc.Service, ) fiber.Handler
ListSupportedCurrencies returns all supported currency codes @Summary List supported currencies @Description Get all supported currency codes @Tags currencies @Accept json @Produce json @Success 200 {array} string @Failure 500 {object} common.ProblemDetails @Router /api/currencies/supported [get]
func RegisterCurrency ¶
func RegisterCurrency( currencySvc *currencysvc.Service, ) fiber.Handler
RegisterCurrency registers a new currency (admin only) @Summary Register currency @Description Register a new currency (admin only) @Tags currencies @Accept json @Produce json @Param currency body RegisterRequest true "Currency information" @Success 201 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 409 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/admin [post]
func Routes ¶
func Routes( r fiber.Router, currencySvc *currencysvc.Service, authSvc *authsvc.Service, cfg *config.App, )
Routes sets up the currency routes
func SearchCurrencies ¶
func SearchCurrencies( currencySvc *currencysvc.Service, ) fiber.Handler
SearchCurrencies searches for currencies by name @Summary Search currencies @Description Search for currencies by name @Tags currencies @Accept json @Produce json @Param q query string true "Search query" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/search [get]
func SearchCurrenciesByRegion ¶
func SearchCurrenciesByRegion( currencySvc *currencysvc.Service, ) fiber.Handler
SearchCurrenciesByRegion searches for currencies by region @Summary Search currencies by region @Description Search for currencies by region @Tags currencies @Accept json @Produce json @Param region path string true "Region name" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/region/{region} [get]
func UnregisterCurrency ¶
func UnregisterCurrency( currencySvc *currencysvc.Service, ) fiber.Handler
UnregisterCurrency removes a currency from the registry (admin only) @Summary Unregister currency @Description Remove a currency from the registry (admin only) @Tags currencies @Accept json @Produce json @Param code path string true "Currency code" @Success 200 {object} common.Response @Failure 400 {object} common.ProblemDetails @Failure 401 {object} common.ProblemDetails @Failure 404 {object} common.ProblemDetails @Failure 500 {object} common.ProblemDetails @Router /api/currencies/admin/{code} [delete]
Types ¶
type CurrencyResponse ¶ added in v1.3.0
type CurrencyResponse struct {
Code string `json:"code"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Decimals int `json:"decimals"`
Country string `json:"country,omitempty"`
Region string `json:"region,omitempty"`
Active bool `json:"active"`
Metadata map[string]string `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
CurrencyResponse represents the response structure for currency data
func ToResponse ¶ added in v1.3.0
func ToResponse(entity *currencysvc.Entity) *CurrencyResponse
ToResponse converts a currency entity to a response DTO
type RegisterRequest ¶ added in v1.3.0
type RegisterRequest struct {
Code string `json:"code" validate:"required,len=3,uppercase"`
Name string `json:"name" validate:"required"`
Symbol string `json:"symbol" validate:"required"`
Decimals int `json:"decimals" validate:"required,min=0,max=8"`
Country string `json:"country,omitempty"`
Region string `json:"region,omitempty"`
Active bool `json:"active"`
Metadata map[string]string `json:"metadata,omitempty"`
}
RegisterRequest represents the request body for registering a currency.
func (*RegisterRequest) ToServiceEntity ¶ added in v1.3.0
func (r *RegisterRequest) ToServiceEntity() *currencysvc.Entity
ToServiceEntity converts a RegisterRequest to a service layer entity