models

package
v0.0.0-...-1b39580 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangePasswordRequest

type ChangePasswordRequest struct {
	Id              int64  `json:"id"`
	Email           string `json:"email"`
	OldPassword     string `json:"oldPassword"`
	Password        string `json:"password"`
	PasswordConfirm string `json:"passwordConfirm"`
}

type OrderDBModel

type OrderDBModel struct {
	Id             int64 `gorm:"id;primaryKey;autoIncrement"`
	UserId         int64 `gorm:"column:user_id;type:int;not null;uniqueIndex;not null"`
	SubscriptionId int64 `gorm:"column:plan_id;type:varchar(255);not null"`
	VoucherId      int64
	PurchasedAt    time.Time  `gorm:"column:purchased_at"`
	CreatedAt      time.Time  `gorm:"column:created_at"`
	DeletedAt      *time.Time `gorm:"column:deleted_at"`
}

func (OrderDBModel) TableName

func (OrderDBModel) TableName() string

type PaymentDBModel

type PaymentDBModel struct {
	Id          int64      `gorm:"id;primaryKey;autoIncrement"`
	UserId      int64      `gorm:"column:user_id;type:int;not null;uniqueIndex;not null"`
	PlanId      int64      `gorm:"column:plan_id;type:varchar(255);not null"`
	OrderId     int64      `gorm:"column:order_id;type:int;not null"`
	Total       int64      `gorm:"column:total;type:int;not null"`
	PurchasedAt time.Time  `gorm:"column:purchased_at"`
	StartedAt   *time.Time `gorm:"column:started_at"`
	EndsAt      *time.Time `gorm:"column:ends_at"`
}

func (PaymentDBModel) TableName

func (PaymentDBModel) TableName() string

type Plan

type Plan struct {
	Id          int64      `gorm:"id;primaryKey;autoIncrement"`
	Name        int64      `gorm:"column:user_id;type:int;not null;uniqueIndex;not null"`
	Description int64      `gorm:"column:plan_id;type:varchar(255);not null"`
	IsActive    bool       `gorm:"column:is_active;type:bool;not null"`
	CreatedAt   time.Time  `gorm:"column:created_at"`
	UpdatedAt   *time.Time `gorm:"column:updated_at"`
	DeletedAt   *time.Time `gorm:"column:deleted_at"`
}

func (Plan) TableName

func (Plan) TableName() string

type Roles

type Roles struct {
	Roles []string `json:"roles"`
}

type SignInUserRequest

type SignInUserRequest struct {
	Username string `json:"username" validate:"required_without=Email"`
	Email    string `json:"email" validate:"required_without=Username,omitempty,email"`
	Password string `json:"password" validate:"required"`
}

type SignUpUserRequest

type SignUpUserRequest struct {
	Email           string `json:"email" validate:"required,email"`
	Password        string `json:"password" validate:"required,min=8,max=16"`
	PasswordConfirm string `json:"passwordConfirm" validate:"required,min=8,max=16"`
}

type SubscriptionDBModel

type SubscriptionDBModel struct {
	Id          int64     `gorm:"id;primaryKey;autoIncrement"`
	UserId      int64     `gorm:"column:user_id;type:int;not null;uniqueIndex;not null"`
	PlanId      int64     `gorm:"column:plan_id;type:varchar(255);not null"`
	PurchasedAt time.Time `gorm:"column:purchased_at"`
	StartedAt   time.Time `gorm:"column:started_at"`
	EndsAt      time.Time `gorm:"column:ends_at"`
}

func (SubscriptionDBModel) TableName

func (SubscriptionDBModel) TableName() string

type UpdateUserRequest

type UpdateUserRequest struct {
	Id        int64   `json:"id,omitempty"`
	Firstname *string `json:"firstname"`
	Lastname  *string `json:"lastname"`
	Password  *string `json:"password"`
}

type User

type User struct {
	ID int64
	// Creates a primary key for UserID.
	UserID    int64  `gorm:"primary_key"`
	Username  string `sql:"type:VARCHAR(15);not null"`
	FName     string `sql:"size:100;not null" gorm:"column:FirstName"`
	LName     string `sql:"unique;unique_index;not null;DEFAULT:'Unknown'" gorm:"column:LastName"`
	Count     int    `gorm:"AUTO_INCREMENT"`
	TempField bool   `sql:"-"` // Ignore a Field
}

type UserDBModel

type UserDBModel struct {
	Id               int64      `gorm:"id;primaryKey;autoIncrement"`
	Username         string     `gorm:"type:varchar(180);not null;uniqueIndex;not null"`
	Password         string     `gorm:"type:varchar(255);not null"`
	Firstname        string     `gorm:"column:first_name;type:varchar(255)"`
	Lastname         string     `gorm:"column:last_name;type:varchar(255)"`
	Email            string     `gorm:"type:varchar(255);not null;uniqueIndex;not null"`
	Phone            string     `gorm:"column:phone_no;type:varchar(11)"`
	VerificationCode string     `gorm:"column:verification_code;type:varchar(12)"`
	CreatedAt        time.Time  `gorm:"column:created_at"`
	UpdatedAt        *time.Time `gorm:"column:updated_at"`
	LastLogin        *time.Time `gorm:"column:last_login"`
	DeletedAt        *time.Time `gorm:"column:deleted_at"`
	Verified         bool       `gorm:"column:is_verified;default:false"`
	Active           bool       `gorm:"column:is_active;default:false"`
}

func (*UserDBModel) AMQP

func (um *UserDBModel) AMQP() amqp.Publishing

func (*UserDBModel) BeforeCreate

func (um *UserDBModel) BeforeCreate(tx *gorm.DB) (err error)

func (*UserDBModel) FromCreateUserReq

func (m *UserDBModel) FromCreateUserReq(cur SignUpUserRequest, enc ...bool) error

func (*UserDBModel) FromMongoUser

func (um *UserDBModel) FromMongoUser(um2 UserMongoModel) error

func (UserDBModel) TableName

func (UserDBModel) TableName() string

type UserDBResponse

type UserDBResponse struct {
	Id        int64
	Username  string
	Firstname string
	Lastname  string
	Email     string
	Password  string
	Verified  bool
	Active    bool
	CreatedAt time.Time
	LastLogin time.Time
}

func (*UserDBResponse) FromProtoUserDetails

func (r *UserDBResponse) FromProtoUserDetails(pw *intrvproto.UserDetails) error

type UserEvent

type UserEvent struct {
	ID               int64
	Username         string
	Email            string
	VerificationCode string
}

func (UserEvent) String

func (u UserEvent) String() string

type UserMongoModel

type UserMongoModel struct {
	Username         string     `bson:"username,omitempty"`
	Password         string     `bson:"password,omitempty"`
	Firstname        string     `bson:"firstname,omitempty"`
	Lastname         string     `bson:"lastname,omitempty"`
	Email            string     `bson:"email,omitempty"`
	Phone            string     `bson:"phone,omitempty"`
	VerificationCode string     `bson:"verification_code,omitempty"`
	Verified         bool       `bson:"is_verified,omitempty"`
	Active           bool       `bson:"is_active,omitempty"`
	CreatedAt        time.Time  `bson:"createdAt,omitempty"`
	UpdatedAt        *time.Time `bson:"updatedAt,omitempty"`
	LastLogin        *time.Time `bson:"lastLogin,omitempty"`
}

func (*UserMongoModel) FromDBModel

func (m *UserMongoModel) FromDBModel(user *UserDBModel) error

type UserRequest

type UserRequest struct {
	Id       int64  `json:"id" govalidator:"int"`
	Username string `json:"username"`
	Email    string `json:"email" `
}

type UserResponse

type UserResponse struct {
	Id               int64      `json:"id,omitempty"`
	Username         string     `json:"username,omitempty"`
	Firstname        string     `json:"firstname,omitempty"`
	Lastname         string     `json:"lastname,omitempty"`
	Email            string     `json:"email,omitempty"`
	Verified         bool       `json:"is_verified,omitempty"`
	VerificationCode string     `json:"verification_token,omitempty"`
	Active           bool       `json:"is_active,omitempty"`
	AccessToken      string     `json:"token,omitempty"`
	RefreshToken     string     `json:"refresh_token,omitempty"`
	CreatedAt        time.Time  `json:"created_at,omitempty"`
	UpdatedAt        *time.Time `json:"updated_at,omitempty"`
	LastLogin        *time.Time `json:"last_login,omitempty"`
	DeletedAt        *time.Time `json:"deleted_at,omitempty"`
}

func (*UserResponse) AssignTokenPair

func (r *UserResponse) AssignTokenPair(tp *jwt.TokenPair)

func (*UserResponse) FromDBModel

func (r *UserResponse) FromDBModel(um *UserDBModel) error

func (*UserResponse) FromDBResponse

func (r *UserResponse) FromDBResponse(user *UserDBResponse) error

func (*UserResponse) FromProtoSignIn

func (r *UserResponse) FromProtoSignIn(pbu *intrvproto.SignInUserResponse)

func (*UserResponse) FromProtoSignUp

func (r *UserResponse) FromProtoSignUp(pbu *intrvproto.SignUpUserResponse) error

func (*UserResponse) FromProtoUserDetails

func (r *UserResponse) FromProtoUserDetails(pbu *intrvproto.UserDetails)

func (*UserResponse) FromProtoUserResponse

func (r *UserResponse) FromProtoUserResponse(pu *intrvproto.UserResponse) error

type Users

type Users struct {
	Users []UserDBModel `json:"users"`
}

type VerificationCodeRequest

type VerificationCodeRequest struct {
	Email string `json:"code"`
}

Jump to

Keyboard shortcuts

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