aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers/UserDetailController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-29 00:17:45 +0800
committercrupest <crupest@outlook.com>2020-01-29 00:17:45 +0800
commit2750a3df1834c1c6623aa8c653504c7bc12cefd6 (patch)
tree480e4e0fa03f0736cfee97876603fdb87d3fd3bd /Timeline/Controllers/UserDetailController.cs
parent20347298c57e97287f586479fd9a52ba85565406 (diff)
downloadtimeline-2750a3df1834c1c6623aa8c653504c7bc12cefd6.tar.gz
timeline-2750a3df1834c1c6623aa8c653504c7bc12cefd6.tar.bz2
timeline-2750a3df1834c1c6623aa8c653504c7bc12cefd6.zip
...
Diffstat (limited to 'Timeline/Controllers/UserDetailController.cs')
-rw-r--r--Timeline/Controllers/UserDetailController.cs49
1 files changed, 0 insertions, 49 deletions
diff --git a/Timeline/Controllers/UserDetailController.cs b/Timeline/Controllers/UserDetailController.cs
deleted file mode 100644
index 9de9899e..00000000
--- a/Timeline/Controllers/UserDetailController.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System.Threading.Tasks;
-using Timeline.Filters;
-using Timeline.Models.Validation;
-using Timeline.Services;
-using System.ComponentModel.DataAnnotations;
-using Microsoft.AspNetCore.Authorization;
-
-namespace Timeline.Controllers
-{
- [ApiController]
- public class UserDetailController : Controller
- {
- private readonly IUserDetailService _service;
-
- public UserDetailController(IUserDetailService service)
- {
- _service = service;
- }
-
- [HttpGet("users/{username}/nickname")]
- [CatchUserNotExistException]
- public async Task<ActionResult<string>> GetNickname([FromRoute][Username] string username)
- {
- return Ok(await _service.GetNickname(username));
- }
-
- [HttpPut("users/{username}/nickname")]
- [Authorize]
- [SelfOrAdmin]
- [CatchUserNotExistException]
- public async Task<ActionResult> PutNickname([FromRoute][Username] string username,
- [FromBody][StringLength(10, MinimumLength = 1)] string body)
- {
- await _service.SetNickname(username, body);
- return Ok();
- }
-
- [HttpDelete("users/{username}/nickname")]
- [Authorize]
- [SelfOrAdmin]
- [CatchUserNotExistException]
- public async Task<ActionResult> DeleteNickname([FromRoute][Username] string username)
- {
- await _service.SetNickname(username, null);
- return Ok();
- }
- }
-}