fix(api): заполнение данных о пользователе в кэше

This commit is contained in:
Mikhail Trubnikov
2023-12-05 11:25:07 +10:00
parent f5ce75598c
commit 74d91a0315

View File

@@ -66,11 +66,19 @@ namespace PARR.API.Services.Implementations
var cacheData = new UserCache
{
UserIp = ipAddress,
Roles = roles,
Name = user!.Name,
Description = user.Description ?? string.Empty
Roles = roles
};
if (host != null)
cacheData.Name = host.Ek;
if (user != null)
{
cacheData.Name = user.Name + host != null ? $", {host!.Ek}" : string.Empty;
cacheData.Description = user.Description ?? string.Empty;
}
await cacheService.SetCachedDataAsync(GetAllowKey(ipAddress), cacheData, userCacheSettings.UserCacheTtl);
return cacheData;