~brettgilio/snippet-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Fix user retrieval.

Details
Message ID
<20220728103647.71071-1-brown121407@posteo.ro>
DKIM signature
pass
Download raw message
Patch: +1 -1
Fixes: https://todo.sr.ht/~brettgilio/snippet/11
---
 internal/models/users.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/internal/models/users.go b/internal/models/users.go
index 1cafd53..f91c858 100644
--- a/internal/models/users.go
+++ b/internal/models/users.go
@@ -50,7 +50,7 @@ func (m *UserModel) Insert(username string, email string, password string) (stri
}

func (m *UserModel) Get(id string) (*User, error) {
	stmt := `SELECT id, name, email, hashed_password, created FROM users
	stmt := `SELECT id, username, email, hashed_password, created FROM users
	WHERE id = ?`

	row := m.DB.QueryRow(stmt, id)
-- 
2.37.1
Details
Message ID
<1c3e9d19-26fd-3e5a-b80c-72ae073803c2@c9yh.net>
In-Reply-To
<20220728103647.71071-1-brown121407@posteo.ro> (view parent)
DKIM signature
permerror
Download raw message
On 7/28/2022 5:36 AM, Alexandru-Sergiu Marton wrote:

> Fixes: https://todo.sr.ht/~brettgilio/snippet/11
> ---
>   internal/models/users.go | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/internal/models/users.go b/internal/models/users.go
> index 1cafd53..f91c858 100644
> --- a/internal/models/users.go
> +++ b/internal/models/users.go
> @@ -50,7 +50,7 @@ func (m *UserModel) Insert(username string, email string, password string) (stri
>   }
>   
>   func (m *UserModel) Get(id string) (*User, error) {
> -	stmt := `SELECT id, name, email, hashed_password, created FROM users
> +	stmt := `SELECT id, username, email, hashed_password, created FROM users
>   	WHERE id = ?`
>   
>   	row := m.DB.QueryRow(stmt, id)

Well, I certainly feel silly for not catching this simple error. Thank 
you, Sergiu. Applied.
Reply to thread Export thread (mbox)