Skip to content

Commit 32713f1

Browse files
fix: mapping users by twitch username as well as email
close #43
1 parent 7c34d16 commit 32713f1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Nullinside.Api.Model/Shared/UserHelpers.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public static class UserHelpers {
2828
string bearerToken = AuthUtils.GenerateBearerToken();
2929
try {
3030
User? existing = await dbContext.Users.FirstOrDefaultAsync(u => u.Email == email, token);
31+
if (null == existing && !string.IsNullOrWhiteSpace(twitchUsername)) {
32+
existing = await dbContext.Users.FirstOrDefaultAsync(u => u.TwitchUsername == twitchUsername, token);
33+
}
34+
3135
if (null == existing) {
3236
dbContext.Users.Add(new User {
3337
Email = email,

0 commit comments

Comments
 (0)