V14/feature/response model trash tracking (#14948)
* Clearify UmbracoMapper functionality trough comment * Add trash tracking to doc/media(item) response models * Add mapping for ITracksTrashing * Removed uneccesary abstraction and seperation * Cleanup after removing abstractions * Cleanup unused DI item * Clean up and formatting --------- Co-authored-by: Sven Geusens <sge@umbraco.dk> Co-authored-by: kjac <kja@umbraco.dk>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Document;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Document.Item;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.DocumentBlueprint.Item;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Mapping;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.Entities;
|
||||
@@ -49,6 +48,7 @@ public class DocumentPresentationFactory : IDocumentPresentationFactory
|
||||
Name = entity.Name ?? string.Empty,
|
||||
Id = entity.Key,
|
||||
Icon = entity.ContentTypeIcon,
|
||||
IsTrashed = entity.Trashed
|
||||
};
|
||||
|
||||
IContentType? contentType = _contentTypeService.Get(entity.ContentTypeAlias);
|
||||
|
||||
@@ -32,6 +32,7 @@ public class DocumentMapDefinition : ContentMapDefinition<IContent, DocumentValu
|
||||
? source.PublishDate
|
||||
: source.GetPublishDate(culture);
|
||||
});
|
||||
target.IsTrashed = source.Trashed;
|
||||
}
|
||||
|
||||
private ContentState GetSavedState(IContent content, string? culture)
|
||||
|
||||
@@ -112,6 +112,7 @@ public class ItemTypeMapDefinition : IMapDefinition
|
||||
target.Icon = source.ContentTypeIcon;
|
||||
target.Id = source.Key;
|
||||
target.Name = source.Name ?? string.Empty;
|
||||
target.IsTrashed = source.Trashed;
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll
|
||||
|
||||
@@ -23,5 +23,6 @@ public class MediaMapDefinition : ContentMapDefinition<IMedia, MediaValueModel,
|
||||
target.ContentTypeId = source.ContentType.Key;
|
||||
target.Values = MapValueViewModels(source);
|
||||
target.Variants = MapVariantViewModels(source);
|
||||
target.IsTrashed = source.Trashed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,6 @@ public class DocumentResponseModel : ContentResponseModelBase<DocumentValueModel
|
||||
public IEnumerable<ContentUrlInfo> Urls { get; set; } = Array.Empty<ContentUrlInfo>();
|
||||
|
||||
public Guid? TemplateId { get; set; }
|
||||
|
||||
public bool IsTrashed { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,4 +7,6 @@ public class DocumentItemResponseModel : ItemResponseModelBase
|
||||
public string? Icon { get; set; }
|
||||
|
||||
public Guid ContentTypeId { get; set; }
|
||||
|
||||
public bool IsTrashed { get; set; }
|
||||
}
|
||||
|
||||
@@ -5,4 +5,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.Media;
|
||||
public class MediaResponseModel : ContentResponseModelBase<MediaValueModel, MediaVariantResponseModel>
|
||||
{
|
||||
public IEnumerable<ContentUrlInfo> Urls { get; set; } = Array.Empty<ContentUrlInfo>();
|
||||
|
||||
public bool IsTrashed { get; set; }
|
||||
}
|
||||
|
||||
@@ -5,4 +5,6 @@ namespace Umbraco.Cms.Api.Management.ViewModels.Media.Item;
|
||||
public class MediaItemResponseModel : ItemResponseModelBase
|
||||
{
|
||||
public string? Icon { get; set; }
|
||||
|
||||
public bool IsTrashed { get; set; }
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface IUmbracoMapper
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource">The source type.</typeparam>
|
||||
/// <typeparam name="TTarget">The target type.</typeparam>
|
||||
/// <param name="ctor">A constructor method.</param>
|
||||
/// <param name="ctor">A constructor method. Will not be used if the mapping call receives a Target object</param>
|
||||
/// <param name="map">A mapping method.</param>
|
||||
void Define<TSource, TTarget>(
|
||||
Func<TSource, MapperContext, TTarget> ctor,
|
||||
|
||||
Reference in New Issue
Block a user