diff options
author | crupest <crupest@outlook.com> | 2021-02-10 02:03:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-10 02:03:06 +0800 |
commit | 253b06dfaa091d986a8714c081fd1e01679f538a (patch) | |
tree | 9200a7f6607889fcfb13b7ba14cc30db54fe3499 /BackEnd/Timeline/Controllers/UserAvatarController.cs | |
parent | bc2d6676276ea85a974f57f96b038e35e6ce7460 (diff) | |
download | timeline-253b06dfaa091d986a8714c081fd1e01679f538a.tar.gz timeline-253b06dfaa091d986a8714c081fd1e01679f538a.tar.bz2 timeline-253b06dfaa091d986a8714c081fd1e01679f538a.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Controllers/UserAvatarController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/UserAvatarController.cs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/BackEnd/Timeline/Controllers/UserAvatarController.cs b/BackEnd/Timeline/Controllers/UserAvatarController.cs index f3b7fff8..8ac2d21a 100644 --- a/BackEnd/Timeline/Controllers/UserAvatarController.cs +++ b/BackEnd/Timeline/Controllers/UserAvatarController.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks;
using Timeline.Filters;
using Timeline.Helpers;
+using Timeline.Helpers.Cache;
using Timeline.Models;
using Timeline.Models.Http;
using Timeline.Models.Validation;
@@ -63,11 +64,7 @@ namespace Timeline.Controllers return NotFound(ErrorResponse.UserCommon.NotExist());
}
- return await DataCacheHelper.GenerateActionResult(this, () => _service.GetAvatarETag(id), async () =>
- {
- var avatar = await _service.GetAvatar(id);
- return avatar.ToCacheableData();
- });
+ return await DataCacheHelper.GenerateActionResult(this, () => _service.GetAvatarDigest(id), () => _service.GetAvatar(id));
}
/// <summary>
@@ -105,11 +102,7 @@ namespace Timeline.Controllers try
{
- var etag = await _service.SetAvatar(id, new Avatar
- {
- Data = body.Data,
- Type = body.ContentType
- });
+ var etag = await _service.SetAvatar(id, body);
_logger.LogInformation(Log.Format(LogPutSuccess,
("Username", username), ("Mime Type", Request.ContentType)));
@@ -166,7 +159,7 @@ namespace Timeline.Controllers return BadRequest(ErrorResponse.UserCommon.NotExist());
}
- await _service.SetAvatar(id, null);
+ await _service.DeleteAvatar(id);
return Ok();
}
}
|