package profile import ( "encoding/json" "time" "github.com/google/uuid" "gorm.io/gorm" ) type Model struct { ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"` UserID *uuid.UUID `gorm:"column:user_id;type:uuid;index:profiles_user_id_idx"` Handle string `gorm:"column:handle;type:text;not null;uniqueIndex:profiles_handle_unique"` // Hero fields (normalized for search) RoleID *uuid.UUID `gorm:"column:role_id;type:uuid;index:profiles_role_id_idx"` Role *RoleModel `gorm:"foreignKey:RoleID"` RoleName *string `gorm:"column:role_name;type:varchar(100)"` // denormalized fallback RoleLevel string `gorm:"column:role_level;type:text"` FirstName string `gorm:"column:first_name;type:text;index:profiles_name_idx"` LastName string `gorm:"column:last_name;type:text;index:profiles_name_idx"` Company string `gorm:"column:company;type:text;index:profiles_company_idx"` ShortDescription string `gorm:"column:short_description;type:text"` ResumeLink string `gorm:"column:resume_link;type:text"` CTAEnabled bool `gorm:"column:cta_enabled;type:boolean;default:false"` Avatar string `gorm:"column:avatar;type:text"` // About fields (normalized for search) ProfilePicture string `gorm:"column:profile_picture;type:text"` About string `gorm:"column:about;type:text"` // Contact fields (normalized for search) Email string `gorm:"column:email;type:text;index:profiles_email_idx"` Phone string `gorm:"column:phone;type:text"` // PageSetting fields (normalized) VisibilityLevel string `gorm:"column:visibility_level;type:text;default:'public'"` // Complex/non-searchable data stored as JSONB PageSectionOrder json.RawMessage `gorm:"column:page_section_order;type:jsonb"` CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"` UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"` } func (Model) TableName() string { return "profiles" } type SkillModel struct { ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"` ProfileID uuid.UUID `gorm:"column:profile_id;type:uuid;not null;index:skills_profile_id_idx"` SkillName string `gorm:"column:skill_name;type:text;not null;index:skills_name_idx"` Level string `gorm:"column:level;type:text;not null"` CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"` UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"` } func (SkillModel) TableName() string { return "profile_skills" } type SocialLinkModel struct { ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"` ProfileID uuid.UUID `gorm:"column:profile_id;type:uuid;not null;index:social_links_profile_id_idx"` LinkType string `gorm:"column:link_type;type:text;not null"` Link string `gorm:"column:link;type:text;not null"` CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"` UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"` } func (SocialLinkModel) TableName() string { return "profile_social_links" } type AchievementModel struct { ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"` ProfileID uuid.UUID `gorm:"column:profile_id;type:uuid;not null;index:achievements_profile_id_idx"` Title string `gorm:"column:title;type:text;not null"` Value string `gorm:"column:value;type:text;not null"` Enabled bool `gorm:"column:enabled;type:boolean;default:true"` CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"` UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"` } func (AchievementModel) TableName() string { return "profile_achievements" } // RoleModel maps profile_roles table (profiles.role_id references this) type RoleModel struct { ID uuid.UUID `gorm:"column:id;type:uuid;primaryKey"` Title string `gorm:"column:title;type:text;not null"` CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"` UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"` } func (RoleModel) TableName() string { return "profile_roles" }