api

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

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuthentication

func AdminAuthentication(c *fiber.Ctx) error

func ErrorHandler

func ErrorHandler(ctx *fiber.Ctx, err error) error

func JWTAuthentication

func JWTAuthentication(userStore db.UserStore) fiber.Handler

Types

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(userStore db.UserStore) *AuthHandler

func (*AuthHandler) HandleAuth

func (h *AuthHandler) HandleAuth(c *fiber.Ctx) error

A handler should only do: - serialization of incoming request - fetch data - call some business logic (or 3rd party lib)k - return data

type AuthParams

type AuthParams struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type AuthResponse

type AuthResponse struct {
	User  *types.User `json:"user"`
	Token string      `json:"token"`
}

type BookRoomParams

type BookRoomParams struct {
	FromDate  time.Time `json:"fromDate"`
	ToDate    time.Time `json:"toDate"`
	NumGuests int       `json:"numGuests"`
}

type BookingHandler

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

func NewBookingHandler

func NewBookingHandler(store *db.Store) *BookingHandler

func (*BookingHandler) HandleCancelBooking

func (h *BookingHandler) HandleCancelBooking(c *fiber.Ctx) error

func (*BookingHandler) HandleGetBooking

func (h *BookingHandler) HandleGetBooking(c *fiber.Ctx) error

func (*BookingHandler) HandleGetBookings

func (h *BookingHandler) HandleGetBookings(c *fiber.Ctx) error

type Error

type Error struct {
	Code int    `json:"code"`
	Err  string `json:"error"`
}

func ErrBadRequest

func ErrBadRequest() Error

func ErrInvalidID

func ErrInvalidID() Error

func ErrNotFound

func ErrNotFound(res string) Error

func ErrUnAuthorized

func ErrUnAuthorized() Error

func NewError

func NewError(code int, err string) Error

func (Error) Error

func (e Error) Error() string

type HotelHandler

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

func NewHotelHandler

func NewHotelHandler(store *db.Store) *HotelHandler

func (*HotelHandler) HandleGetHotel

func (h *HotelHandler) HandleGetHotel(c *fiber.Ctx) error

func (*HotelHandler) HandleGetHotels

func (h *HotelHandler) HandleGetHotels(c *fiber.Ctx) error

func (*HotelHandler) HandleGetRooms

func (h *HotelHandler) HandleGetRooms(c *fiber.Ctx) error

type HotelQueryParams

type HotelQueryParams struct {
	db.Pagination
	Rating int
}

type ResourceResp

type ResourceResp struct {
	Total int
	Page  int
	Data  any
}

type RoomHandler

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

func NewRoomHandler

func NewRoomHandler(store *db.Store) *RoomHandler

func (*RoomHandler) HandleBookRoom

func (h *RoomHandler) HandleBookRoom(c *fiber.Ctx) error

func (*RoomHandler) HandleGetRooms

func (h *RoomHandler) HandleGetRooms(c *fiber.Ctx) error

type UserHandler

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

func NewUserHandler

func NewUserHandler(userStore db.UserStore) *UserHandler

func (*UserHandler) HandleDeleteUser

func (h *UserHandler) HandleDeleteUser(c *fiber.Ctx) error

func (*UserHandler) HandleGetUser

func (h *UserHandler) HandleGetUser(c *fiber.Ctx) error

func (*UserHandler) HandleGetUsers

func (h *UserHandler) HandleGetUsers(c *fiber.Ctx) error

func (*UserHandler) HandlePostUser

func (h *UserHandler) HandlePostUser(c *fiber.Ctx) error

func (*UserHandler) HandlePutUser

func (h *UserHandler) HandlePutUser(c *fiber.Ctx) error

Jump to

Keyboard shortcuts

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