models

package
v0.0.0-...-da3af61 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendPasswordResetEmail

func SendPasswordResetEmail(toEmail, username, token string) error

func SendSignUpEmail

func SendSignUpEmail(toEmail, username, token string) error

Types

type AIFirstResponse

type AIFirstResponse struct {
	Recommendations []Recommendation `json:"recommendations"`
}

type AIPersistedResponse

type AIPersistedResponse struct {
	ID        uint           `gorm:"primaryKey;autoIncrement"`
	UserID    string         `json:"userId"`
	User      User           `gorm:"foreignKey:UserID"`
	Status    string         `json:"status"`
	Query     datatypes.JSON `gorm:"type:jsonb" json:"query"`
	Data      datatypes.JSON `gorm:"type:jsonb" json:"data,omitempty"`
	Message   string         `json:"message,omitempty"`
	Error     string         `json:"error,omitempty"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
}

func (*AIPersistedResponse) GetAllAIResponses

func (a *AIPersistedResponse) GetAllAIResponses(db *gorm.DB, userID string) (*AIPersistedResponse, error)

func (*AIPersistedResponse) GetResponseByDateRange

func (a *AIPersistedResponse) GetResponseByDateRange(db *gorm.DB, userID string, from, to time.Time, pagination config.Pagination) ([]AIPersistedResponse, error)

func (*AIPersistedResponse) GetResponseByNoOfDays

func (a *AIPersistedResponse) GetResponseByNoOfDays(db *gorm.DB, userID string, days int, pagination config.Pagination) ([]AIPersistedResponse, error)

func (*AIPersistedResponse) GetTodayResponse

func (a *AIPersistedResponse) GetTodayResponse(db *gorm.DB, userID string, pagination config.Pagination) ([]AIPersistedResponse, error)

type AIResponse

type AIResponse struct {
	Status string           `json:"status" example:"success"`
	Data   InvestmentAdvice `json:"data,omitempty"`
}

type AIServiceImpl

type AIServiceImpl struct {
	// contains filtered or unexported fields
}

func NewAIService

func NewAIService(apiKey string) (*AIServiceImpl, error)

func (*AIServiceImpl) FineTunedResponse

func (a *AIServiceImpl) FineTunedResponse(req AIServiceRequest) (string, error)

func (*AIServiceImpl) GetAIResponse

func (a *AIServiceImpl) GetAIResponse(message string) (string, error)

type AIServiceRequest

type AIServiceRequest struct {
	Age                 int     `json:"age" validate:"required"`
	Location            string  `json:"location" validate:"required"`
	InvestmentKnowledge string  `json:"investmentKnowledge" validate:"required"`
	InvestmentPurpose   string  `json:"investmentPurpose" validate:"required"`
	InvestmentHorizon   int     `json:"investmentHorizon" validate:"required"`
	RiskTolerance       string  `json:"riskTolerance" validate:"required"`
	Amount              float64 `json:"amount" validate:"required"`
	Currency            string  `json:"currency" validate:"required"`
}

type AIServiceResponse

type AIServiceResponse struct {
	Status    string      `json:"status"`
	Query     interface{} `json:"query,omitempty"`
	Data      interface{} `json:"data,omitempty"`
	Message   string      `json:"message,omitempty"`
	Error     string      `json:"error,omitempty"`
	CreatedAt time.Time   `json:"created_at,omitempty"`
}

type AuthErrorResponse

type AuthErrorResponse struct {
	Status string `json:"status" example:"error"`
	Error  string `json:"error" example:"Invalid or expired token"`
}

type ConfirmSignupRequest

type ConfirmSignupRequest struct {
	Token string `json:"token" binding:"required"`
	Email string `json:"email" binding:"required,email"`
}

type ConfirmSignupResponse

type ConfirmSignupResponse struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"User status updated successfully"`
}

type Email

type Email struct {
	SMTPHost    string
	SMTPPort    int
	SenderEmail string
	SenderPass  string
}

type EmailTemplateData

type EmailTemplateData struct {
	Username  string
	ResetLink string
	AppName   string
	Year      int
}

type ErrorResponse

type ErrorResponse struct {
	Status string `json:"status" example:"error"`
	Error  string `json:"error" example:"Something went wrong"`
}

type IntString

type IntString int

func (*IntString) UnmarshalJSON

func (i *IntString) UnmarshalJSON(data []byte) error

type InvestmentAdvice

type InvestmentAdvice struct {
	InvestmentAdvice string `json:"investmentAdvice" example:"Based on your risk tolerance, we recommend a diversified portfolio of stocks and bonds."`
}

type JWTClaims

type JWTClaims struct {
	UserID string `json:"user_id"`
	Email  string `json:"email"`
	jwt.RegisteredClaims
}

type LoginRequest

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

type LoginResponse

type LoginResponse struct {
	Status string `json:"status" example:"success"`
	Token  string `json:"token" example:"jwt.token.here"`
}

type LogoutRequest

type LogoutRequest struct {
	Email string `json:"email" binding:"required,email"`
}

type LogoutResponse

type LogoutResponse struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"Action successful"`
}

type PasswordChangeRequest

type PasswordChangeRequest struct {
	Token       string `json:"token" binding:"required"`
	NewPassword string `json:"new_password" binding:"required,min=8"`
}

type PasswordChangeResponse

type PasswordChangeResponse struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"Password changed successfully"`
}

type PasswordReset

type PasswordReset struct {
	ID        string    `gorm:"type:uuid;primaryKey;unique;not null"`
	UserID    string    `gorm:"index"`
	Email     string    `gorm:"uniqueIndex;not null"`
	Token     string    `gorm:"uniqueIndex;not null"`
	ExpiresAt time.Time `gorm:"not null"`
	CreatedAt time.Time
}

func (*PasswordReset) CreatePasswordReset

func (p *PasswordReset) CreatePasswordReset(db *gorm.DB, passReset *PasswordReset) error

func (*PasswordReset) GetPasswordResetByEmail

func (p *PasswordReset) GetPasswordResetByEmail(db *gorm.DB, email string) (*PasswordReset, error)

func (*PasswordReset) GetPasswordResetByID

func (p *PasswordReset) GetPasswordResetByID(db *gorm.DB, id string) (*PasswordReset, error)

func (*PasswordReset) GetPasswordResetByToken

func (p *PasswordReset) GetPasswordResetByToken(db *gorm.DB, token string) (*PasswordReset, error)

func (*PasswordReset) UpdatePasswordReset

func (p *PasswordReset) UpdatePasswordReset(db *gorm.DB, reset *PasswordReset) error

type PasswordResetRequest

type PasswordResetRequest struct {
	Email string `json:"email" binding:"required,email"`
}

type PasswordResetResponse

type PasswordResetResponse struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"Password reset successful"`
}

type Profile

type Profile struct {
	Email     string `json:"email" example:"success@gmail.com"`
	Name      string `json:"username" example:"olumighty"`
	FirstName string `json:"firstname" example:"Olu"`
	LastName  string `json:"lastname" example:"Ade"`
	IsActive  bool   `json:"isActive" example:"false"`
}

type ProfileRequest

type ProfileRequest struct {
	Email string `json:"email" binding:"required,email"`
}

type ProfileResponse

type ProfileResponse struct {
	Status string  `json:"status" example:"success"`
	Data   Profile `json:"data,omitempty"`
}

type Recommendation

type Recommendation struct {
	FinancialProduct     string    `json:"financial_product"`
	Ticker               string    `json:"ticker"`
	Provider             string    `json:"provider"`
	BriefDescription     string    `json:"brief_description"`
	ExpectedReturn       string    `json:"expected_return"`
	Composition          IntString `json:"composition"`
	Principal            IntString `json:"principal"`
	EstimatedReturnValue IntString `json:"estimated_return_value"`
}

type ResendLinkResponse

type ResendLinkResponse struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"Link sent successfully"`
}

type ServerErrorResponse

type ServerErrorResponse struct {
	Status string `json:"status" example:"error"`
	Error  string `json:"error" example:"Internal Server Error"`
}

type SignupRequest

type SignupRequest struct {
	Email     string `json:"email" binding:"required,email"`
	Password  string `json:"password" binding:"required"`
	Name      string `json:"username" binding:"required"`
	FirstName string `json:"first_name" binding:"required"`
	LastName  string `json:"last_name" binding:"required"`
}

type SignupResponse

type SignupResponse struct {
	Status  string `json:"status" example:"success"`
	Message string `json:"message" example:"User created successfully"`
}

type User

type User struct {
	ID        string `gorm:"type:uuid;primaryKey;unique;not null"`
	Name      string `gorm:"not null"`
	Email     string `gorm:"uniqueIndex;not null"`
	Password  string `gorm:"not null"`
	FirstName string `gorm:"not null"`
	LastName  string `gorm:"not null"`
	IsActive  bool   `gorm:"default:false"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

func (*User) CreateUser

func (u *User) CreateUser(db *gorm.DB, user *User) error

func (*User) DeleteUser

func (u *User) DeleteUser(db *gorm.DB, userID string) error

func (*User) GetUserActivityByEmail

func (u *User) GetUserActivityByEmail(db *gorm.DB, email string) (*User, error)

func (*User) GetUserByEmail

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

func (*User) GetUserByID

func (u *User) GetUserByID(db *gorm.DB, id string) (*User, error)

func (*User) GetUserByUsername

func (u *User) GetUserByUsername(db *gorm.DB, name string) (*User, error)

func (*User) IsUserActive

func (u *User) IsUserActive(db *gorm.DB, isActive bool) (bool, error)

func (*User) UpdateUserPassword

func (u *User) UpdateUserPassword(db *gorm.DB, user *User) error

type UserSession

type UserSession struct {
	ID        string    `gorm:"type:uuid;primaryKey;unique;not null"`
	UserID    string    `gorm:"index;unique;not null"`
	Token     string    `gorm:"uniqueIndex;not null"`
	ExpiresAt time.Time `gorm:"not null"`
	CreatedAt time.Time
}

func (*UserSession) CreateUserSession

func (u *UserSession) CreateUserSession(db *gorm.DB, session *UserSession) error

func (*UserSession) DeleteUserSession

func (u *UserSession) DeleteUserSession(db *gorm.DB, userID string) error

func (*UserSession) GetUserSession

func (u *UserSession) GetUserSession(db *gorm.DB, userID string, token string) (*UserSession, error)

func (*UserSession) GetUserSessionByID

func (u *UserSession) GetUserSessionByID(db *gorm.DB, userID string) (*UserSession, error)

func (*UserSession) HardDeleteUserSession

func (u *UserSession) HardDeleteUserSession(db *gorm.DB, userID string) error

func (*UserSession) UpdateUserSession

func (p *UserSession) UpdateUserSession(db *gorm.DB, session *UserSession) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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