aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'Timeline/Controllers')
-rw-r--r--Timeline/Controllers/PersonalTimelineController.cs5
-rw-r--r--Timeline/Controllers/UserController.cs10
2 files changed, 8 insertions, 7 deletions
diff --git a/Timeline/Controllers/PersonalTimelineController.cs b/Timeline/Controllers/PersonalTimelineController.cs
index 27618c41..11353bb5 100644
--- a/Timeline/Controllers/PersonalTimelineController.cs
+++ b/Timeline/Controllers/PersonalTimelineController.cs
@@ -77,14 +77,15 @@ namespace Timeline.Controllers
[HttpPatch("users/{username}/timeline")]
[Authorize]
- public async Task<ActionResult> TimelinePatch([FromRoute][Username] string username, [FromBody] TimelinePatchRequest body)
+ public async Task<ActionResult<BaseTimelineInfo>> TimelinePatch([FromRoute][Username] string username, [FromBody] TimelinePatchRequest body)
{
if (!this.IsAdministrator() && !(User.Identity.Name == username))
{
return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
await _service.ChangeProperty(username, body);
- return Ok();
+ var timeline = await _service.GetTimeline(username);
+ return Ok(timeline);
}
[HttpPut("users/{username}/timeline/members/{member}")]
diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs
index 26e63f63..a3e8d816 100644
--- a/Timeline/Controllers/UserController.cs
+++ b/Timeline/Controllers/UserController.cs
@@ -55,14 +55,14 @@ namespace Timeline.Controllers
}
[HttpPatch("users/{username}"), Authorize]
- public async Task<ActionResult> Patch([FromBody] UserPatchRequest body, [FromRoute][Username] string username)
+ public async Task<ActionResult<UserInfo>> Patch([FromBody] UserPatchRequest body, [FromRoute][Username] string username)
{
if (this.IsAdministrator())
{
try
{
- await _userService.ModifyUser(username, _mapper.Map<User>(body));
- return Ok();
+ var user = await _userService.ModifyUser(username, _mapper.Map<User>(body));
+ return Ok(ConvertToUserInfo(user));
}
catch (UserNotExistException e)
{
@@ -92,8 +92,8 @@ namespace Timeline.Controllers
return StatusCode(StatusCodes.Status403Forbidden,
ErrorResponse.Common.CustomMessage_Forbid(UserController_Patch_Forbid_Administrator));
- await _userService.ModifyUser(this.GetUserId(), _mapper.Map<User>(body));
- return Ok();
+ var user = await _userService.ModifyUser(this.GetUserId(), _mapper.Map<User>(body));
+ return Ok(ConvertToUserInfo(user));
}
}