types

package
v0.0.0-...-7e7321d Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookRoomParams

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

func (BookRoomParams) Validate

func (p BookRoomParams) Validate() map[string]string

type Booking

type Booking struct {
	ID        string    `bson:"_id,omitempty" json:"id,omitempty"`
	UserID    string    `bson:"userID" json:"userID"`
	RoomID    string    `bson:"roomID" json:"roomID"`
	NumPeople int       `bson:"numPeople" json:"numPeople"`
	FromDate  time.Time `bson:"fromDate" json:"fromDate"`
	ToDate    time.Time `bson:"toDate" json:"toDate"`
	Canceled  bool      `bson:"canceled" json:"canceled"`
}

type CreateRoomParams

type CreateRoomParams struct {
	Type  string  `json:"type"`
	Price float64 `json:"price"`
}

func (CreateRoomParams) ToBSON

func (p CreateRoomParams) ToBSON() bson.M

type CreateUserParams

type CreateUserParams struct {
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
	Password  string `json:"password"`
}

func (CreateUserParams) Validate

func (p CreateUserParams) Validate() map[string]string

type Hotel

type Hotel struct {
	ID       string   `bson:"_id,omitempty" json:"id,omitempty"`
	Name     string   `bson:"name" json:"name"`
	Location string   `bson:"location" json:"location"`
	Rooms    []string `bson:"rooms" json:"rooms"`
	Rating   int      `bson:"rating" json:"rating"`
}

func (*Hotel) MakeHotelWithRooms

func (h *Hotel) MakeHotelWithRooms(rooms []*Room) *HotelWithRooms

type HotelQueryParams

type HotelQueryParams struct {
	Rooms  bool
	Rating int
	Page   int64
	Limit  int64
}

type HotelWithRooms

type HotelWithRooms struct {
	ID       string  `json:"id"`
	Name     string  `json:"name"`
	Location string  `json:"location"`
	Rooms    []*Room `json:"rooms"`
	Rating   int     `json:"rating"`
}

type Room

type Room struct {
	ID      string  `bson:"_id,omitempty" json:"id,omitempty"`
	Type    string  `bson:"type" json:"type"`
	Price   float64 `bson:"price" json:"price"`
	HotelID string  `bson:"hotelID" json:"hotelID"`
}

func NewRoomFromParams

func NewRoomFromParams(params *CreateRoomParams, id string) *Room

type UpdateHotelParams

type UpdateHotelParams struct {
	Name     string   `json:"name"`
	Location string   `json:"location"`
	Rooms    []string `json:"rooms"`
}

func (UpdateHotelParams) ToBSON

func (p UpdateHotelParams) ToBSON() bson.M

type UpdateUserParams

type UpdateUserParams struct {
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

func (UpdateUserParams) ToBSON

func (p UpdateUserParams) ToBSON() bson.M

func (UpdateUserParams) Validate

func (p UpdateUserParams) Validate() map[string]string

type User

type User struct {
	ID                string `bson:"_id,omitempty" json:"id,omitempty"`
	FirstName         string `bson:"firstName" json:"firstName"`
	LastName          string `bson:"lastName" json:"lastName"`
	Email             string `bson:"email" json:"email"`
	EncryptedPassword string `bson:"encryptedPassword" json:"-"`
	Admin             bool   `bson:"admin" json:"-"`
}

func NewUserFromParams

func NewUserFromParams(params *CreateUserParams) (*User, error)

Jump to

Keyboard shortcuts

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