models

package
v0.0.0-...-8ee20e3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AdminRole = "admin"
View Source
const UserRole = "user"

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hashedPassword string) bool

func GenerateSalt

func GenerateSalt() string

func HashPassword

func HashPassword(password string) (string, error)

Types

type CampaignCustomer

type CampaignCustomer struct {
	Model
	CampaignID uint      `json:"campaign_id"`
	CustomerID uint      `json:"customer_id"`
	Status     string    `json:"status"`
	StartDate  time.Time `json:"start_date"`
	EndDate    time.Time `json:"end_date"`
	Subscribed bool      `json:"subscribed" gorm:"default:false"`
}

type Customer

type Customer struct {
	Model
	Email         string `json:"email"`
	FirstName     string `json:"first_name"`
	LastName      string `json:"last_name"`
	Phone         string `json:"phone" gorm:"default:null"`
	Company       string `json:"company" gorm:"default:null"`
	Address       string `json:"address" gorm:"default:null"`
	City          string `json:"city" gorm:"default:null"`
	State         string `json:"state" gorm:"default:null"`
	Country       string `json:"country" gorm:"default:null"`
	PostalCode    string `json:"postal_code" gorm:"default:null"`
	Notes         string `json:"notes" gorm:"default:null"`
	Tags          string `json:"tags" gorm:"default:null"`
	EmailVerified bool   `json:"email_verified" gorm:"default:false"`
	Subscribed    bool   `json:"subscribed" gorm:"default:false"`
	LastContacted string `json:"last_contacted" gorm:"default:null"`
	LeadSource    string `json:"lead_source" gorm:"default:null"`
	LeadStatus    string `json:"lead_status" gorm:"default:null"`
	CreatedBy     uint   `json:"created_by"`
	AssignedTo    uint   `json:"assigned_to"`
}

type DripCampaign

type DripCampaign struct {
	Model
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Status      string    `json:"status"`
	StartDate   time.Time `json:"start_date"`
	EndDate     time.Time `json:"end_date"`
	Stages      []Stage   `json:"stages" gorm:"foreignkey:CampaignID"`
}

type EmailLog

type EmailLog struct {
	Model
	CampaignID      uint      `json:"campaign_id"`
	CustomerID      uint      `json:"customer_id"`
	EmailTemplateID uint      `json:"email_template_id"`
	Subject         string    `json:"subject"`
	Body            string    `json:"body"`
	SentAt          time.Time `json:"sent_at"`
	Status          string    `json:"status"`
}

type EmailRequest

type EmailRequest struct {
	To      string `json:"to"`
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

type EmailTemplate

type EmailTemplate struct {
	Model
	Name        string `json:"name"`
	Subject     string `json:"subject"`
	Body        string `json:"body"`
	ContentType string `` /* 164-byte string literal not displayed */
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginUser

type LoginUser struct {
	Email string `json:"email"`
	Role  string `json:"role"`
}

type Model

type Model struct {
	ID        uint       `gorm:"primary_key"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `sql:"index" json:"deleted_at"`
}

type Settings

type Settings struct {
	Model
	UserID              uint   `json:"user_id"`
	CRMAPIKey           string `json:"crm_api_key"`
	GmailEmail          string `json:"gmail_email"`
	GmailPassword       string `json:"gmail_password"`
	EmailPollingSeconds int    `json:"email_polling_seconds"`
}

type Stage

type Stage struct {
	Model
	CampaignID  uint   `json:"campaign_id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Order       int    `json:"order"`
	Steps       []Step `json:"steps" gorm:"foreignkey:StageID"`
}

type Step

type Step struct {
	Model
	StageID         uint           `json:"stage_id"`
	Name            string         `json:"name"`
	Description     string         `json:"description"`
	EmailTemplateID uint           `json:"email_template_id"`
	EmailTemplate   *EmailTemplate `json:"email_template,omitempty" gorm:"foreignkey:EmailTemplateID"`
	WaitTime        int            `json:"wait_time"`
}

type SuccessResponse

type SuccessResponse struct {
	Message string `json:"message"`
}

type TokenResponse

type TokenResponse struct {
	Token string `json:"token"`
}

type User

type User struct {
	Model
	Email    string `gorm:"unique;not null"`
	Password string `gorm:"not null"`
	Role     string `gorm:"not null"`
}

func GetUserByEmail

func GetUserByEmail(email string) (*User, error)

GetUserByEmail retrieves a user from the database based on the provided email

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

Jump to

Keyboard shortcuts

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