models

package
v0.0.0-...-6082db2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUserExists

func CheckUserExists(tx *gorm.DB, email string) (bool, error)

func CreateApplicant

func CreateApplicant(tx *gorm.DB, req ApplicantRequest) error

func CreateInquiry

func CreateInquiry(tx *gorm.DB, req InquiryRequest) error

func CreateProduct

func CreateProduct(tx *gorm.DB, req *CreateProductRequest) error

func UpdateProduct

func UpdateProduct(tx *gorm.DB, id uuid.UUID, req *CreateProductRequest) error

func UpdateTransaction

func UpdateTransaction(tx *gorm.DB, id string, req *CreateTransactionRequest) error

func UpdateUser

func UpdateUser(tx *gorm.DB, id uuid.UUID, req *CreateUserRequest) error

Types

type ApplicantRequest

type ApplicantRequest struct {
	FirstName       string     `form:"first_name,omitempty" binding:"required"`
	LastName        string     `form:"last_name,omitempty" binding:"required"`
	Email           string     `form:"email,omitempty" binding:"required"`
	Phone           string     `form:"phone,omitempty" binding:"required"`
	ZipCode         string     `form:"zip_code,omitempty" binding:"required"`
	JobTitle        string     `form:"job_title,omitempty" binding:"required"`
	LinkedInProfile string     `form:"linked_in_profile,omitempty"`
	ApplicationDate *time.Time `form:"application_date,omitempty"`
	FileURL         string
}

type Applicants

type Applicants struct {
	ID              uuid.UUID  `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id"`
	FirstName       string     `gorm:"type:varchar(255); not null;" json:"first_name"`
	LastName        string     `gorm:"type:varchar(255); not null;" json:"last_name"`
	Email           string     `gorm:"type:varchar(255); not null;" json:"email"`
	Phone           string     `gorm:"type:varchar(255); not null;" json:"phone"`
	ZipCode         string     `gorm:"type:varchar(255); not null;" json:"zip_code"`
	LinkedInProfile string     `gorm:"type:varchar(255); nullable;" json:"linked_in_profile"`
	JobTitle        string     `gorm:"type:varchar(255); not null;" json:"job_title"`
	ApplicationDate *time.Time `gorm:"nullable" json:"application_date,omitempty"`
	FileURL         string     `gorm:"type:varchar(255); nullable;" json:"file_url,omitempty"`
}

func GetAllApplicants

func GetAllApplicants(tx *gorm.DB) ([]Applicants, error)

func GetApplicantById

func GetApplicantById(tx *gorm.DB, id string) (*Applicants, error)

type CreateProductRequest

type CreateProductRequest struct {
	Name            string  `json:"name,omitempty" binding:"required"`
	Description     string  `json:"description,omitempty"`
	BasePrice       float64 `json:"basePrice,omitempty" binding:"required"`
	DiscountedPrice float64 `json:"discountedPrice,omitempty"`
	Quantity        int     `json:"quantity,omitempty" binding:"required"`
}

type CreateQrCodeRequest

type CreateQrCodeRequest struct {
	TransactionID uuid.UUID `json:"transaction_id,omitempty" binding:"required"`
	UserID        uuid.UUID `json:"user_id,omitempty" binding:"required"`
	S3Url         string    `json:"s3_url,omitempty" binding:"required"`
}

type CreateTransactionRequest

type CreateTransactionRequest struct {
	ProductID                       uuid.UUID `json:"product_id,omitempty" binding:"required"`
	UserID                          uuid.UUID `json:"user_id,omitempty" binding:"required"`
	Amount                          float64   `json:"amount,omitempty" binding:"required"`
	StripePaymentIntentID           string    `json:"stripe_payment_intent_id,omitempty" binding:"required"`
	StripePaymentIntentClientSecret string    `json:"stripe_payment_intent_client_secret,omitempty" binding:"required"`
}

type CreateUserRequest

type CreateUserRequest struct {
	FirstName   string     `json:"first_name,omitempty" binding:"required"`
	LastName    string     `json:"last_name,omitempty" binding:"required"`
	Email       string     `json:"email,omitempty" binding:"required"`
	ZipCode     string     `json:"zip_code,omitempty" binding:"required"`
	PhoneNumber string     `json:"phone_number,omitempty"`
	IsJoinBeta  *time.Time `json:"is_join_beta,omitempty"`
}

type Inquiry

type Inquiry struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id"`
	FirstName string    `gorm:"type:varchar(255); not null;" json:"first_name"`
	LastName  string    `gorm:"type:varchar(255); not null;" json:"last_name"`
	Email     string    `gorm:"type:varchar(255); not null;" json:"email"`
	Phone     string    `gorm:"type:varchar(255); not null;" json:"phone"`
	Message   string    `gorm:"type:text; not null;" json:"message"`
}

func GetAllInquiries

func GetAllInquiries(tx *gorm.DB) ([]Inquiry, error)

func GetInquiryByID

func GetInquiryByID(tx *gorm.DB, id string) (*Inquiry, error)

type InquiryRequest

type InquiryRequest struct {
	FirstName string `json:"first_name" binding:"required"`
	LastName  string `json:"last_name" binding:"required"`
	Email     string `json:"email" binding:"required"`
	Phone     string `json:"phone" binding:"required"`
	Message   string `json:"message" binding:"required"`
}

type Product

type Product struct {
	ID              uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"ID,omitempty"`
	Name            string    `gorm:"type:varchar(255)" json:"name,omitempty"`
	Description     string    `gorm:"type:varchar(255)" json:"description,omitempty"`
	BasePrice       float64   `gorm:"type:float" json:"basePrice,omitempty"`
	DiscountedPrice float64   `gorm:"type:float" json:"discountedPrice,omitempty"`
	Quantity        int       `gorm:"type:int" json:"quantity,omitempty"`
}

func GetProductByID

func GetProductByID(tx *gorm.DB, id uuid.UUID) (Product, error)

func GetProducts

func GetProducts(tx *gorm.DB) ([]Product, error)

type QrCodes

type QrCodes struct {
	ID            uuid.UUID  `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"ID,omitempty"`
	TransactionID uuid.UUID  `gorm:"type:uuid;" json:"transaction_id,omitempty"`
	UserID        uuid.UUID  `gorm:"type:uuid;" json:"user_id,omitempty"`
	S3Url         string     `gorm:"type:text;not null;" json:"s3_url,omitempty"`
	IsQrUsed      *time.Time `gorm:"nullable" json:"is_qr_used,omitempty"`
}

func CreateQrCode

func CreateQrCode(tx *gorm.DB, req *CreateQrCodeRequest) (QrCodes, error)

func GetQrCodeByUserIDAndTransactionID

func GetQrCodeByUserIDAndTransactionID(tx *gorm.DB, transactionID uuid.UUID, userID uuid.UUID) (QrCodes, error)

func GetQrCodes

func GetQrCodes(tx *gorm.DB) ([]QrCodes, error)

type Transaction

type Transaction struct {
	ID                              uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"ID,omitempty"`
	ProductID                       uuid.UUID `gorm:"type:uuid;" json:"product_id,omitempty"`
	UserID                          uuid.UUID `gorm:"type:uuid;" json:"user_id,omitempty"`
	Amount                          float64   `gorm:"type:float;" json:"amount,omitempty"`
	StripePaymentIntentID           string    `json:"stripe_payment_intent_id,omitempty"`
	StripePaymentIntentClientSecret string    `json:"stripe_payment_intent_client_secret,omitempty"`
}

func CreateTransaction

func CreateTransaction(tx *gorm.DB, req *CreateTransactionRequest) (Transaction, error)

func GetTransactionByID

func GetTransactionByID(tx *gorm.DB, id uuid.UUID) (Transaction, error)

func GetTransactionByStripePaymentIntentID

func GetTransactionByStripePaymentIntentID(tx *gorm.DB, id string) (Transaction, error)

func GetTransactions

func GetTransactions(tx *gorm.DB) ([]Transaction, error)

type User

type User struct {
	ID             uuid.UUID  `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"ID,omitempty"`
	FirstName      string     `gorm:"type:varchar(255); not null;" json:"first_name,omitempty"`
	LastName       string     `gorm:"type:varchar(255); not null;" json:"last_name,omitempty"`
	Email          string     `gorm:"type:varchar(255); unique; not null;" json:"email,omitempty"`
	ZipCode        string     `gorm:"type:varchar(255); not null;" json:"zip_code,omitempty"`
	PhoneNumber    string     `gorm:"type:varchar(255)" json:"phone_number,omitempty"`
	IsJoinBeta     *time.Time `gorm:"nullable" json:"is_join_beta,omitempty"`
	IsUnsubscribed *time.Time `gorm:"nullable" json:"is_join_beta,omitempty"`
}

func CreateUser

func CreateUser(tx *gorm.DB, req *CreateUserRequest) (User, error)

func GetUserByEmail

func GetUserByEmail(tx *gorm.DB, email string) (User, error)

func GetUserByID

func GetUserByID(tx *gorm.DB, id uuid.UUID) (User, error)

func GetUsers

func GetUsers(tx *gorm.DB) ([]User, error)

func UnsubscribeUser

func UnsubscribeUser(tx *gorm.DB, email string) (User, error)

Jump to

Keyboard shortcuts

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