customtypes

package
v0.0.0-...-75ad9af Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPasswordValid

func IsPasswordValid(encrPwd, pwd string) bool

Types

type Booking

type Booking struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	RoomID     primitive.ObjectID `bson:"room_id" json:"room_id"`
	UserID     primitive.ObjectID `bson:"user_id" json:"user_id"`
	FromDate   time.Time          `bson:"from_date" json:"from_date"`
	TillDate   time.Time          `bson:"till_date" json:"till_date"`
	NumPersons int                `bson:"num_persons" json:"num_person"`
}

type CreateUserParams

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

func (*CreateUserParams) Validate

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

type Hotel

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

type Room

type Room struct {
	ID      primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Size    string             `bson:"size" json:"size"`
	Seaside bool               `bson:"seaside" json:"seaside"`
	Price   float64            `bson:"price" json:"price"`
	HotelID primitive.ObjectID `bson:"hotel_id" json:"hotel_id"`
}

type UpdateHotelParams

type UpdateHotelParams struct{}

type UpdateRoomParams

type UpdateRoomParams struct{}

type UpdateUserParams

type UpdateUserParams struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

func (UpdateUserParams) ToBSON

func (params UpdateUserParams) ToBSON() bson.M

type User

type User struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	FirstName string             `bson:"first_name" json:"first_name"`
	LastName  string             `bson:"last_name" json:"last_name"`
	Email     string             `bson:"email" json:"email"`
	Password  string             `bson:"password" json:"-"`
	IsAdmin   bool               `bson:"admin" json:"admin"`
}

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