model

package
v0.0.0-...-c256c1c Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 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 AuthResponse

type AuthResponse struct {
	AuthToken *AuthToken `json:"authToken"`
	User      *User      `json:"user"`
}

type AuthToken

type AuthToken struct {
	AccessToken string    `json:"accessToken"`
	ExpiredAt   time.Time `json:"expiredAt"`
}

type LoginInput

type LoginInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (LoginInput) Validate

func (l LoginInput) Validate() (bool, map[string]string)

type Meetup

type Meetup struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	UserID      string `json:"userId"`
}

Meetup struct defines meetup fields

type MeetupFilter

type MeetupFilter struct {
	Name *string `json:"name"`
}

type NewMeetup

type NewMeetup struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type RegisterInput

type RegisterInput struct {
	Username        string `json:"username"`
	Email           string `json:"email"`
	Password        string `json:"password"`
	ConfirmPassword string `json:"confirmPassword"`
	FirstName       string `json:"firstName"`
	LastName        string `json:"lastName"`
}

func (RegisterInput) Validate

func (r RegisterInput) Validate() (bool, map[string]string)

type UpdateMeetup

type UpdateMeetup struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
}

type User

type User struct {
	ID        string    `json:"id"`
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Password  string    `json:"password"`
	FirstName string    `json:"firstName"`
	LastName  string    `json:"lastName"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

User struct binds user fields

func (*User) ComparePassword

func (u *User) ComparePassword(password string) error

func (*User) GenerateToken

func (u *User) GenerateToken() (*AuthToken, error)

GenerateToken generates a jwt token

func (*User) HashPassword

func (u *User) HashPassword(password string) error

HashPassword hash's password

Jump to

Keyboard shortcuts

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