* Run code cleanup * Run dotnet format * Start manual fixes * Manual fixing of warnings * Fix nullability in columnalias * Fix tests * Fix up after merge * Start updating after review * Update editorconfig to contain new static & const rules * Fix up editorconfig to not contain duplicate rules * Fix up static member names * Fix up according to review * Update src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.DistributedCache.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Repositories.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/ContentIndexPopulator.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/ContentIndexPopulator.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Examine/PublishedContentIndexPopulator.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Extensions/InstanceIdentifiableExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Macros/MacroTagParser.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Macros/MacroTagParser.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Macros/MacroTagParser.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Migrations/Expressions/Alter/Table/IAlterTableColumnOptionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Migrations/Upgrade/V_10_0_0/AddMemberPropertiesAsColumns.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/AccessMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/AuditEntryMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/MediaMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/MemberMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyGroupMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyGroupMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyTypeMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/PropertyTypeMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/RelationTypeMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Mappers/RelationTypeMapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/NPocoMapperCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Querying/ExpressionVisitorBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Fix [..] to substring * Fix after merge with 10/dev * Fox ContentValueSetValidator.cs * Update LoggerConfigExtensions Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk> Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
84 lines
3.5 KiB
C#
84 lines
3.5 KiB
C#
using Umbraco.Cms.Core.Mapping;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
|
using Umbraco.Cms.Core.PublishedCache;
|
|
using Umbraco.Cms.Core.Services;
|
|
|
|
namespace Umbraco.Cms.Core;
|
|
|
|
/// <summary>
|
|
/// Implements <see cref="ITagQuery" />.
|
|
/// </summary>
|
|
public class TagQuery : ITagQuery
|
|
{
|
|
private readonly IPublishedContentQuery _contentQuery;
|
|
private readonly IUmbracoMapper _mapper;
|
|
private readonly ITagService _tagService;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="TagQuery" /> class.
|
|
/// </summary>
|
|
public TagQuery(ITagService tagService, IPublishedContentQuery contentQuery, IUmbracoMapper mapper)
|
|
{
|
|
_tagService = tagService ?? throw new ArgumentNullException(nameof(tagService));
|
|
_contentQuery = contentQuery ?? throw new ArgumentNullException(nameof(contentQuery));
|
|
_mapper = mapper;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<IPublishedContent> GetContentByTag(string tag, string? group = null, string? culture = null)
|
|
{
|
|
IEnumerable<int> ids = _tagService.GetTaggedContentByTag(tag, group, culture)
|
|
.Select(x => x.EntityId);
|
|
return _contentQuery.Content(ids);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<IPublishedContent> GetContentByTagGroup(string group, string? culture = null)
|
|
{
|
|
IEnumerable<int> ids = _tagService.GetTaggedContentByTagGroup(group, culture)
|
|
.Select(x => x.EntityId);
|
|
return _contentQuery.Content(ids);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<IPublishedContent> GetMediaByTag(string tag, string? group = null, string? culture = null)
|
|
{
|
|
IEnumerable<int> ids = _tagService.GetTaggedMediaByTag(tag, group, culture)
|
|
.Select(x => x.EntityId);
|
|
return _contentQuery.Media(ids);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<IPublishedContent> GetMediaByTagGroup(string group, string? culture = null)
|
|
{
|
|
IEnumerable<int> ids = _tagService.GetTaggedMediaByTagGroup(group, culture)
|
|
.Select(x => x.EntityId);
|
|
return _contentQuery.Media(ids);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TagModel?> GetAllTags(string? group = null, string? culture = null) =>
|
|
_mapper.MapEnumerable<ITag, TagModel>(_tagService.GetAllTags(group, culture));
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TagModel?> GetAllContentTags(string? group = null, string? culture = null) =>
|
|
_mapper.MapEnumerable<ITag, TagModel>(_tagService.GetAllContentTags(group, culture));
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TagModel?> GetAllMediaTags(string? group = null, string? culture = null) =>
|
|
_mapper.MapEnumerable<ITag, TagModel>(_tagService.GetAllMediaTags(group, culture));
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TagModel?> GetAllMemberTags(string? group = null, string? culture = null) =>
|
|
_mapper.MapEnumerable<ITag, TagModel>(_tagService.GetAllMemberTags(group, culture));
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TagModel?> GetTagsForProperty(int contentId, string propertyTypeAlias, string? group = null, string? culture = null) =>
|
|
_mapper.MapEnumerable<ITag, TagModel>(_tagService.GetTagsForProperty(contentId, propertyTypeAlias, group, culture));
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TagModel?> GetTagsForEntity(int contentId, string? group = null, string? culture = null) =>
|
|
_mapper.MapEnumerable<ITag, TagModel>(_tagService.GetTagsForEntity(contentId, group, culture));
|
|
}
|