Skip to content

Commit aa11ff2

Browse files
committed
Update PollingController.cs
1 parent e7a1763 commit aa11ff2

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/Umbraco.Cms.Integrations.Automation.Zapier/Api/Management/Controllers/PollingController.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Umbraco.Cms.Integrations.Automation.Zapier.Configuration;
99
using Asp.Versioning;
1010
using Microsoft.AspNetCore.Mvc;
11+
using Umbraco.Extensions;
1112

1213
namespace Umbraco.Cms.Integrations.Automation.Zapier.Api.Management.Controllers
1314
{
@@ -45,24 +46,20 @@ public PollingController(
4546
[ProducesResponseType(StatusCodes.Status404NotFound)]
4647
public IActionResult GetContentByType(string alias)
4748
{
48-
//if (!IsAccessValid())
49-
// return NotFound();
49+
if (!IsAccessValid())
50+
return NotFound();
5051

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>>());
5455

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+
};
5761

58-
//return Ok(new List<Dictionary<string, string>>
59-
// {
60-
// _zapierContentService.GetContentTypeDictionary(contentType, contentItems.FirstOrDefault())
61-
// });
62-
63-
return Ok();
62+
return Ok(contentTypeDictionary);
6463
}
65-
66-
6764
}
6865
}

0 commit comments

Comments
 (0)