From 97e6ac51ac4df58cd1229e7974d2b846b192558a Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 7 Jan 2021 20:12:00 +0800 Subject: refactor: Make mapper a service. Fix #202. --- BackEnd/Timeline/Controllers/HighlightTimelineController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'BackEnd/Timeline/Controllers/HighlightTimelineController.cs') diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs index 76650b00..685ec16f 100644 --- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs +++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs @@ -1,5 +1,4 @@ -using AutoMapper; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Threading.Tasks; using Timeline.Auth; @@ -20,11 +19,13 @@ namespace Timeline.Controllers { private readonly IHighlightTimelineService _service; private readonly ITimelineService _timelineService; + private readonly TimelineMapper _timelineMapper; - public HighlightTimelineController(IHighlightTimelineService service, ITimelineService timelineService) + public HighlightTimelineController(IHighlightTimelineService service, ITimelineService timelineService, TimelineMapper timelineMapper) { _service = service; _timelineService = timelineService; + _timelineMapper = timelineMapper; } /// @@ -37,7 +38,7 @@ namespace Timeline.Controllers { var ids = await _service.GetHighlightTimelines(); var timelines = await _timelineService.GetTimelineList(ids); - return timelines.MapToHttp(Url); + return await _timelineMapper.MapToHttp(timelines, Url); } /// -- cgit v1.2.3