diff options
author | crupest <crupest@outlook.com> | 2021-05-05 16:18:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-05-05 16:18:33 +0800 |
commit | 7d54e0b8b7ca84488fdcba90c68169a85b4d45c6 (patch) | |
tree | cf2fa58eef25e5bf871d8a71b15ac6694e357b54 /BackEnd/Timeline/Controllers | |
parent | 51e1205d3a9c72a5734a842536630cea69359107 (diff) | |
download | timeline-7d54e0b8b7ca84488fdcba90c68169a85b4d45c6.tar.gz timeline-7d54e0b8b7ca84488fdcba90c68169a85b4d45c6.tar.bz2 timeline-7d54e0b8b7ca84488fdcba90c68169a85b4d45c6.zip |
refactor: ...
Diffstat (limited to 'BackEnd/Timeline/Controllers')
-rw-r--r-- | BackEnd/Timeline/Controllers/BookmarkTimelineController.cs | 13 | ||||
-rw-r--r-- | BackEnd/Timeline/Controllers/HighlightTimelineController.cs | 13 |
2 files changed, 6 insertions, 20 deletions
diff --git a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs index bfbf82f3..551a41e2 100644 --- a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs +++ b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs @@ -92,16 +92,9 @@ namespace Timeline.Controllers [ProducesResponseType(401)]
public async Task<ActionResult> Move([FromBody] HttpBookmarkTimelineMoveRequest request)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(request.Timeline);
- await _service.MoveBookmarkAsync(GetUserId(), timelineId, request.NewPosition!.Value);
- return Ok();
- }
- catch (InvalidBookmarkException)
- {
- return BadRequest(new CommonResponse(ErrorCodes.BookmarkTimelineController.NonBookmark, "You can't move a non-bookmark timeline."));
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(request.Timeline);
+ await _service.MoveBookmarkAsync(GetUserId(), timelineId, request.NewPosition!.Value);
+ return OkWithCommonResponse();
}
}
}
diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs index 24201126..127392db 100644 --- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs +++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs @@ -93,16 +93,9 @@ namespace Timeline.Controllers [ProducesResponseType(403)]
public async Task<ActionResult> Move([FromBody] HttpHighlightTimelineMoveRequest body)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(body.Timeline);
- await _service.MoveHighlightTimelineAsync(timelineId, body.NewPosition!.Value);
- return Ok();
- }
- catch (InvalidHighlightTimelineException)
- {
- return BadRequest(new CommonResponse(ErrorCodes.HighlightTimelineController.NonHighlight, "Can't move a non-highlight timeline."));
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(body.Timeline);
+ await _service.MoveHighlightTimelineAsync(timelineId, body.NewPosition!.Value);
+ return OkWithCommonResponse();
}
}
}
|