fix: allow for alternate usernames on conflict (#4614)

This commit is contained in:
Jon Ayers
2022-10-17 22:07:11 -05:00
committed by GitHub
parent 3c40698033
commit 61683f1961
5 changed files with 192 additions and 49 deletions
@@ -2221,6 +2221,12 @@ func (q *fakeQuerier) InsertUser(_ context.Context, arg database.InsertUserParam
q.mutex.Lock()
defer q.mutex.Unlock()
for _, user := range q.users {
if user.Username == arg.Username && !user.Deleted {
return database.User{}, errDuplicateKey
}
}
user := database.User{
ID: arg.ID,
Email: arg.Email,