fix(shifts): expose ExternalUserId in ShiftSignupDto to fix frontend signup state
This commit is contained in:
@@ -41,6 +41,20 @@ public class MemberSyncService
|
||||
}
|
||||
|
||||
var email = httpContext.User.FindFirst("email")?.Value ?? httpContext.User.FindFirst("preferred_username")?.Value ?? "unknown@example.com";
|
||||
|
||||
// If not found by ExternalUserId, try to find by Email (for seeded users)
|
||||
var memberByEmail = await _context.Members
|
||||
.FirstOrDefaultAsync(m => m.Email == email && m.TenantId == tenantId);
|
||||
|
||||
if (memberByEmail != null)
|
||||
{
|
||||
// Update the seeded user with the real ExternalUserId
|
||||
memberByEmail.ExternalUserId = externalUserId;
|
||||
memberByEmail.UpdatedAt = DateTimeOffset.UtcNow;
|
||||
await _context.SaveChangesAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
var name = httpContext.User.FindFirst("name")?.Value ?? email.Split('@')[0];
|
||||
|
||||
var roleClaim = httpContext.User.FindFirst(System.Security.Claims.ClaimTypes.Role)?.Value ?? "Member";
|
||||
|
||||
Reference in New Issue
Block a user