Fix Non-Specific Record Id's
This commit is contained in:
parent
95cdf8fc3b
commit
941f7b49be
@ -40,7 +40,7 @@ namespace qtc_api.Controllers
|
||||
{
|
||||
var user = new ServiceResponse<UserInformationDto>();
|
||||
|
||||
string recordId = $"User_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
string recordId = $"User_{id}_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
user = await cache.GetRecordAsync<ServiceResponse<UserInformationDto>>(recordId);
|
||||
|
||||
if (user == null)
|
||||
@ -101,7 +101,7 @@ namespace qtc_api.Controllers
|
||||
var updatedUser = await _userService.UpdateUserInfo(user);
|
||||
|
||||
// always try to overwrite cache when updating user info
|
||||
string recordId = $"User_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
string recordId = $"User_{user.Id}_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
await cache.SetRecordAsync(recordId, updatedUser);
|
||||
|
||||
return Ok(updatedUser);
|
||||
@ -136,7 +136,7 @@ namespace qtc_api.Controllers
|
||||
var response = await _userService.UpdateUserPic(userId, file);
|
||||
|
||||
// always try to overwrite cache when updating pfp
|
||||
string recordId = $"UserPfp_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
string recordId = $"UserPfp_{userId}_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
using(var stream = file.OpenReadStream())
|
||||
{
|
||||
using(var ms = new MemoryStream())
|
||||
@ -163,7 +163,7 @@ namespace qtc_api.Controllers
|
||||
[Authorize]
|
||||
public async Task<ActionResult> GetUserProfilePicture(string userId)
|
||||
{
|
||||
string recordId = $"UserPfp_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
string recordId = $"UserPfp_{userId}_{DateTime.Now.ToString("yyyyMMdd_hhmm")}";
|
||||
byte[] pfpBytes = await cache.GetImageAsync(recordId);
|
||||
|
||||
var result = new ServiceResponse<FileContentResult>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user