aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers/FeedController.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-26 10:55:25 +0200
committertranstrike <transtrike@gmail.com>2021-01-26 10:55:25 +0200
commitd2bc08c0dcd6f0dc0822333bbb00c9fc851f49cb (patch)
tree0987a60a73a13ac7894ca01a1edc3274327d5cbe /src/DevHive.Web/Controllers/FeedController.cs
parentf910a2a63cb83b35c6589591400a69c8f7f7917c (diff)
downloadDevHive-d2bc08c0dcd6f0dc0822333bbb00c9fc851f49cb.tar
DevHive-d2bc08c0dcd6f0dc0822333bbb00c9fc851f49cb.tar.gz
DevHive-d2bc08c0dcd6f0dc0822333bbb00c9fc851f49cb.zip
Brief testing of GetPost
Diffstat (limited to 'src/DevHive.Web/Controllers/FeedController.cs')
-rw-r--r--src/DevHive.Web/Controllers/FeedController.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/DevHive.Web/Controllers/FeedController.cs b/src/DevHive.Web/Controllers/FeedController.cs
new file mode 100644
index 0000000..7d0269b
--- /dev/null
+++ b/src/DevHive.Web/Controllers/FeedController.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Threading.Tasks;
+using AutoMapper;
+using DevHive.Services.Interfaces;
+using DevHive.Services.Models;
+using DevHive.Web.Models.Feed;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DevHive.Web.Controllers
+{
+ [ApiController]
+ [Route("/api/[controller]")]
+ public class FeedController
+ {
+ private readonly IFeedService _feedService;
+ private readonly IMapper _mapper;
+
+ public FeedController(IFeedService feedService, IMapper mapper)
+ {
+ this._feedService = feedService;
+ this._mapper = mapper;
+ }
+
+ [HttpGet]
+ public async Task<IActionResult> GetPosts(Guid userId, [FromBody] GetPageWebModel getPageWebModel)
+ {
+ GetPageServiceModel getPageServiceModel = this._mapper.Map<GetPageServiceModel>(getPageWebModel);
+ getPageServiceModel.UserId = userId;
+
+ ReadPageServiceModel readPageServiceModel = await this._feedService.GetPage(getPageServiceModel);
+ ReadPageWebModel readPageWebModel = this._mapper.Map<ReadPageWebModel>(readPageServiceModel);
+
+ return new OkObjectResult(readPageWebModel);
+ }
+ }
+}