Skip to content

Commit

Permalink
Merge pull request #34 from fy23-gw-gackathon/fix/getuser_typo
Browse files Browse the repository at this point in the history
fix: fix typo of OrganizationUser in getUsers
  • Loading branch information
HarrisonEagle committed May 13, 2023
2 parents 2da457e + 8571354 commit 7460adb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions infrastructure/persistence/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package persistence

import (
"errors"
"net/http"
"strings"

"github.com/fy23-gw-gackathon/reportify-backend/entity"
"github.com/fy23-gw-gackathon/reportify-backend/infrastructure/driver"
"github.com/fy23-gw-gackathon/reportify-backend/infrastructure/persistence/model"
"github.com/go-sql-driver/mysql"
"golang.org/x/net/context"
"gorm.io/gorm"
"net/http"
"strings"
)

type UserPersistence struct {
Expand All @@ -23,7 +24,7 @@ func NewUserPersistence(client *driver.CognitoClient) *UserPersistence {
func (p UserPersistence) GetUser(ctx context.Context, userID string) (*entity.User, error) {
db, _ := ctx.Value(driver.TxKey).(*gorm.DB)
var record *model.User
if err := db.Preload("OrganizationUser").First(&record, userID).Error; err != nil {
if err := db.Preload("OrganizationUsers").First(&record, "id = ?", userID).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, err
}
Expand Down

0 comments on commit 7460adb

Please sign in to comment.