diff --git a/src/Examples/Docs/Content/PublicAccessExample/CustomBasicContent.cs b/src/Examples/Docs/Content/PublicAccessExample/CustomBasicContent.cs index 64829bbb..28466643 100644 --- a/src/Examples/Docs/Content/PublicAccessExample/CustomBasicContent.cs +++ b/src/Examples/Docs/Content/PublicAccessExample/CustomBasicContent.cs @@ -19,46 +19,39 @@ namespace Examples.Docs.Content.PublicAccessExample; [GraphQLDescription("Represents an extended content item.")] public class CustomBasicContent : BasicContent { - private readonly IPublicAccessService _publicAccessService; - private readonly IContentService _contentService; - private readonly IUmbracoContextAccessor _context; - private readonly ILogger _logger; - [GraphQLDescription("Gets the restrict public access settings of the content item.")] public PermissionsModel? Permissions { get; set; } public CustomBasicContent(CreateContent createContent, IPropertyFactory propertyFactory, IContentTypeFactory contentTypeFactory, IContentFactory contentFactory, IVariationContextAccessor variationContextAccessor, IPublicAccessService publicAccessService, IContentService contentService, IUmbracoContextAccessor context, ILogger logger) : base(createContent, propertyFactory, contentTypeFactory, contentFactory, variationContextAccessor) { ArgumentNullException.ThrowIfNull(createContent); - - _publicAccessService = publicAccessService; - _contentService = contentService; - _context = context; - _logger = logger; + ArgumentNullException.ThrowIfNull(logger); + ArgumentNullException.ThrowIfNull(publicAccessService); + ArgumentNullException.ThrowIfNull(contentService); if (createContent.Content == null) { - _logger.LogWarning("Content is null"); + logger.LogWarning("Content is null"); return; } - IContent? content = _contentService.GetById(createContent.Content.Id); + IContent? content = contentService.GetById(createContent.Content.Id); if (content == null) { - _logger.LogWarning("Content from content service is null. Id: {ContentId}", createContent.Content.Id); + logger.LogWarning("Content from content service is null. Id: {ContentId}", createContent.Content.Id); return; } - PublicAccessEntry? entry = _publicAccessService.GetEntryForContent(content); + PublicAccessEntry? entry = publicAccessService.GetEntryForContent(content); if (entry != null) { - IUmbracoContext cache = _context.GetRequiredUmbracoContext(); + IUmbracoContext cache = context.GetRequiredUmbracoContext(); if (cache.Content == null) { - _logger.LogWarning("Content cache is null on Umbraco context"); + logger.LogWarning("Content cache is null on Umbraco context"); return; } diff --git a/src/Nikcio.UHeadless.Content/Queries/ContentAllQuery.cs b/src/Nikcio.UHeadless.Content/Queries/ContentAllQuery.cs index 04af8036..593ff60b 100644 --- a/src/Nikcio.UHeadless.Content/Queries/ContentAllQuery.cs +++ b/src/Nikcio.UHeadless.Content/Queries/ContentAllQuery.cs @@ -41,7 +41,7 @@ public class ContentAllQuery return contentRepository.GetContentList(x => { return x?.GetAtRoot(preview, culture).SelectMany(content => content.Descendants(culture)) - .Concat(x?.GetAtRoot(preview, culture) ?? Enumerable.Empty()); + .Concat(x.GetAtRoot(preview, culture) ?? Enumerable.Empty()); }, culture, segment, fallback?.ToFallback()); } -} \ No newline at end of file +}