handler

package
v0.0.0-...-2c16718 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SuccessToCreateAddress = "address created with success"
	SuccessToGetAddress    = "address found with success"
	ErrorToCreateAddress   = "error to create and process the request"
	ErrorToGetAddress      = "error to get and address by id"
	AddressNotFound        = "address not found"
	AddressNotFoundMessage = "the address with id %d wasn't found"
)
View Source
const (
	SuccessToCreateCustomer = "user created with success"
	ErrorToCreateCustomer   = "error to create and process the request"
)
View Source
const (
	SuccessToCreatePerson = "person created with success"
	SuccessToGetPerson    = "person found with success"
	ErrorToCreatePerson   = "error to create and process the request"
	ErrorToGetPerson      = "error to get person by id"
	PersonNotFound        = "person with id %d wasn´t found"
)
View Source
const (
	SuccessToCreatePhone = "phone created with success"
	SuccessToGetPhone    = "phone found with success"
	ErrorToCreatePhone   = "error to create and process the request"
	ErrorToGetPhone      = "error retrieving phone by ID" //TODO: Adjust error messages to this model
	PhoneNotFound        = "phone not found"
	PhoneNotFoundMessage = "the phone with id %d wasn't found"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	AddressService input.IAddressService
	LoggerSugar    *zap.SugaredLogger
}

func (*Address) Create

func (c *Address) Create(w http.ResponseWriter, r *http.Request)

func (*Address) GetByID

func (c *Address) GetByID(w http.ResponseWriter, r *http.Request)

type AddressRequest

type AddressRequest struct {
	ID     int64  `json:"id"`
	Street string `json:"street"`
	Number string `json:"number"`
}

type AddressResponse

type AddressResponse struct {
	ID     int64  `json:"id"`
	Street string `json:"street"`
	Number string `json:"number"`
}

type Customer

type Customer struct {
	CustomerService input.ICustomerService
	LoggerSugar     *zap.SugaredLogger
}

func (*Customer) Create

func (c *Customer) Create(w http.ResponseWriter, r *http.Request)

type CustomerRequest

type CustomerRequest struct {
	ID          int64             `json:"id"`
	Name        string            `json:"name"`
	Phone       map[string]string `json:"phone"` // key: tipo telefone, val: telefone
	Address     string            `json:"address"`
	DateCreated time.Time         `json:"date_created"`
}

type CustomerResponse

type CustomerResponse struct {
	ID          int64             `json:"id"`
	Name        string            `json:"name"`
	Phone       map[string]string `json:"phone"` // key: tipo telefone, val: telefone
	Address     string            `json:"address"`
	DateCreated time.Time         `json:"date_created"`
}

type Generic

type Generic struct {
	LoggerSugar *zap.SugaredLogger
}

func (*Generic) HealthCheck

func (h *Generic) HealthCheck(w http.ResponseWriter, r *http.Request)

func (*Generic) NotFound

func (h *Generic) NotFound(w http.ResponseWriter, r *http.Request)

type Person

type Person struct {
	PersonService input.IPersonService
	LoggerSugar   *zap.SugaredLogger
}

func (*Person) Create

func (c *Person) Create(w http.ResponseWriter, r *http.Request)

func (*Person) GetByID

func (c *Person) GetByID(w http.ResponseWriter, r *http.Request)

type PersonRequest

type PersonRequest struct {
	ID         int64  `json:"id"`
	Document   string `json:"document"`
	PersonType string `json:"person_type"`
}

type PersonResponse

type PersonResponse struct {
	ID         int64  `json:"id"`
	Document   string `json:"document"`
	PersonType string `json:"person_type"`
}

type Phone

type Phone struct {
	PhoneService input.IPhoneService
	LoggerSugar  *zap.SugaredLogger
}

func (*Phone) Create

func (c *Phone) Create(w http.ResponseWriter, r *http.Request)

func (*Phone) GetByID

func (c *Phone) GetByID(w http.ResponseWriter, r *http.Request)

type PhoneRequest

type PhoneRequest struct {
	ID             int64  `json:"id"`
	Number         string `json:"number"`
	CodeAreaNumber string `json:"code_area"`
	PhoneType      string `json:"phone_type"`
}

type PhoneResponse

type PhoneResponse struct {
	ID             int64  `json:"id"`
	Number         string `json:"number"`
	CodeAreaNumber string `json:"code_area"`
	PhoneType      string `json:"phone_type"`
}

Jump to

Keyboard shortcuts

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