aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'BackEnd/Timeline/Controllers/HighlightTimelineController.cs')
-rw-r--r--BackEnd/Timeline/Controllers/HighlightTimelineController.cs34
1 files changed, 8 insertions, 26 deletions
diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
index 4e739056..e73bc7a9 100644
--- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
+++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
@@ -43,7 +43,7 @@ namespace Timeline.Controllers
[ProducesResponseType(200)]
public async Task<ActionResult<List<HttpTimeline>>> List()
{
- var ids = await _service.GetHighlightTimelines();
+ var ids = await _service.GetHighlightTimelinesAsync();
var timelines = await _timelineService.GetTimelineList(ids);
return await Map(timelines);
}
@@ -60,16 +60,9 @@ namespace Timeline.Controllers
[ProducesResponseType(403)]
public async Task<ActionResult<CommonPutResponse>> Put([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var create = await _service.AddHighlightTimeline(timelineId, this.GetUserId());
- return CommonPutResponse.Create(create);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var create = await _service.AddHighlightTimelineAsync(timelineId, this.GetUserId());
+ return CommonPutResponse.Create(create);
}
/// <summary>
@@ -84,16 +77,9 @@ namespace Timeline.Controllers
[ProducesResponseType(403)]
public async Task<ActionResult<CommonDeleteResponse>> Delete([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var delete = await _service.RemoveHighlightTimeline(timelineId, this.GetUserId());
- return CommonDeleteResponse.Create(delete);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var delete = await _service.RemoveHighlightTimelineAsync(timelineId, this.GetUserId());
+ return CommonDeleteResponse.Create(delete);
}
/// <summary>
@@ -110,13 +96,9 @@ namespace Timeline.Controllers
try
{
var timelineId = await _timelineService.GetTimelineIdByNameAsync(body.Timeline);
- await _service.MoveHighlightTimeline(timelineId, body.NewPosition!.Value);
+ await _service.MoveHighlightTimelineAsync(timelineId, body.NewPosition!.Value);
return Ok();
}
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
catch (InvalidHighlightTimelineException)
{
return BadRequest(new CommonResponse(ErrorCodes.HighlightTimelineController.NonHighlight, "Can't move a non-highlight timeline."));