fix: update authentication layer for GORM repository integration

- Update auth.go to use new repository interfaces
- Fix test compilation errors in auth_test.go
- Maintain compatibility with existing authentication flows
- Update mock implementations for repository pattern

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit was merged in pull request #5.
This commit is contained in:
2025-06-30 22:09:36 +12:00
parent 88c996a383
commit b5ea2095e4
2 changed files with 118 additions and 14 deletions

View File

@@ -2,12 +2,13 @@ package auth
import (
"errors"
"testing"
"time"
"github.com/openaccounting/oa-server/core/model/db"
"github.com/openaccounting/oa-server/core/model/types"
"github.com/openaccounting/oa-server/core/util"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
type TdUser struct {
@@ -28,18 +29,19 @@ func (td *TdUser) GetVerifiedUserByEmail(email string) (*types.User, error) {
func (td *TdUser) GetVerifiedUserByEmail_1(email string) (*types.User, error) {
return &types.User{
"1",
time.Unix(0, 0),
time.Unix(0, 0),
"John",
"Doe",
"johndoe@email.com",
"password",
"$2a$10$KrtvADe7jwrmYIe3GXFbNupOQaPIvyOKeng5826g4VGOD47TpAisG",
true,
"",
false,
"",
Id: "1",
Inserted: time.Unix(0, 0),
Updated: time.Unix(0, 0),
FirstName: "John",
LastName: "Doe",
Email: "johndoe@email.com",
Password: "password",
PasswordHash: "$2a$10$KrtvADe7jwrmYIe3GXFbNupOQaPIvyOKeng5826g4VGOD47TpAisG",
AgreeToTerms: true,
PasswordReset: "",
EmailVerified: false,
EmailVerifyCode: "",
SignupSource: "",
}, nil
}