api

package
v0.0.0-...-7427798 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuth

func AdminAuth(c *fiber.Ctx) error

func CreateTokenFromUser

func CreateTokenFromUser(user *types.User) string

func ErrorHandler

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

func InvalidCredentials

func InvalidCredentials(c *fiber.Ctx) error

func JWTAuthentication

func JWTAuthentication(userStore db.UserStore) fiber.Handler

Types

type AuthHandler

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

func NewAuthHnadler

func NewAuthHnadler(userStore db.UserStore) *AuthHandler

func (*AuthHandler) HandleAuthentication

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

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 BookingHandler

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

func NewBookingHandler

func NewBookingHandler(store db.Store) *BookingHandler

func (*BookingHandler) HandelGetBookings

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

func (*BookingHandler) HandleCancelBooking

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

func (*BookingHandler) HandleGetBooking

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

type BookingRoomParams

type BookingRoomParams struct {
	FromDate   time.Time `json:"fromDate"`
	TillDate   time.Time `json:"tillDate"`
	NumPersons int       `json:"numPersons"`
}

type Error

type Error struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func ErrBadRequest

func ErrBadRequest() Error

func ErrInvalidID

func ErrInvalidID() Error

func ErrResourceNotFound

func ErrResourceNotFound(res string) Error

func ErrUnAuthorized

func ErrUnAuthorized() Error

func NewError

func NewError(code int, msg 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) HandelGetHotel

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

func (*HotelHandler) HandelGetHotels

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

func (*HotelHandler) HandelGetRooms

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

type HotelQueryParams

type HotelQueryParams struct {
	db.Pagination
	Rating int
}

type ResourceResp

type ResourceResp struct {
	Data   any `json:"data"`
	Result int `json:"result"`
	Page   int `json:"page"`
}

type RoomHandler

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

func NewRoomHandler

func NewRoomHandler(store db.Store) *RoomHandler

func (*RoomHandler) BookingRoomHandler

func (h *RoomHandler) BookingRoomHandler(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.Store) *UserHandler

func (*UserHandler) HandelGetUser

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

func (*UserHandler) HandleDeleteUser

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

func (*UserHandler) HandleListUsers

func (h *UserHandler) HandleListUsers(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