You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
refactor: update data access layer to use GORM repositories
- Replace SQL-based queries with GORM repository calls - Update all model interfaces to use repository pattern - Fix compilation errors in core/model/ files - Update mocks to match new repository interfaces - Modify API handlers to use new repository layer - Maintain backward compatibility with existing interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,7 @@ func (model *Model) CreateUser(user *types.User) error {
|
||||
return errors.New("email required")
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(".+@.+\\..+")
|
||||
re := regexp.MustCompile(`.+@.+\..+`)
|
||||
|
||||
if re.FindString(user.Email) == "" {
|
||||
return errors.New("invalid email address")
|
||||
@@ -47,7 +47,7 @@ func (model *Model) CreateUser(user *types.User) error {
|
||||
return errors.New("password required")
|
||||
}
|
||||
|
||||
if user.AgreeToTerms != true {
|
||||
if !user.AgreeToTerms {
|
||||
return errors.New("must agree to terms")
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ func (model *Model) ResetPassword(email string) error {
|
||||
|
||||
if err != nil {
|
||||
// Don't send back error so people can't try to find user accounts
|
||||
log.Printf("Invalid email for reset password " + email)
|
||||
log.Printf("Invalid email for reset password %s", email)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ func (model *Model) ConfirmResetPassword(password string, code string) (*types.U
|
||||
user, err := model.db.GetUserByResetCode(code)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.New("Invalid code")
|
||||
return nil, errors.New("invalid code")
|
||||
}
|
||||
|
||||
passwordHash, err := model.bcrypt.GenerateFromPassword([]byte(password), model.bcrypt.GetDefaultCost())
|
||||
|
||||
Reference in New Issue
Block a user