model

package
v0.0.0-...-a6f3855 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewUsr

func AddNewUsr(input NewUsrInput, coredb *gorm.DB) (string, error)

func CheckDuplicate

func CheckDuplicate(phone string, username string, user User, coredb *gorm.DB) (map[string]bool, error)

func CheckPasswordHash

func CheckPasswordHash(password string, hash string) bool

func DecodeJwt

func DecodeJwt(token string) (*jwt.Token, error)

DecodeJwt decode jwt

func GenerateJwt

func GenerateJwt(userID string, expiredAt int64) string

GenerateJwt create jwt

func HashPassword

func HashPassword(password string) (string, error)

func JwtMiddleware

func JwtMiddleware() func(http.Handler) http.Handler

JwtMiddleware middleware for http server

func TokenFromHTTPRequestgo

func TokenFromHTTPRequestgo(r *http.Request) string

TokenFromHTTPRequestgo - get jwt token from request

func UserIDFromHTTPRequestgo

func UserIDFromHTTPRequestgo(tokenString string) string

UserIDFromHTTPRequestgo - get user id from request

Types

type Address

type Address struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// TODO make sure city and country matches
	City      string
	CountryId string  `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	Country   Country `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
}

type AuthResult

type AuthResult struct {
	Token  string `json:"token"`
	Status bool   `json:"status"`
}

func EmailAuthLogin

func EmailAuthLogin(email string, password string, coredb *gorm.DB) (*AuthResult, error)

type Beverages

type Beverages struct {
	ID           string `gorm:"type:char(36);primary_key"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    *time.Time `sql:"index"`
	Name         string
	Type         string
	ColdBeverage bool
	FreshDrink   bool
	OwnerID      string
	OwnerType    string
}

type Booking

type Booking struct {
	ID                string `gorm:"type:char(36);primary_key"`
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         *time.Time `sql:"index"`
	BookingName       string
	CoverPic          []BookingCoverPic `gorm:"polymorphic:Owner"`
	BookingOffers     []BookingOffer    `gorm:"polymorphic:Owner"`
	ServiceProviderId string            `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ServiceProvider   ServiceProvider   `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
}

type BookingCoverPic

type BookingCoverPic struct {
	// Do more details on bookings
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	BookingId string
	Tags      []BookingTag `gorm:"polymorphic:Owner"`
	OwnerID   string
	OwnerType string
}

type BookingOffer

type BookingOffer struct {
	ID                 string `gorm:"type:char(36);primary_key"`
	CreatedAt          time.Time
	UpdatedAt          time.Time
	DeletedAt          *time.Time `sql:"index"`
	ServiceTitle       string
	ServiceDescription string
	Pricings           []Pricing          `gorm:"polymorphic:Owner"`
	Pics               []BookingOfferPics `gorm:"polymorphic:Owner"`
	OwnerID            string
	OwnerType          string
}

type BookingOfferPics

type BookingOfferPics struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	OwnerID   string
	OwnerType string
	Pic       string
}

type BookingOrder

type BookingOrder struct {
	ID                  string `gorm:"type:char(36);primary_key"`
	CreatedAt           time.Time
	UpdatedAt           time.Time
	DeletedAt           *time.Time        `sql:"index"`
	BookingOrderDraftId string            `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	BookingOrderDraft   BookingOrderDraft `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	// Booking draft orderer
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	// Important manage order status and udpate detail
	OrderStatus string
}

type BookingOrderDraft

type BookingOrderDraft struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// booking draft manager
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`

	BookingId      string       `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	Booking        Booking      `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	BookingOfferId string       `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	BookingOffer   BookingOffer `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	InvitationId   string       `gorm:"UNIQUE_INDEX:compositeindex;index;null"`

	Invitation Invitation `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	Complete   bool
	Removed    bool
}

type BookingTag

type BookingTag struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	TagTitle  string
	OwnerID   string
	OwnerType string
}

type Chatroom

type Chatroom struct {
	ID        string `json:"id"`
	Name      string
	Messages  []Message
	Observers map[string]struct {
		Username string
		Message  chan *Message
	}
}

type Comment

type Comment struct {
	ID            string `gorm:"type:char(36);primary_key"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     *time.Time `sql:"index"`
	Comment       string
	PostId        string `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	Post          Post   `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	ParentComment string
}

Comments section with a recursive setup

type Country

type Country struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	Name      string     `gorm:"unique"`
}

type Currency

type Currency struct {
	ID           string `gorm:"type:char(36);primary_key"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    *time.Time `sql:"index"`
	CurrencyName string
}

type DeviceDataInput

type DeviceDataInput struct {
	AppID      string `json:"appId"`
	DeviceName string `json:"deviceName"`
}

type Devices

type Devices struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// UserID     string     `json:"user_id" gorm:"user_id"` //nolint:gofmt
	AppID      string
	DeviceName string
	OwnerID    string
	OwnerType  string
}

type EventPromotionPic

type EventPromotionPic struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	Pic       string
	OwnerID   string
	OwnerType string
}

type EventTicketPurchaseOrder

type EventTicketPurchaseOrder struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// booking draft manager
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`

	EventID  string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	Event    Events `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	Complete bool
	Removed  bool
}

type Events

type Events struct {
	ID                 string `gorm:"type:char(36);primary_key"`
	CreatedAt          time.Time
	UpdatedAt          time.Time
	DeletedAt          *time.Time `sql:"index"`
	EventType          string
	EventName          string
	EventDescription   string
	EventPrice         int
	FreeEvent          bool
	EventPromotionPics []EventPromotionPic `gorm:"polymorphic:Owner"`
	MaxInvitations     int
	AddressId          string  `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	Address            Address `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	Closed             bool
	EventDate          time.Time
}

type HashTag

type HashTag struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	Tag       string
	OwnerID   string
	OwnerType string
}

type Ingredients

type Ingredients struct {
	ID             string `gorm:"type:char(36);primary_key"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
	DeletedAt      *time.Time `sql:"index"`
	IngredientName string
	OwnerID        string
	OwnerType      string
}

type InstantMessage

type InstantMessage struct {
	ID      string `json:"id"`
	Name    string
	Message Message
}

type InstatntMessage

type InstatntMessage struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Message *Message `json:"message"`
}

type Invitation

type Invitation struct {
	ID               string `gorm:"type:char(36);primary_key"`
	CreatedAt        time.Time
	UpdatedAt        time.Time
	DeletedAt        *time.Time `sql:"index"`
	CircleInvitation bool
	// add single circle for invitation
	CircleId string     `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	Circle   UserCircle `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	UserId   string     `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User     User       `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
}

type ItemCategory

type ItemCategory struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	CatTitle  string
}

type Like

type Like struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	UserId    string     `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	User      User       `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	OwnerID   string
	OwnerType string
}
type Menu struct {
	ID         string `gorm:"type:char(36);primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  *time.Time `sql:"index"`
	Name       string
	MenuTypeId string      `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	MenuType   MenuType    `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	MenuItem   []MenuItem  `gorm:"polymorphic:Owner"`
	Beverages  []Beverages `gorm:"polymorphic:Owner"`
	// Sp added to menu directly
	ServiceProviderId string          `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ServiceProvider   ServiceProvider `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
}
type MenuItem struct {
	ID             string `gorm:"type:char(36);primary_key"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
	DeletedAt      *time.Time `sql:"index"`
	ItemTitle      string
	Price          int
	Image          string
	ItemCategoryId string `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ItemCategory   Post   `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	InstantlyMade  bool
	Description    string
	Ingredients    []Ingredients `gorm:"polymorphic:Owner"`
	ItemType       string
	OwnerID        string
	OwnerType      string
}
type MenuOrder struct {
	ID               string `gorm:"type:char(36);primary_key"`
	CreatedAt        time.Time
	UpdatedAt        time.Time
	DeletedAt        *time.Time     `sql:"index"`
	MenuOrderDraftId string         `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	MenuOrderDraft   MenuOrderDraft `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	// Booking draft orderer
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	// Important manage order status and udpate detail
	OrderStatus string
}
type MenuOrderDraft struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// booking draft manager
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`

	MenuId       string   `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	Menu         Menu     `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	MenuItemId   string   `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	MenuItem     MenuItem `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	InvitationId string   `gorm:"UNIQUE_INDEX:compositeindex;index;null"`

	Invitation Invitation `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	Complete   bool
	Removed    bool
}
type MenuType struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	TypeName  string
}

type Message

type Message struct {
	ID        string    `json:"id"`
	Text      string    `json:"text"`
	CreatedBy string    `json:"createdBy"`
	CreatedAt time.Time `json:"createdAt"`
}

type NewUsrInput

type NewUsrInput struct {
	Email       string           `json:"email"`
	Password    string           `json:"password"`
	DeviceInput *DeviceDataInput `json:"deviceInput"`
}

type NotificationChannel

type NotificationChannel struct {
	ID        string `json:"id"`
	Name      string
	Observers map[string]struct {
		Username string
		Message  chan *string
	}
}

type Notifications

type Notifications struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	Text string `json:"text"`
}

type Place

type Place struct {
	ID                string `gorm:"type:char(36);primary_key"`
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         *time.Time `sql:"index"`
	PlaceTypeId       string     `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	PlaceType         PlaceType  `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	AdminOrigin       bool
	ServiceProviderId string          `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ServiceProvider   ServiceProvider `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	PlacePics         []PlacePic      `gorm:"polymorphic:Owner"`
}

type PlacePic

type PlacePic struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	Pic       string
	OwnerID   string
	OwnerType string
}

type PlaceType

type PlaceType struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	TypeName  string
	Image     string
}

type Post

type Post struct {
	// TODO Add place Foreign key model here
	ID                string `gorm:"type:char(36);primary_key"`
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         *time.Time `sql:"index"`
	Caption           string
	UserId            string       `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	User              User         `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	PostImages        []PostImages `gorm:"polymorphic:Owner"`
	PostLikes         []Like       `gorm:"polymorphic:Owner"`
	Approved          bool
	IsDrafted         bool
	HashTags          []HashTag `gorm:"polymorphic:Owner"`
	Promotional       bool
	ServiceProviderId string          `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	ServiceProvider   ServiceProvider `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
}

main posts model

type PostImages

type PostImages struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	PostImage string
	OwnerID   string
	OwnerType string
}

Posts images multiple relation with post

type Pricing

type Pricing struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	OwnerID   string
	OwnerType string
	// Label is for the timestamp detail of the pricing
	Label          string
	Price          string
	ComparingPrice string
	Timed          bool
	TimedLabelId   string     `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	TimedLabel     TimedLabel `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
}

type ProductPurchaseOrder

type ProductPurchaseOrder struct {
	ID                          string `gorm:"type:char(36);primary_key"`
	CreatedAt                   time.Time
	UpdatedAt                   time.Time
	DeletedAt                   *time.Time                `sql:"index"`
	ProductPurchaseOrderDraftId string                    `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	ProductPurchaseOrderDraft   ProductPurchaseOrderDraft `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	// Booking draft orderer
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	// Important manage order status and udpate detail
	OrderStatus string
}

type ProductPurchaseOrderDraft

type ProductPurchaseOrderDraft struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// booking draft manager
	UserId string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User   User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`

	ProductSalesId string       `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	ProductSales   ProductSales `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	Complete       bool
	Removed        bool
}

type ProductSales

type ProductSales struct {
	ID                 string `gorm:"type:char(36);primary_key"`
	CreatedAt          time.Time
	UpdatedAt          time.Time
	DeletedAt          *time.Time              `sql:"index"`
	ProductSalesTypeId string                  `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ProductSalesType   ProductSalesType        `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	Images             []ProductSalesTypeImage `gorm:"polymorphic:Owner"`
	SellingPrice       int
	ListingPrice       int
	CurrencyId         string   `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	Currency           Currency `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	IsAvailable        bool
	Quantity           int
	ServiceProviderId  string          `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ServiceProvider    ServiceProvider `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
}

type ProductSalesType

type ProductSalesType struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	TypeName  string
	Approved  bool
}

type ProductSalesTypeImage

type ProductSalesTypeImage struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	Image     string
	OwnerID   string
	OwnerType string
}

type Profile

type Profile struct {
	ID         string `gorm:"type:char(36);primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  *time.Time `sql:"index"`
	Name       string     `gorm:"column:name;size:128;not null;"`
	Username   string     `gorm:"uniqueIndex,unique"`
	Phone      string     `gorm:"uniqueIndex,unique"`
	ProfilePic string
	Complete   bool
	Progress   int
	Bio        string
}

Profile is the model for the profile table.

type ProfileStarterInput

type ProfileStarterInput struct {
	Username string `json:"username"`
	Name     string `json:"name"`
	Phone    string `json:"phone"`
}

type ProfileUpdateResult

type ProfileUpdateResult struct {
	Message string `json:"message"`
	Stat    bool   `json:"stat"`
}

func ProfileMessages

func ProfileMessages(messageType string, message string) ProfileUpdateResult

func UpdateUserProfile

func UpdateUserProfile(coredb *gorm.DB, user User, input ProfileStarterInput) (ProfileUpdateResult, error)

type PromotionalPosts

type PromotionalPosts struct {
	ID                string `gorm:"type:char(36);primary_key"`
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         *time.Time      `sql:"index"`
	PostId            string          `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	Post              Post            `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	ServiceProviderId string          `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	ServiceProvider   ServiceProvider `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	Featured          bool
}

type ServiceProvider

type ServiceProvider struct {
	ID                  string `gorm:"type:char(36);primary_key"`
	CreatedAt           time.Time
	UpdatedAt           time.Time
	DeletedAt           *time.Time `sql:"index"`
	Phone               string
	SpID                string `gorm:"unique"`
	SpType              string
	Email               string `gorm:"unique"`
	BusinessName        string
	AddressId           string  `gorm:"UNIQUE_INDEX:compositeindex;index;not null"`
	Address             Address `gorm:"UNIQUE_INDEX:compositeindex;type:text;not null"`
	BusinessPhone       string  `gorm:"unique"`
	BusinessDescription string
	IsVerified          bool
	AccountAppoved      bool
}

type TimedLabel

type TimedLabel struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	TypeTitle string
}

type User

type User struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	SomeFlag  bool       `gorm:"column:some_flag;not null;default:true"`
	// main content goes here
	Email      string `gorm:"uniqueIndex,unique"`
	Password   string
	ProfileId  string
	Profile    Profile
	IsVerified bool
	Qrcode     string
	// UserDevices []Devices `gorm:"many2many:devices;" json:"devices,omitempty"`
	UserDevices []Devices `gorm:"polymorphic:Owner"`
	OwnerID     string
	OwnerType   string
}

func AllUsrs

func AllUsrs(coredb *gorm.DB) ([]*User, error)

func Authenticate

func Authenticate(password string, email string, db *gorm.DB) (*User, bool)

func GetAuthStat

func GetAuthStat(coredb *gorm.DB, ctx context.Context, errorMessage string) (bool, User, error)

type UserAuth

type UserAuth struct {
	UserID    string
	Roles     []string
	IPAddress string
	Token     string
}

UserAuth - user auth middleware structure

func GetAuthFromContext

func GetAuthFromContext(ctx context.Context) *UserAuth

GetAuthFromContext - Gets context

type UserCircle

type UserCircle struct {
	ID         string `gorm:"type:char(36);primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  *time.Time `sql:"index"`
	CircleName string
	Users      []User `gorm:"polymorphic:Owner"`
	UserId     string `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	User       User   `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	Removed    bool
	OwnerID    string
	OwnerType  string
}

type UserClaims

type UserClaims struct {
	UserID string `json:"id"`
	jwt.StandardClaims
}

UserClaims for jwt

type UserTravel

type UserTravel struct {
	ID        string `gorm:"type:char(36);primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	// TODO complete User travel setup
	OrderTravel            bool
	BookingOrderId         string               `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	BookingOrder           BookingOrder         `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	MenuOrderId            string               `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	MenuOrder              MenuOrder            `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	ProductPurchaseOrderId string               `gorm:"UNIQUE_INDEX:compositeindex;index;null"`
	ProductPurchaseOrder   ProductPurchaseOrder `gorm:"UNIQUE_INDEX:compositeindex;type:text;null"`
	TravelStatus           string
}

Jump to

Keyboard shortcuts

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