handler

package
v0.0.0-...-bfeb8cb Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddNewCarInput

type AddNewCarInput struct {
	RegNumber []string `json:"regNumber"`
}

type AddNewCarResponse

type AddNewCarResponse struct {
	response.Response
	ProcessedCars map[string]string `json:"processed_cars"`
}

type CarHandler

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

func NewCarHandler

func NewCarHandler(carInfoService carInfoService, carService carService, ownerService ownerService) *CarHandler

func (*CarHandler) AddNewCar

func (h *CarHandler) AddNewCar(log *slog.Logger) http.HandlerFunc

AddNewCar @Summary Add new cars @Tags cars @Description Add new cars by registration numbers @ID add-new-cars @Accept json @Produce json @Param input body AddNewCarInput true "registration numbers" @Success 200 {object} AddNewCarResponse @Failure 400 {object} response.Response @Failure 500 {object} response.Response @Router /cars [post]

func (*CarHandler) DeleteCar

func (h *CarHandler) DeleteCar(log *slog.Logger) http.HandlerFunc

DeleteCar @Summary Delete car @Tags cars @Description Delete car by registration number @ID delete-car @Accept json @Produce json @Param regNumber path string true "registration number" @Success 200 {object} response.Response @Failure 400 {object} response.Response @Failure 500 {object} response.Response @Router /cars/{regNumber} [delete]

func (*CarHandler) GetCars

func (h *CarHandler) GetCars(log *slog.Logger) http.HandlerFunc

GetCars @Summary Get cars @Tags cars @Description Get cars with filtration or pagination @ID get-cars @Accept json @Produce json @Param limit query int false "limit" @Param offset query int false "offset" @Param mark query string false "car mark" @Param ownerName query string false "car owner name" @Param ownerSurname query string false "car owner surname" @Param model query string false "car model" @Param year query int false "car year" @Success 200 {object} GetCarsResponse @Failure 400 {object} response.Response @Failure 500 {object} response.Response @Router /cars [get]

func (*CarHandler) UpdateCar

func (h *CarHandler) UpdateCar(log *slog.Logger) http.HandlerFunc

UpdateCar @Summary Update car @Tags cars @Description Update car by registration number @ID update-car @Accept json @Produce json @Param regNumber path string true "registration number" @Param input body UpdateCarInput true "car info" @Success 200 {object} response.Response @Failure 400 {object} response.Response @Failure 500 {object} response.Response @Router /cars/{regNumber} [put]

type GetCarsResponse

type GetCarsResponse struct {
	Cars []model.Car `json:"cars"`
	response.Response
}

type UpdateCarInput

type UpdateCarInput struct {
	Mark         string `json:"mark,omitempty"`
	Model        string `json:"model,omitempty"`
	Year         int    `json:"year,omitempty"`
	OwnerName    string `json:"ownerName,omitempty"`
	OwnerSurname string `json:"ownerSurname,omitempty"`
}

Jump to

Keyboard shortcuts

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