|
8 | 8 | using Umbraco.Cms.Integrations.Automation.Zapier.Configuration;
|
9 | 9 | using Asp.Versioning;
|
10 | 10 | using Microsoft.AspNetCore.Mvc;
|
| 11 | +using Umbraco.Extensions; |
11 | 12 |
|
12 | 13 | namespace Umbraco.Cms.Integrations.Automation.Zapier.Api.Management.Controllers
|
13 | 14 | {
|
@@ -45,24 +46,20 @@ public PollingController(
|
45 | 46 | [ProducesResponseType(StatusCodes.Status404NotFound)]
|
46 | 47 | public IActionResult GetContentByType(string alias)
|
47 | 48 | {
|
48 |
| - //if (!IsAccessValid()) |
49 |
| - // return NotFound(); |
| 49 | + if (!IsAccessValid()) |
| 50 | + return NotFound(); |
50 | 51 |
|
51 |
| - //var contentType = _contentTypeService.Get(alias); |
52 |
| - //if (contentType == null) |
53 |
| - // return Ok(new List<Dictionary<string, string>>()); |
| 52 | + var contentType = _contentTypeService.Get(alias); |
| 53 | + if (contentType == null) |
| 54 | + return Ok(new List<Dictionary<string, string>>()); |
54 | 55 |
|
55 |
| - //var contentItems = _umbracoHelper.ContentAtXPath("//" + alias) |
56 |
| - // .OrderByDescending(p => p.UpdateDate); |
| 56 | + var contentItems = _umbracoHelper.ContentAtRoot().DescendantsOrSelfOfType(alias) |
| 57 | + .OrderByDescending(p => p.UpdateDate); |
| 58 | + var contentTypeDictionary = new List<Dictionary<string, string>>{ |
| 59 | + _zapierContentService.GetContentTypeDictionary(contentType, contentItems.FirstOrDefault()) |
| 60 | + }; |
57 | 61 |
|
58 |
| - //return Ok(new List<Dictionary<string, string>> |
59 |
| - // { |
60 |
| - // _zapierContentService.GetContentTypeDictionary(contentType, contentItems.FirstOrDefault()) |
61 |
| - // }); |
62 |
| - |
63 |
| - return Ok(); |
| 62 | + return Ok(contentTypeDictionary); |
64 | 63 | }
|
65 |
| - |
66 |
| - |
67 | 64 | }
|
68 | 65 | }
|
0 commit comments