Skip to content

Commit

Permalink
Merge pull request #77 from KnightHacks/development
Browse files Browse the repository at this point in the history
fixed issue with scanning pronounId when null in database
  • Loading branch information
LockedThread authored Jan 5, 2023
2 parents 578abb5 + 2a6318d commit 634ac67
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions repository/database/update_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"github.com/KnightHacks/knighthacks_shared/database"
"github.com/KnightHacks/knighthacks_shared/utils"
"github.com/KnightHacks/knighthacks_users/graph/model"
"github.com/KnightHacks/knighthacks_users/repository"
"github.com/jackc/pgx/v5"
Expand Down Expand Up @@ -429,7 +430,7 @@ type Scannable interface {
}

func ScanUser[T Scannable](user *model.User, scannable T) (*int, error) {
var pronounId int
var pronounId int32
var userIdInt int
err := scannable.Scan(
&userIdInt,
Expand All @@ -452,7 +453,7 @@ func ScanUser[T Scannable](user *model.User, scannable T) (*int, error) {
if pronounId == 0 {
return nil, nil
}
return &pronounId, nil
return utils.Ptr(int(pronounId)), nil
}

func (r *DatabaseRepository) DeleteAPIKey(ctx context.Context, id string) error {
Expand Down

0 comments on commit 634ac67

Please sign in to comment.