Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnauthorized = commonerrors.New("unauthorized") // Model validation errors ErrInvalidSettingsType = commonerrors.New("invalid settings type") ErrFieldRequired = commonerrors.New("field is required") ErrInvalidFieldParam = commonerrors.New("invalid field parameter") // Special validation error that can't be handled by struct tags ErrEndDateWithCurrent = commonerrors.New("end date must be empty when position is current") // Repository errors ErrSettingsNotFound = commonerrors.New("settings not found") ErrFailedToGetSettings = commonerrors.New("failed to get settings") ErrFailedToUpdateSettings = commonerrors.New("failed to update settings") ErrProfileNotFound = commonerrors.New("profile not found") // Specific entity not found errors ErrWorkExperienceNotFound = commonerrors.New("work experience not found") ErrEducationNotFound = commonerrors.New("education not found") ErrCertificationNotFound = commonerrors.New("certification not found") // Service layer errors ErrFailedToCreateWorkExperience = commonerrors.New("failed to create work experience") ErrFailedToUpdateWorkExperience = commonerrors.New("failed to update work experience") ErrFailedToDeleteWorkExperience = commonerrors.New("failed to delete work experience") ErrFailedToGetWorkExperience = commonerrors.New("failed to get work experience") ErrFailedToCreateEducation = commonerrors.New("failed to create education") ErrFailedToUpdateEducation = commonerrors.New("failed to update education") ErrFailedToDeleteEducation = commonerrors.New("failed to delete education") ErrFailedToGetEducation = commonerrors.New("failed to get education") ErrFailedToCreateCertification = commonerrors.New("failed to create certification") ErrFailedToUpdateCertification = commonerrors.New("failed to update certification") ErrFailedToDeleteCertification = commonerrors.New("failed to delete certification") ErrFailedToGetCertification = commonerrors.New("failed to get certification") )
Functions ¶
func GetSentinelError ¶
GetSentinelError is a convenience function that calls the common errors package
Types ¶
type AccountActivity ¶
type AccountActivity struct {
LastLogin time.Time `json:"login_time"`
CreatedAt time.Time `json:"created_at"`
}
AccountActivity represents the timestamps of the last login and account creation for a user.
func NewAccountActivity ¶
func NewAccountActivity(lastLogin, createdAt time.Time) *AccountActivity
NewAccountActivity creates a new AccountActivity instance.
type Certification ¶
type Certification struct {
ID int `json:"id" db:"id" sql:"primary_key;auto_increment"`
ProfileID int `json:"profile_id" db:"profile_id" sql:"type:integer;not null;index;references:profiles(id)" validate:"required,min=1"`
Name string `json:"name" db:"name" sql:"type:text;not null" validate:"required,min=1,max=200"`
IssuingOrg string `json:"issuing_org" db:"issuing_org" sql:"type:text;not null" validate:"required,min=1,max=200"`
IssueDate time.Time `json:"issue_date" db:"issue_date" sql:"type:timestamp;not null" validate:"required,notfuture"`
ExpiryDate *time.Time `json:"expiry_date,omitempty" db:"expiry_date" sql:"type:timestamp" validate:"omitempty,gtfield=IssueDate"`
CredentialID string `json:"credential_id" db:"credential_id" sql:"type:text" validate:"max=200"`
CredentialURL string `json:"credential_url" db:"credential_url" sql:"type:text" validate:"omitempty,url,max=500"`
CreatedAt time.Time `json:"created_at" db:"created_at" sql:"type:timestamp;not null;default:current_timestamp"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at" sql:"type:timestamp;not null;default:current_timestamp"`
}
Certification represents certification entries in a user's profile
func (*Certification) BindFromForm ¶
func (cert *Certification) BindFromForm(c *gin.Context) error
BindFromForm implements FormBindable for Certification
func (*Certification) GetID ¶
func (c *Certification) GetID() int
GetID implements CRUDEntity for Certification
func (*Certification) GetProfileID ¶
func (c *Certification) GetProfileID() int
GetProfileID implements CRUDEntity for Certification
func (*Certification) Sanitize ¶
func (c *Certification) Sanitize()
Sanitize cleans up the Certification data
func (*Certification) Validate ¶
func (c *Certification) Validate() error
Validate validates the Certification struct
type Education ¶
type Education struct {
ID int `json:"id" db:"id" sql:"primary_key;auto_increment"`
ProfileID int `json:"profile_id" db:"profile_id" sql:"type:integer;not null;index;references:profiles(id)" validate:"required,min=1"`
Institution string `json:"institution" db:"institution" sql:"type:text;not null" validate:"required,min=1,max=200"`
Degree string `json:"degree" db:"degree" sql:"type:text;not null" validate:"required,min=1,max=200"`
FieldOfStudy string `json:"field_of_study" db:"field_of_study" sql:"type:text" validate:"max=200"`
StartDate time.Time `json:"start_date" db:"start_date" sql:"type:timestamp;not null" validate:"required,notfuture"`
EndDate *time.Time `json:"end_date,omitempty" db:"end_date" sql:"type:timestamp" validate:"omitempty,notfuture,gtfield=StartDate"`
Description string `json:"description" db:"description" sql:"type:text" validate:"max=2000"`
CreatedAt time.Time `json:"created_at" db:"created_at" sql:"type:timestamp;not null;default:current_timestamp"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at" sql:"type:timestamp;not null;default:current_timestamp"`
}
Education represents education entries in a user's profile
func (*Education) BindFromForm ¶
BindFromForm implements FormBindable for Education
func (*Education) GetProfileID ¶
GetProfileID implements CRUDEntity for Education
type EntityType ¶
type EntityType string
EntityType represents the type of profile entity
const ( EntityTypeExperience EntityType = "Experience" EntityTypeEducation EntityType = "Education" EntityTypeCertification EntityType = "Certification" )
func (EntityType) Lower ¶
func (et EntityType) Lower() string
Lower returns the lowercase representation of the EntityType
func (EntityType) String ¶
func (et EntityType) String() string
String returns the string representation of the EntityType
type Industry ¶
type Industry int
Industry represents predefined industry categories
const ( IndustryTechnology Industry = iota IndustrySoftwareDevelopment IndustryIT IndustryDataScience IndustryArtificialIntelligence IndustryMachineLearning IndustryInternetServices IndustryTelecommunications IndustryHealthcare IndustryBiotechnology IndustryPharmaceuticals IndustryMedicalDevices IndustryHealthTech IndustryFinance IndustryBanking IndustryInvestmentManagement IndustryInsurance IndustryFinTech IndustryRealEstate IndustryConstruction IndustryArchitecture IndustryManufacturing IndustryAutomotive IndustryAerospace IndustryRetail IndustryEcommerce IndustryWholesale IndustryConsumerGoods IndustryEducation IndustryEdTech IndustryHigherEducation IndustryMedia IndustryEntertainment IndustryPublishing IndustryAdvertising IndustryMarketing IndustryPublicRelations IndustryHospitality IndustryTourism IndustryFoodBeverage IndustryEnergyUtilities IndustryOilGas IndustryRenewableEnergy IndustryEnvironmental IndustryTransportationLogistics IndustryAgriculture IndustryGovernment IndustryNonProfit IndustryLegal IndustryConsulting IndustryHumanResources IndustrySecurity IndustryCybersecurity IndustryUnspecified )
func IndustryFromString ¶
IndustryFromString converts a string to an Industry
type IndustryInfo ¶
IndustryInfo holds metadata about an industry
func GetAllIndustries ¶
func GetAllIndustries() []IndustryInfo
GetAllIndustries returns all available industries (excluding Unspecified)
type Profile ¶
type Profile struct {
ID int `json:"id" db:"id" sql:"primary_key;auto_increment"`
UserID int `json:"user_id" db:"user_id" sql:"type:integer;not null;unique;index;references:users(id)" validate:"required,min=1"`
FirstName string `json:"first_name" db:"first_name" sql:"type:text" validate:"required,min=1,max=100"`
LastName string `json:"last_name" db:"last_name" sql:"type:text" validate:"required,min=1,max=100"`
Title string `json:"title" db:"title" sql:"type:text" validate:"max=200"`
Industry Industry `json:"industry" db:"industry" sql:"type:integer" validate:"validindustry"`
CareerSummary string `json:"career_summary" db:"career_summary" sql:"type:text" validate:"max=2000"`
Skills []string `json:"skills" db:"skills" sql:"type:text" validate:"max=50,dive,required,min=1,max=100"`
PhoneNumber string `json:"phone_number" db:"phone_number" sql:"type:text" validate:"phone"`
Email string `json:"email" db:"email" sql:"type:text" validate:"omitempty,email,max=255"`
Location string `json:"location" db:"location" sql:"type:text" validate:"max=200"`
LinkedInProfile string `json:"linkedin_profile" db:"linkedin_profile" sql:"type:text" validate:"omitempty,linkedin,max=500"`
GitHubProfile string `json:"github_profile" db:"github_profile" sql:"type:text" validate:"omitempty,github,max=500"`
Website string `json:"website" db:"website" sql:"type:text" validate:"omitempty,url,max=500"`
Context string `json:"context" db:"context" sql:"type:text" validate:"max=6000"`
CreatedAt time.Time `json:"created_at" db:"created_at" sql:"type:timestamp;not null;default:current_timestamp"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at" sql:"type:timestamp;not null;default:current_timestamp"`
WorkExperience []WorkExperience `json:"work_experience,omitempty" db:"-"`
Education []Education `json:"education,omitempty" db:"-"`
Certifications []Certification `json:"certifications,omitempty" db:"-"`
}
Profile represents user profile information
type SecuritySettings ¶
type SecuritySettings struct {
Activity *AccountActivity
}
SecuritySettings represents the security settings of a user
func NewSecuritySettings ¶
func NewSecuritySettings(accountActivity *AccountActivity) *SecuritySettings
NewSecuritySettings creates and returns a new SecuritySettings instance
type WorkExperience ¶
type WorkExperience struct {
ID int `json:"id" db:"id" sql:"primary_key;auto_increment"`
ProfileID int `json:"profile_id" db:"profile_id" sql:"type:integer;not null;index;references:profiles(id)" validate:"required,min=1"`
Company string `json:"company" db:"company" sql:"type:text;not null" validate:"required,min=1,max=200"`
Title string `json:"title" db:"title" sql:"type:text;not null" validate:"required,min=1,max=200"`
Location string `json:"location" db:"location" sql:"type:text" validate:"max=200"`
StartDate time.Time `json:"start_date" db:"start_date" sql:"type:timestamp;not null" validate:"required,notfuture"`
EndDate *time.Time `json:"end_date,omitempty" db:"end_date" sql:"type:timestamp" validate:"omitempty,notfuture,gtfield=StartDate"`
Description string `json:"description" db:"description" sql:"type:text" validate:"max=2000"`
Current bool `json:"current" db:"current" sql:"type:boolean;default:false"`
CreatedAt time.Time `json:"created_at" db:"created_at" sql:"type:timestamp;not null;default:current_timestamp"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at" sql:"type:timestamp;not null;default:current_timestamp"`
}
WorkExperience represents work experience entries in a user's profile
func (*WorkExperience) BindFromForm ¶
func (w *WorkExperience) BindFromForm(c *gin.Context) error
BindFromForm implements FormBindable for WorkExperience
func (*WorkExperience) GetID ¶
func (w *WorkExperience) GetID() int
GetID implements CRUDEntity for WorkExperience
func (*WorkExperience) GetProfileID ¶
func (w *WorkExperience) GetProfileID() int
GetProfileID implements CRUDEntity for WorkExperience
func (*WorkExperience) Sanitize ¶
func (w *WorkExperience) Sanitize()
Sanitize cleans up the WorkExperience data
func (*WorkExperience) Validate ¶
func (w *WorkExperience) Validate() error
Validate validates the WorkExperience struct