Skip to content

Commit

Permalink
GH-69 :: remove unused code from content item retriever service, regi…
Browse files Browse the repository at this point in the history
…ster generic version
  • Loading branch information
kentico-matthews committed Sep 4, 2024
1 parent 37f0185 commit 01e77de
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,6 @@ public ContentItemRetrieverService(
this.websiteChannelContext = websiteChannelContext;
}

private async Task<IEnumerable<IContentItemFieldsSource>> RetrieveContentItems(Action<ContentQueryParameters> contentQueryParameters,
Action<ContentTypesQueryParameters> contentTypesQueryParameters)
{
var builder = new ContentItemQueryBuilder();

builder.ForContentTypes(contentTypesQueryParameters)
.Parameters(contentQueryParameters);

return await contentQueryExecutor.GetMappedResult<IContentItemFieldsSource>(builder);
}

private async Task<IEnumerable<IWebPageFieldsSource>> RetrieveWebPages(Action<ContentQueryParameters> parameters)
{
var builder = new ContentItemQueryBuilder();
Expand All @@ -209,22 +198,6 @@ private async Task<IEnumerable<IWebPageFieldsSource>> RetrieveWebPages(Action<Co
}

/// <summary>
/// Retrieves the IWebPageFieldsSource of a web page item by Id.
/// </summary>
/// <param name="webPageItemId">the Id of the web page item</param>
/// <returns><see cref="IWebPageFieldsSource"/> object containing generic <see cref="WebPageFields"/> for the item</returns>
public async Task<IWebPageFieldsSource?> RetrieveWebPageById(
int webPageItemId)
{
var pages = await RetrieveWebPages(parameters =>
{
parameters.Where(where => where.WhereEquals(nameof(WebPageFields.WebPageItemID), webPageItemId));
});

return pages.FirstOrDefault();
}

/// <summary>
/// Retrieves the IWebPageFieldsSource of a web page item by Guid.
/// </summary>
/// <param name="webPageItemGuid">the Guid of the web page item</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public Task<IEnumerable<T>> RetrieveReusableContentItems(

public interface IContentItemRetrieverService
{
public Task<IWebPageFieldsSource?> RetrieveWebPageById(int webPageItemId);

public Task<IWebPageFieldsSource?> RetrieveWebPageByGuid(Guid webPageItemGuid);

}
3 changes: 2 additions & 1 deletion src/TrainingGuides.Web/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public static void AddTrainingGuidesServices(this IServiceCollection services)
{
services.AddSingleton<IHttpRequestService, HttpRequestService>();
services.AddSingleton<IArticlePageService, ArticlePageService>();

services.AddSingleton<IContentItemRetrieverService, ContentItemRetrieverService>();

services.AddTransient(typeof(IContentItemRetrieverService<>), typeof(ContentItemRetrieverService<>));
}
}

0 comments on commit 01e77de

Please sign in to comment.