models

package
v0.0.0-...-f330cb9 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint           `json:"id" gorm:"primary_key"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

type Booking

type Booking struct {
	BaseModel
	Customer   string    `json:"customer"`
	StartDate  time.Time `json:"start_date" binding:"required" gorm:"not null"`
	EndDate    time.Time `json:"end_date" binding:"required" gorm:"not null"`
	Notes      string    `json:"notes"`
	RoomID     uint      `json:"room_id" gorm:"not null"`
	ServiceIDs []uint    `json:"service_ids" gorm:"-"`
	Services   []Service `json:"-" gorm:"many2many:booking_services"`
}

func (*Booking) Validate

func (b *Booking) Validate() error

type Room

type Room struct {
	BaseModel
	Name      string    `json:"name" binding:"required" gorm:"not null"`
	MaxGuests uint8     `json:"max_guests" binding:"required" gorm:"not null"`
	Price     float32   `json:"price"`
	Notes     string    `json:"notes"`
	Bookings  []Booking `json:"-"`
}

func (*Room) Validate

func (r *Room) Validate() error

type Service

type Service struct {
	BaseModel
	Name  string  `json:"name" binding:"required" gorm:"not null"`
	Price float32 `json:"price"`
}

func (*Service) Validate

func (s *Service) Validate() error

type User

type User struct {
	BaseModel
	Email    string `json:"email" gorm:"not null;unique;index"`
	Password string `json:"password" gorm:"not null"`
	Level    string `json:"level" gorm:"not null"`
}

func (*User) Validate

func (u *User) Validate() error

Jump to

Keyboard shortcuts

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