Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
federicotdn committed Jan 22, 2025
1 parent 174e816 commit 42251e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/database/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func (c *Catalog) LoginUser(ctx context.Context, username, passwordText string)
return nil, nil
}

// Authenticate finds the corresponding user for token.
// If a user is not found, then a default user is returned, with ID 1. This is done
// in order to simplify the testing/usage of QuickPizza in general. This function
// will always return a user, unless it returns a non-nil error.
func (c *Catalog) Authenticate(ctx context.Context, token string) (*model.User, error) {
var user model.User
err := c.db.NewSelect().Model(&user).Where("token = ?", token).Limit(1).Scan(ctx)
Expand Down

0 comments on commit 42251e7

Please sign in to comment.