Updated management API endpoint and model for data type references to align with that used for documents, media etc. (#18905)
* Updated management API endpoint and model for data type references to align with that used for documents, media etc. * Refactoring. * Update src/Umbraco.Core/Constants-ReferenceTypes.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fixed typos. * Added id to tracked reference content type response. * Updated OpenApi.json. * Added missing updates. * Renamed model and constants from code review feedback. * Fix typo * Fix multiple enumeration --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: mole <nikolajlauridsen@protonmail.ch>
This commit is contained in:
@@ -12,6 +12,9 @@ public class TrackedReferenceViewModelsMapDefinition : IMapDefinition
|
||||
mapper.Define<RelationItemModel, DocumentReferenceResponseModel>((source, context) => new DocumentReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, MediaReferenceResponseModel>((source, context) => new MediaReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, MemberReferenceResponseModel>((source, context) => new MemberReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, DocumentTypePropertyTypeReferenceResponseModel>((source, context) => new DocumentTypePropertyTypeReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, MediaTypePropertyTypeReferenceResponseModel>((source, context) => new MediaTypePropertyTypeReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, MemberTypePropertyTypeReferenceResponseModel>((source, context) => new MemberTypePropertyTypeReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, DefaultReferenceResponseModel>((source, context) => new DefaultReferenceResponseModel(), Map);
|
||||
mapper.Define<RelationItemModel, ReferenceByIdModel>((source, context) => new ReferenceByIdModel(), Map);
|
||||
mapper.Define<Guid, ReferenceByIdModel>((source, context) => new ReferenceByIdModel(), Map);
|
||||
@@ -25,6 +28,7 @@ public class TrackedReferenceViewModelsMapDefinition : IMapDefinition
|
||||
target.Published = source.NodePublished;
|
||||
target.DocumentType = new TrackedReferenceDocumentType
|
||||
{
|
||||
Id = source.ContentTypeKey,
|
||||
Alias = source.ContentTypeAlias,
|
||||
Icon = source.ContentTypeIcon,
|
||||
Name = source.ContentTypeName,
|
||||
@@ -38,6 +42,7 @@ public class TrackedReferenceViewModelsMapDefinition : IMapDefinition
|
||||
target.Name = source.NodeName;
|
||||
target.MediaType = new TrackedReferenceMediaType
|
||||
{
|
||||
Id = source.ContentTypeKey,
|
||||
Alias = source.ContentTypeAlias,
|
||||
Icon = source.ContentTypeIcon,
|
||||
Name = source.ContentTypeName,
|
||||
@@ -51,6 +56,52 @@ public class TrackedReferenceViewModelsMapDefinition : IMapDefinition
|
||||
target.Name = source.NodeName;
|
||||
target.MemberType = new TrackedReferenceMemberType
|
||||
{
|
||||
Id = source.ContentTypeKey,
|
||||
Alias = source.ContentTypeAlias,
|
||||
Icon = source.ContentTypeIcon,
|
||||
Name = source.ContentTypeName,
|
||||
};
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll
|
||||
private void Map(RelationItemModel source, DocumentTypePropertyTypeReferenceResponseModel target, MapperContext context)
|
||||
{
|
||||
target.Id = source.NodeKey;
|
||||
target.Name = source.NodeName;
|
||||
target.Alias = source.NodeAlias;
|
||||
target.DocumentType = new TrackedReferenceDocumentType
|
||||
{
|
||||
Id = source.ContentTypeKey,
|
||||
Alias = source.ContentTypeAlias,
|
||||
Icon = source.ContentTypeIcon,
|
||||
Name = source.ContentTypeName,
|
||||
};
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll
|
||||
private void Map(RelationItemModel source, MediaTypePropertyTypeReferenceResponseModel target, MapperContext context)
|
||||
{
|
||||
target.Id = source.NodeKey;
|
||||
target.Name = source.NodeName;
|
||||
target.Alias = source.NodeAlias;
|
||||
target.MediaType = new TrackedReferenceMediaType
|
||||
{
|
||||
Id = source.ContentTypeKey,
|
||||
Alias = source.ContentTypeAlias,
|
||||
Icon = source.ContentTypeIcon,
|
||||
Name = source.ContentTypeName,
|
||||
};
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll
|
||||
private void Map(RelationItemModel source, MemberTypePropertyTypeReferenceResponseModel target, MapperContext context)
|
||||
{
|
||||
target.Id = source.NodeKey;
|
||||
target.Name = source.NodeName;
|
||||
target.Alias = source.NodeAlias;
|
||||
target.MemberType = new TrackedReferenceMemberType
|
||||
{
|
||||
Id = source.ContentTypeKey,
|
||||
Alias = source.ContentTypeAlias,
|
||||
Icon = source.ContentTypeIcon,
|
||||
Name = source.ContentTypeName,
|
||||
|
||||
Reference in New Issue
Block a user