models

package
v0.0.0-...-474b416 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: 0BSD Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPagination = Pagination{
	CurrentPage: 1,
	PerPage:     10,
}

Functions

This section is empty.

Types

type Answer

type Answer struct {
	gorm.Model
	UserID       string `gorm:"primaryKey;column:user_id"`
	QuestionID   int    `gorm:"primaryKey;column:question_id"`
	UserAnswer   int    `gorm:"column:user_answer"`
	PreferAnswer int    `gorm:"column:prefer_answer"`
	Importance   int    `gorm:"column:importance"`
}

Answer model

func (*Answer) Serialize

func (p *Answer) Serialize() *SerializableAnswer

func (*Answer) TableName

func (p *Answer) TableName() string

TableName gives table name of model

type AnswerRequest

type AnswerRequest struct {
	Answers []struct {
		QuestionID   int `json:"question_id"`
		UserAnswer   int `json:"user_answer"`
		PreferAnswer int `json:"prefer_answer"`
		Importance   int `json:"importance"`
	} `json:"answers"`
}

type ArrStringFilterType

type ArrStringFilterType string

func NewArrStringFilterType

func NewArrStringFilterType(args ...string) *ArrStringFilterType

func (*ArrStringFilterType) Values

func (t *ArrStringFilterType) Values() []string

type Currency

type Currency string
const (
	CurrencyAUD Currency = "AUD"
)

func (Currency) Validate

func (c Currency) Validate() bool

type GetRecommendationRequest

type GetRecommendationRequest struct {
	MinAge      int     `json:"min_age"`
	MaxAge      int     `json:"max_age"`
	MinDistance float64 `json:"min_distance"`
	MaxDistance float64 `json:"max_distance"`
}

type HTTPResponse

type HTTPResponse struct {
	Message       string          `json:"message,omitempty"`
	Data          interface{}     `json:"data,omitempty"`
	InvalidFields []string        `json:"invalid_fields,omitempty"`
	Pagination    *PaginationResp `json:"pagination,omitempty"`
}

HTTPResponse represents a boilerplate of HTTP response payload

type ImageUploadResult

type ImageUploadResult struct {
	SlotId  int
	FileId  string
	FileUrl string
}

type JWTClaim

type JWTClaim struct {
	UserID    string `json:"user_id"`
	UserEmail string `json:"user_email"`
	jwt.StandardClaims
}

JWTClaim represents the authorized object encrypted in the JWT token

type Match

type Match struct {
	MatcherId   string `gorm:"primaryKey;column:matcher_id"`
	MatcheeId   string `gorm:"primaryKey;column:matchee_id"`
	MatchStatus int    `gorm:"column:match_status"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`
}

func (*Match) TableName

func (m *Match) TableName() string

type MatchCalculationResult

type MatchCalculationResult struct {
	MatchPercentage float64
	MatchedProfile  Profile
}

type MatchProfile

type MatchProfile struct {
	ID              string    `json:"id"`
	Name            string    `json:"name"`
	Gender          string    `json:"gender"`
	Birthday        time.Time `json:"birthday"`
	Height          string    `json:"height"`
	Horoscope       string    `json:"horoscope"`
	Hobby           []string  `json:"hobby"`
	Language        []string  `json:"language"`
	Education       string    `json:"education"`
	Location        string    `json:"location"`
	HomeTown        string    `json:"home_town"`
	Distance        float64   `json:"distance"`
	MatchPercentage float64   `json:"match_percentage"`
	Image1          string    `json:"image_1"`
	Image2          string    `json:"image_2"`
	Image3          string    `json:"image_3"`
	Image4          string    `json:"image_4"`
	Image5          string    `json:"image_5"`
}

type OneUserFilter

type OneUserFilter struct {
	ID     string               `form:"id"`
	Email  string               `form:"email"`
	Joins  *ArrStringFilterType `form:"joins"`
	Fields *ArrStringFilterType `form:"fields"`
}

type Pagination

type Pagination struct {
	CurrentPage int `json:"current_page" form:"current_page"`
	PerPage     int `json:"per_page" form:"per_page"`
}

func ParsePagination

func ParsePagination(ctx *gin.Context) (*Pagination, error)

ParsePagination parses pagination from query string

type PaginationReq

type PaginationReq Pagination

type PaginationResp

type PaginationResp struct {
	Pagination
	Count int64 `json:"count"`
}

type PassRequest

type PassRequest struct {
	UserId string `json:"user_id"`
}

type Profile

type Profile struct {
	gorm.Model
	ID          string    `gorm:"primaryKey;column:id"`
	Name        string    `gorm:"column:name"`
	Gender      string    `gorm:"column:gender"`
	Birthday    time.Time `gorm:"column:birthday"`
	Height      string    `gorm:"column:height"`
	Horoscope   string    `gorm:"column:horoscope"`
	Hobby       string    `gorm:"column:hobby"`
	Language    string    `gorm:"column:language"`
	Education   string    `gorm:"column:education"`
	HomeTown    string    `gorm:"column:home_town"`
	Coordinates string    `gorm:"column:coordinates"`
	ImageId1    string    `gorm:"column:image_id_1"`
	ImageId2    string    `gorm:"column:image_id_2"`
	ImageId3    string    `gorm:"column:image_id_3"`
	ImageId4    string    `gorm:"column:image_id_4"`
	ImageId5    string    `gorm:"column:image_id_5"`
	ImageUrl1   string    `gorm:"column:image_url_1"`
	ImageUrl2   string    `gorm:"column:image_url_2"`
	ImageUrl3   string    `gorm:"column:image_url_3"`
	ImageUrl4   string    `gorm:"column:image_url_4"`
	ImageUrl5   string    `gorm:"column:image_url_5"`
}

Profile model

func (*Profile) ConvertToMatchProfile

func (p *Profile) ConvertToMatchProfile() *MatchProfile

func (*Profile) Serialize

func (p *Profile) Serialize() *SerializableProfile

func (*Profile) TableName

func (p *Profile) TableName() string

TableName gives table name of model

type ProfileCreateRequest

type ProfileCreateRequest struct {
	Name              string   `json:"name" validate:"required"`
	Gender            string   `json:"gender" validate:"oneof=male female,required"`
	BirthdayInSeconds int64    `json:"birthday_in_seconds" validate:"required"`
	Height            string   `json:"height"`
	Horoscope         string   `json:"horoscope"`
	Hobby             []string `json:"hobby"`
	Language          []string `json:"language"`
	Education         string   `json:"education"`
	Location          string   `json:"location"`
	HomeTown          string   `json:"home_town"`
	Coordinates       struct {
		Longitude float64 `json:"longitude"`
		Latitude  float64 `json:"latitude"`
	} `json:"coordinates"`
}

type ProfileFilter

type ProfileFilter struct {
	ExcludedUserId string
	Gender         string
	MinAge         int
	MaxAge         int
	MinDistance    float64
	MaxDistance    float64
	Longitude      float64
	Latitude       float64
}

type ProfileImageDeleteRequest

type ProfileImageDeleteRequest struct {
	Slots []int `json:"slots"`
}

type ProfileUpdateRequest

type ProfileUpdateRequest struct {
	Name              string   `json:"name"`
	Gender            string   `json:"gender" validate:"oneof=male female"`
	BirthdayInSeconds int64    `json:"birthday_in_seconds"`
	Height            string   `json:"height"`
	Horoscope         string   `json:"horoscope"`
	Hobby             []string `json:"hobby"`
	Language          []string `json:"language"`
	Education         string   `json:"education"`
	Location          string   `json:"location"`
	HomeTown          string   `json:"home_town"`
	Coordinates       struct {
		Longitude float64 `json:"longitude"`
		Latitude  float64 `json:"latitude"`
	} `json:"coordinates"`
	ImageId1  string `json:"image_id_1"`
	ImageId2  string `json:"image_id_2"`
	ImageId3  string `json:"image_id_3"`
	ImageId4  string `json:"image_id_4"`
	ImageId5  string `json:"image_id_5"`
	ImageUrl1 string `json:"image_url_1"`
	ImageUrl2 string `json:"image_url_2"`
	ImageUrl3 string `json:"image_url_3"`
	ImageUrl4 string `json:"image_url_4"`
	ImageUrl5 string `json:"image_url_5"`
}

type Question

type Question struct {
	gorm.Model
	QuestionID      int    `gorm:"primaryKey;column:question_id"`
	QuestionContent string `gorm:"column:content"`
	QuestionAnswer  string `gorm:"column:answers"`
}

Question model

func (*Question) Serialize

func (q *Question) Serialize() *SerializableQuestion

func (*Question) TableName

func (q *Question) TableName() string

type RecommendationBin

type RecommendationBin struct {
	gorm.Model
	UserID            string `gorm:"primaryKey;column:user_id"`
	RecommendedUserID string `gorm:"primaryKey;column:recommended_user_id"`
}

RecommendationBin model

func (*RecommendationBin) TableName

func (p *RecommendationBin) TableName() string

TableName gives table name of model

type RegisterRequest

type RegisterRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

type SendVerificationEmailRequest

type SendVerificationEmailRequest struct {
	Email string `json:"email" validate:"required,email"`
}

type SerializableAnswer

type SerializableAnswer struct {
	UserID       string `json:"user_id"`
	QuestionID   int    `json:"question_id"`
	UserAnswer   int    `json:"user_answer"`
	PreferAnswer int    `json:"prefer_answer"`
	Importance   int    `json:"importance"`
}

type SerializableNestedUser

type SerializableNestedUser struct {
	User *SerializableUser `json:"user,omitempty"`
}

type SerializableProfile

type SerializableProfile struct {
	ID                string   `json:"id"`
	Name              string   `json:"name"`
	Gender            string   `json:"gender"`
	BirthdayInSeconds int64    `json:"birthday_in_seconds"`
	Height            string   `json:"height"`
	Horoscope         string   `json:"horoscope"`
	Hobby             []string `json:"hobby"`
	Language          []string `json:"language"`
	Education         string   `json:"education"`
	Location          string   `json:"location"`
	HomeTown          string   `json:"home_town"`
	Image1            string   `json:"image_1"`
	Image2            string   `json:"image_2"`
	Image3            string   `json:"image_3"`
	Image4            string   `json:"image_4"`
	Image5            string   `json:"image_5"`
	Answered          int      `json:"answered"`
}

type SerializableQuestion

type SerializableQuestion struct {
	QuestionID      int      `json:"question_id"`
	QuestionContent string   `json:"question_content"`
	QuestionAnswer  []string `json:"question_answer"`
}

type SerializableUser

type SerializableUser struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

type SignInRequest

type SignInRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

type SmashRequest

type SmashRequest struct {
	UserId string `json:"user_id"`
}

type TaxRate

type TaxRate string
const (
	TaxRateBASExcluded     TaxRate = "bas_excluded"
	TaxRateGSTOnIncome     TaxRate = "gst_on_income"
	TaxRateGSTOnExpenses   TaxRate = "gst_on_expenses"
	TaxRateGSTOnImports    TaxRate = "gst_on_imports"
	TaxRateGSTFreeExpenses TaxRate = "gst_free_expenses"
	TaxRateGSTFreeIncome   TaxRate = "gst_free_income"
)

func (TaxRate) TaxFree

func (tr TaxRate) TaxFree() bool

func (TaxRate) Validate

func (tr TaxRate) Validate() bool

type User

type User struct {
	gorm.Model
	ID                 string    `gorm:"primaryKey;column:id"`
	Email              string    `gorm:"column:email"`
	Password           string    `gorm:"column:password"`
	VerificationCode   string    `gorm:"column:verification_code"`
	VerificationStatus int       `gorm:"column:verification_status"`
	VerificationTime   time.Time `gorm:"column:verification_time"`
}

User model

func (*User) Serialize

func (u *User) Serialize() *SerializableUser

func (*User) SerializeNested

func (u *User) SerializeNested() *SerializableNestedUser

func (*User) TableName

func (u *User) TableName() string

TableName gives table name of model

type UserUpdateRequest

type UserUpdateRequest struct {
	VerificationCode   string    `json:"verification_code"`
	VerificationStatus int       `json:"verification_status"`
	VerificationTime   time.Time `json:"verification_time"`
}

type VerifyEmailRequest

type VerifyEmailRequest struct {
	Email            string `json:"email" validate:"required,email"`
	VerificationCode string `json:"verification_code" validate:"required"`
}

Jump to

Keyboard shortcuts

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