aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-01-07 20:36:57 +0800
committercrupest <crupest@outlook.com>2021-01-07 20:36:57 +0800
commit191b92a161c4fdad532dbf471f5c33f8f4a97a23 (patch)
treeed5b70602431fefbddb4b33781e778fde303b1b5 /BackEnd/Timeline/Controllers/HighlightTimelineController.cs
parent2ec9433d0d9547383a7431e97c0577ffcc98ea97 (diff)
downloadtimeline-191b92a161c4fdad532dbf471f5c33f8f4a97a23.tar.gz
timeline-191b92a161c4fdad532dbf471f5c33f8f4a97a23.tar.bz2
timeline-191b92a161c4fdad532dbf471f5c33f8f4a97a23.zip
refactor: Highlight and bookmark service now use timeline id.
Diffstat (limited to 'BackEnd/Timeline/Controllers/HighlightTimelineController.cs')
-rw-r--r--BackEnd/Timeline/Controllers/HighlightTimelineController.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
index 685ec16f..cc19cada 100644
--- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
+++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
@@ -51,12 +51,13 @@ namespace Timeline.Controllers
[ProducesResponseType(400)]
[ProducesResponseType(401)]
[ProducesResponseType(403)]
- public async Task<ActionResult> Put([GeneralTimelineName] string timeline)
+ public async Task<ActionResult<CommonPutResponse>> Put([GeneralTimelineName] string timeline)
{
try
{
- await _service.AddHighlightTimeline(timeline, this.GetUserId());
- return Ok();
+ var timelineId = await _timelineService.GetTimelineIdByName(timeline);
+ var create = await _service.AddHighlightTimeline(timelineId, this.GetUserId());
+ return CommonPutResponse.Create(create);
}
catch (TimelineNotExistException)
{
@@ -74,12 +75,13 @@ namespace Timeline.Controllers
[ProducesResponseType(400)]
[ProducesResponseType(401)]
[ProducesResponseType(403)]
- public async Task<ActionResult> Delete([GeneralTimelineName] string timeline)
+ public async Task<ActionResult<CommonDeleteResponse>> Delete([GeneralTimelineName] string timeline)
{
try
{
- await _service.RemoveHighlightTimeline(timeline, this.GetUserId());
- return Ok();
+ var timelineId = await _timelineService.GetTimelineIdByName(timeline);
+ var delete = await _service.RemoveHighlightTimeline(timelineId, this.GetUserId());
+ return CommonDeleteResponse.Create(delete);
}
catch (TimelineNotExistException)
{
@@ -100,7 +102,8 @@ namespace Timeline.Controllers
{
try
{
- await _service.MoveHighlightTimeline(body.Timeline, body.NewPosition!.Value);
+ var timelineId = await _timelineService.GetTimelineIdByName(body.Timeline);
+ await _service.MoveHighlightTimeline(timelineId, body.NewPosition!.Value);
return Ok();
}
catch (TimelineNotExistException)