domain

package
v0.0.0-...-946fd12 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomToken

func RandomToken() string

Types

type Email

type Email struct {
	Email string
}

type Pagination

type Pagination struct {
	Page int
	Size int
}

type SavedSearchesFilters

type SavedSearchesFilters struct {
	PriceFrom     float32 `json:"priceFrom,omitempty"`
	PriceTo       float32 `json:"priceTo,omitempty"`
	HomeSizeFrom  float32 `json:"homeSizeFrom,omitempty"`
	HomeSizeTo    float32 `json:"homeSizeTo,omitempty"`
	LotSizeFrom   float32 `json:"lotSizeFrom,omitempty"`
	LotSizeTo     float32 `json:"lotSizeTo,omitempty"`
	YearBuildFrom uint16  `json:"yearBuildFrom,omitempty"`
	YearBuildTo   uint16  `json:"yearBuildTo,omitempty"`

	Bathroom      uint8 `json:"bathroom,omitempty"`
	BathroomExact bool  `json:"bathroomExact,omitempty"`

	Bedroom      uint8 `json:"bedroom,omitempty"`
	BedroomExact bool  `json:"bedroomExact,omitempty"`

	Condition    []int `json:"condition,omitempty" bun:"polygon,type:jsonb,json_use_number"`
	HomeType     []int `json:"homeType,omitempty" bun:"polygon,type:jsonb,json_use_number"`
	PropertyType uint8 `json:"propertyType,omitempty"`

	HasAC          *bool  `json:"hasAC,omitempty"`
	MustHaveGarage bool   `json:"mustHaveGarage,omitempty"`
	ParkingNumber  *uint8 `json:"parkingNumber,omitempty"`
}

type SearchPolygon

type SearchPolygon struct {
	TopLat     string `json:"topLat,omitempty"`
	TopLong    string `json:"topLong,omitempty"`
	BottomLat  string `json:"bottomLat,omitempty"`
	BottomLong string `json:"bottomLong,omitempty"`
}

type TokenActionType

type TokenActionType string
const (
	EmailVerification TokenActionType = "email_verification"
	PasswordReset     TokenActionType = "password_reset"
)

type User

type User struct {
	bun.BaseModel     `bun:"users"`
	ID                int       `bun:"id,pk,autoincrement"`
	AccountId         int       `bun:"account_id"`
	Name              string    `bun:"name"`
	Surname           string    `bun:"surname"`
	ScreenName        string    `bun:"screen_name"`
	CompanyName       string    `bun:"company_name"`
	PhotoUrl          string    `bun:"photo_url"`
	Phone             string    `bun:"phone"`
	AdditionalPhones  []string  `bun:"additional_phones,array"`
	Country           string    `bun:"country"`
	City              string    `bun:"city"`
	Zip               string    `bun:"zip"`
	Latitude          string    `bun:"latitude"`
	Longitude         string    `bun:"longitude"`
	Email             string    `bun:"email,unique"`
	Password          []byte    `bun:"password"`
	IsVerifiedEmail   bool      `bun:"is_verified_email"`
	IsCreatedPassword bool      `bun:"is_created_password"`
	IsVerifiedPhone   bool      `bun:"is_verified_phone"`
	IsGoogleLinked    bool      `bun:"is_google_linked"`
	IsFacebookLinked  bool      `bun:"is_facebook_linked"`
	IsAppleLinked     bool      `bun:"is_apple_linked"`
	Locked            bool      `bun:"locked"`
	Active            bool      `bun:"active"`
	CreatedAt         time.Time `bun:"created_at,default:current_timestamp"`
	UpdatedAt         time.Time `bun:"updated_at,default:current_timestamp"`
}

func (*User) CheckPasswordHash

func (u *User) CheckPasswordHash(password string) bool

CheckPasswordHash compares the given password with the hashed password

func (*User) GenerateHashPassword

func (u *User) GenerateHashPassword() error

GenerateHashPassword hashes the given password using bcrypt

type UserSearchFilters

type UserSearchFilters struct {
	ID             int       `bun:"type:id,pk,autoincrement"`
	UserID         int       `bun:"user_id"`
	Name           string    `bun:"name"`
	Sort           uint8     `bun:"sort"`
	Subscribed     *bool     `bun:"subscribed"`
	EmailFrequency uint8     `bun:"email_frequency"`
	CreatedAt      time.Time `bun:",nullzero,default:now()"`
	UpdatedAt      time.Time `bun:",default:current_timestamp"`

	Filters *SavedSearchesFilters `bun:"filters,type:jsonb"`
	Polygon *SearchPolygon        `bun:"polygon,type:jsonb"`
}

type UserTokenAction

type UserTokenAction struct {
	bun.BaseModel `bun:"user_token_actions"`
	ID            int             `bun:"id,pk,autoincrement"`
	Token         string          `bun:"token"`
	UserID        *int            `bun:"user_id,nullzero"`
	Action        TokenActionType `bun:"action"`
	Payload       json.RawMessage `bun:"payload,nullzero"`
	TokenExpiry   time.Time       `bun:"token_expiry"`
	CreatedAt     time.Time       `bun:"created_at,default:current_timestamp"`
	UpdatedAt     time.Time       `bun:"updated_at,default:current_timestamp"`
}

func (UserTokenAction) IsExpired

func (t UserTokenAction) IsExpired() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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