Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func RegisterAuthHandler ¶
func RegisterAuthHandler(uc service.Authorization, v validator.Validator, m metrics.Metrics) *AuthHandler
func (*AuthHandler) Login ¶
func (a *AuthHandler) Login(c *fiber.Ctx) error
Login godoc @Summary Login @Description Logins user to the system. @Tags Auth @Produce json @Param input body models.LoginReq true "login request"
@Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /auth/login [put]
func (*AuthHandler) Refresh ¶
func (a *AuthHandler) Refresh(c *fiber.Ctx) error
Refresh godoc @Summary Refresh @Description Updates token pair. @Tags Auth @Produce json @Param Authorization header string true "refresh token"
@Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /auth/refresh [get]
func (*AuthHandler) Register ¶
func (a *AuthHandler) Register(c *fiber.Ctx) error
Register godoc @Summary Register @Description Registers new user. @Tags Auth @Produce json @Param input body models.RegisterReq true "register request" @Success 201 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /auth/register [post]
type CarHandler ¶
type CarHandler struct {
// contains filtered or unexported fields
}
func RegisterCarHandler ¶
func RegisterCarHandler(uc service.CarManagement, m metrics.Metrics) *CarHandler
func (*CarHandler) AddCar ¶
func (cr *CarHandler) AddCar(c *fiber.Ctx) error
AddCar godoc @Summary AddCar @Description Adds new car to the pool of available cars. Can be executed only by admin. @Tags CarManagement @Produce json @Param input body models.CarReq true "car request" @Param Authorization header string true "token" @Success 201 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/admin/ [post]
func (*CarHandler) EditCar ¶
func (cr *CarHandler) EditCar(c *fiber.Ctx) error
EditCar godoc @Summary EditCar @Description Edits car from the pool of available cars. Can be executed only by admin. @Tags CarManagement @Produce json @Param carID path string true "car`s ID" @Param input body models.CarReq true "car request" @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/admin/{carID} [put]
func (*CarHandler) RemoveCar ¶
func (cr *CarHandler) RemoveCar(c *fiber.Ctx) error
RemoveCar godoc @Summary RemoveCar @Description Removes car from the pool of available cars. Can be executed only by admin. @Tags CarManagement @Produce json @Param carID path string true "car`s ID" @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/admin/{carID} [delete]
type RentHandler ¶
type RentHandler struct {
// contains filtered or unexported fields
}
func RegisterRentHandler ¶
func RegisterRentHandler(uc service.Rent, m metrics.Metrics) *RentHandler
func (*RentHandler) FinishRent ¶
func (r *RentHandler) FinishRent(c *fiber.Ctx) error
FinishRent godoc @Summary FinishRent @Description Finishes rent. @Tags Rent @Produce json @Param rentID path string true "rent ID" @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/rent/{rentID} [delete]
func (*RentHandler) GetAvailableCars ¶
func (r *RentHandler) GetAvailableCars(c *fiber.Ctx) error
GetAvailableCars godoc @Summary GetAvailableCars @Description Gets all available cars at the moment. @Tags Rent @Produce json @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/rent/available [get]
func (*RentHandler) GetRentHistory ¶
func (r *RentHandler) GetRentHistory(c *fiber.Ctx) error
GetRentHistory godoc @Summary GetRentHistory @Description Gets all user`s rents. @Tags Rent @Produce json @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/rent/history [get]
func (*RentHandler) StartRent ¶
func (r *RentHandler) StartRent(c *fiber.Ctx) error
StartRent godoc @Summary StartRent @Description Starts new rent. @Tags Rent @Produce json @Param carID path string true "car ID" @Param Authorization header string true "token" @Success 201 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/rent/{carID} [post]
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func RegisterUserHandler ¶
func RegisterUserHandler(uc service.User, m metrics.Metrics) *UserHandler
func (*UserHandler) AboutMe ¶
func (u *UserHandler) AboutMe(c *fiber.Ctx) error
AboutMe godoc @Summary AboutMe @Description Gets main information about yourself. @Tags User @Produce json @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/user/me [get]
func (*UserHandler) GetNotifications ¶
func (u *UserHandler) GetNotifications(c *fiber.Ctx) error
GetNotifications godoc @Summary GetNotifications @Description Gets user`s profile. @Tags User @Produce json @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/notifications [get]
func (*UserHandler) GetProfile ¶
func (u *UserHandler) GetProfile(c *fiber.Ctx) error
GetProfile godoc @Summary GetProfile @Description Gets user`s profile. @Tags User @Produce json @Param userID path string true "userID" @Param Authorization header string true "token" @Success 200 {object} int @Failure 400 {object} errors.HTTPError @Failure 404 {object} errors.HTTPError @Failure 405 {object} errors.HTTPError @Failure 500 {object} errors.HTTPError @Router /v1/{userID} [get]