models

package
v0.0.0-...-d50938c Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DB is a connection to your database to be used throughout your application.

Functions

func AfterSaveFile

func AfterSaveFile(f field) error

AfterSave is a callback that saves the file after the venue is saved to the database

func BeforeSaveFile

func BeforeSaveFile(f field) error

BeforeSave is a callback that preprocess the struct before saving it to the database

func GetPhotoName

func GetPhotoName(id string, filename string) string

GetPhotoName returns the path of the photo

Types

type Band

type Band struct {
	ID           uuid.UUID    `json:"id" db:"id"`
	CreatedAt    time.Time    `json:"created_at" db:"created_at"`
	UpdatedAt    time.Time    `json:"updated_at" db:"updated_at"`
	Name         string       `json:"title" db:"name"`
	Description  string       `json:"content" db:"description"`
	Photo        string       `json:"photo" db:"photo"`
	LocationText nulls.String `json:"location_text" db:"location_text"`
	Country      nulls.Int    `json:"country" db:"country"`
	State        nulls.Int    `json:"state" db:"state"`
	City         nulls.Int    `json:"city" db:"city"`
	PhotoFile    binding.File `json:"photo_file" db:"-" form:"photo_file"`
	OwnerID      uuid.UUID    `json:"owner_id" db:"owner_id"`
}

func (*Band) AfterSave

func (b *Band) AfterSave(tx *pop.Connection) error

AfterSave is a callback that saves the file after the venue is saved to the database

func (*Band) BeforeSave

func (b *Band) BeforeSave(tx *pop.Connection) error

BeforeSave is a callback that preprocess the struct before saving it to the database

func (*Band) GetID

func (b *Band) GetID() string

GetID returns a string representation of the ID

func (*Band) GetPhotoFileName

func (b *Band) GetPhotoFileName() string

GetPhotoFilename returns the filename of the uploaded photo

func (*Band) GetPhotoStream

func (b *Band) GetPhotoStream() binding.File

GetPhotoStream returns the file representation of the form uploaded file

func (*Band) SetPhotoName

func (b *Band) SetPhotoName() error

SetPhotoName sets the photo filename parameter in the Photo field of te database

func (*Band) ValidPhoto

func (b *Band) ValidPhoto() bool

ValidPhoto returns true if there's an uploaded photo from the form

func (*Band) Validate

func (p *Band) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type BandVenueEventRequest

type BandVenueEventRequest struct {
	ID          uuid.UUID `json:"id" db:"id"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" db:"updated_at"`
	BandID      uuid.UUID `json:"band_id" db:"band_id"`
	VenueID     uuid.UUID `json:"venue_id" db:"venue_id"`
	RequestDate time.Time `json:"request_date" db:"request_date"`
	OwnerID     uuid.UUID `json:"owner_id" db:"owner_id"`
	Status      int       `json:"status" db:"status"`
	BandName    string    `json:"name" db:"name"`
}

func (*BandVenueEventRequest) GetID

func (b *BandVenueEventRequest) GetID() string

GetID returns a string representation of the ID

func (*BandVenueEventRequest) GetRequests

type BandVenueEventRequests

type BandVenueEventRequests []BandVenueEventRequest

type Bands

type Bands []Band

type Booker

type Booker struct {
	ID           uuid.UUID    `json:"id" db:"id"`
	CreatedAt    time.Time    `json:"created_at" db:"created_at"`
	UpdatedAt    time.Time    `json:"updated_at" db:"updated_at"`
	Name         string       `json:"title" db:"name"`
	Description  string       `json:"content" db:"description"`
	Photo        string       `json:"photo" db:"photo"`
	LocationText nulls.String `json:"location_text" db:"location_text"`
	Country      nulls.Int    `json:"country" db:"country"`
	State        nulls.Int    `json:"state" db:"state"`
	City         nulls.Int    `json:"city" db:"city"`
	PhotoFile    binding.File `json:"photo_file" db:"-" form:"photo_file"`
	OwnerID      uuid.UUID    `json:"owner_id" db:"owner_id"`
}

func (*Booker) AfterSave

func (b *Booker) AfterSave(tx *pop.Connection) error

AfterSave is a callback that saves the file after the venue is saved to the database

func (*Booker) BeforeSave

func (b *Booker) BeforeSave(tx *pop.Connection) error

BeforeSave is a callback that preprocess the struct before saving it to the database

func (*Booker) GetID

func (b *Booker) GetID() string

GetID returns a string representation of the ID

func (*Booker) GetPhotoFileName

func (b *Booker) GetPhotoFileName() string

GetPhotoFilename returns the filename of the uploaded photo

func (*Booker) GetPhotoStream

func (b *Booker) GetPhotoStream() binding.File

GetPhotoStream returns the binding.File field

func (*Booker) SetPhotoName

func (b *Booker) SetPhotoName() error

SetPhotoName sets the photo filename parameter in the Photo field of te database

func (*Booker) ValidPhoto

func (b *Booker) ValidPhoto() bool

ValidPhoto returns true if there's an uploaded photo from the form

func (*Booker) Validate

func (b *Booker) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type Bookers

type Bookers []Booker

type EmailNotTaken

type EmailNotTaken struct {
	Name  string
	Field string
	// contains filtered or unexported fields
}

Check for emails

func (*EmailNotTaken) IsValid

func (v *EmailNotTaken) IsValid(errors *validate.Errors)

Check if email is already taken TODO create a more generic interface for this validator

type User

type User struct {
	ID              uuid.UUID    `json:"id" db:"id"`
	CreatedAt       time.Time    `json:"created_at" db:"created_at"`
	UpdatedAt       time.Time    `json:"updated_at" db:"updated_at"`
	Firstname       nulls.String `json:"firstname" db:"firstname"`
	Username        string       `json:"username" db:"username" form:"username"`
	Middlename      nulls.String `json:"middlename" db:"middlename"`
	Lastname        nulls.String `json:"lastname" db:"lastname"`
	Mlastname       nulls.String `json:"mlastname" db:"mlastname"`
	Email           string       `json:"email" db:"email"`
	Phone           nulls.String `json:"phone" db:"phone"`
	Password        string       `json:"-" db:"-"`
	PasswordHash    string       `json:"-" db:"password_hash"`
	PasswordConfirm string       `json:"-" db:"-"`
	Admin           bool         `json:"admin" db:"admin"`
}

func (*User) Authorize

func (u *User) Authorize(tx *pop.Connection) error

Check user password and ACLs

func (*User) AuthorizeDelete

func (u *User) AuthorizeDelete(ownerID uuid.UUID, c buffalo.Context) (bool, string, string)

AuthorizeDelete checks if the user has deletion privileges on the item

func (*User) Create

func (u *User) Create(tx *pop.Connection) (*validate.Errors, error)

Create and validates user

func (User) String

func (u User) String() string

String is not required by pop and may be deleted

func (*User) Validate

func (u *User) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*User) ValidateCreate

func (u *User) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*User) ValidateUpdate

func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type UsernameNotTaken

type UsernameNotTaken struct {
	Name  string
	Field string
	// contains filtered or unexported fields
}

func (*UsernameNotTaken) IsValid

func (v *UsernameNotTaken) IsValid(errors *validate.Errors)

Check if username is already taken

type Users

type Users []User

Users is not required by pop and may be deleted

func (Users) String

func (u Users) String() string

String is not required by pop and may be deleted

type Venue

type Venue struct {
	ID           uuid.UUID    `json:"id" db:"id"`
	CreatedAt    time.Time    `json:"created_at" db:"created_at"`
	UpdatedAt    time.Time    `json:"updated_at" db:"updated_at"`
	Name         string       `json:"name" db:"name"`
	Description  string       `json:"description" db:"description"`
	Photo        string       `json:"photo" db:"photo"`
	LocationText nulls.String `json:"location_text" db:"location_text"`
	Country      nulls.Int    `json:"country" db:"country"`
	Address      nulls.String `json:"address" db:"address"`
	Zip          nulls.String `json:"zip" db:"zip"`
	Phone        nulls.String `json:"phone" db:"phone"`
	State        nulls.Int    `json:"state" db:"state"`
	City         nulls.Int    `json:"city" db:"city"`
	PhotoFile    binding.File `json:"photo_file" db:"-" form:"photo_file"`
	OwnerID      uuid.UUID    `json:"owner_id" db:"owner_id"`
}

func (*Venue) AfterSave

func (v *Venue) AfterSave(tx *pop.Connection) error

AfterSave is a callback that saves the file after the venue is saved to the database

func (*Venue) BeforeSave

func (v *Venue) BeforeSave(tx *pop.Connection) error

BeforeSave is a callback that sets fields to be added to the database

func (*Venue) GetID

func (v *Venue) GetID() string

GetID returns a string representation of the ID

func (*Venue) GetPhotoFileName

func (v *Venue) GetPhotoFileName() string

GetPhotoFilename returns the filename of the uploaded photo

func (*Venue) GetPhotoStream

func (v *Venue) GetPhotoStream() binding.File

func (*Venue) SetPhotoName

func (v *Venue) SetPhotoName() error

SetPhotoName sets the photo filename parameter in the Photo field of te database

func (*Venue) ValidPhoto

func (v *Venue) ValidPhoto() bool

ValidPhoto returns true if there's an uploaded photo from the form

func (*Venue) Validate

func (p *Venue) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type Venues

type Venues []Venue

Jump to

Keyboard shortcuts

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