package models import ( "iris-test/app/lib/auth" "iris-test/app/lib/cfg" "time" ) type User struct { Id string `gorm:"type(uuid);unique"` Email string `gorm:"unique"` FirstName string LastName string Password string IsActive bool CreatedAt time.Time UpdatedAt time.Time } func (u *User) TableName() string { return "users" } func (u *User) SetPassword(password string) error { secretKey := cfg.Config.Application.SecretKey hashedPassword, err := auth.HashPassword(password, secretKey) if err != nil { return err } u.Password = hashedPassword return nil }