commit
d1ec74fab4
|
|
@ -13,8 +13,6 @@ public interface IUserIdentity
|
|||
/// </summary>
|
||||
string UserLanguage { get; }
|
||||
string? Phone { get; }
|
||||
string? AffiliateId { get; }
|
||||
string? EmployeeId { get; }
|
||||
string Type { get; }
|
||||
string Role { get; }
|
||||
string? RegionCode { get; }
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class DistributedLocker
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<T> Lock<T>(string resource, Func<T> action, int timeoutInSeconds = 30)
|
||||
public async Task Lock(string resource, Action action, int timeoutInSeconds = 30)
|
||||
{
|
||||
await ConnectToRedis();
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ public class DistributedLocker
|
|||
Serilog.Log.Logger.Error($"Acquire lock for {resource} failed due to after {timeout}s timeout.");
|
||||
|
||||
}
|
||||
return action();
|
||||
action();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,18 +70,15 @@ public class UserIdentity : IUserIdentity
|
|||
[JsonPropertyName("phone")]
|
||||
public string? Phone => _claims?.FirstOrDefault(x => x.Type == "phone")?.Value;
|
||||
|
||||
[JsonPropertyName("affiliateId")]
|
||||
public string? AffiliateId => _claims?.FirstOrDefault(x => x.Type == "affiliateId")?.Value;
|
||||
|
||||
[JsonPropertyName("employeeId")]
|
||||
public string? EmployeeId => _claims?.FirstOrDefault(x => x.Type == "employeeId")?.Value;
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
public string? Type => _claims?.FirstOrDefault(x => x.Type == "type")?.Value;
|
||||
|
||||
[JsonPropertyName("role")]
|
||||
public string? Role => _claims?.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value;
|
||||
|
||||
[JsonPropertyName("regionCode")]
|
||||
public string? RegionCode => _claims?.FirstOrDefault(x => x.Type == "regionCode")?.Value;
|
||||
/// <summary>
|
||||
/// US, CA, etc.
|
||||
/// </summary>
|
||||
[JsonPropertyName("region_code")]
|
||||
public string? RegionCode => _claims?.FirstOrDefault(x => x.Type == "region_code")?.Value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue