Enrich the datatype references output with content type data (#16417)

This commit is contained in:
Kenn Jacobsen
2024-05-27 19:38:57 +02:00
committed by GitHub
parent ce8e258d6d
commit 5296013d89
4 changed files with 56 additions and 14 deletions

View File

@@ -47,8 +47,13 @@ public class DataTypeReferencePresentationFactory : IDataTypeReferencePresentati
IEnumerable<string> propertyAliases = propertyAliasesByGuid[contentType.Key];
yield return new DataTypeReferenceResponseModel
{
Id = contentType.Key,
Type = usagesByEntityType.Key,
ContentType = new DataTypeContentTypeReferenceModel
{
Id = contentType.Key,
Name = contentType.Name,
Icon = contentType.Icon,
Type = usagesByEntityType.Key,
},
Properties = contentType
.PropertyTypes
.Where(propertyType => propertyAliases.InvariantContains(propertyType.Alias))

View File

@@ -35399,6 +35399,34 @@
],
"type": "string"
},
"DataTypeContentTypeReferenceModel": {
"required": [
"icon",
"id",
"name",
"type"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"icon": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"DataTypeItemResponseModel": {
"required": [
"id",
@@ -35457,18 +35485,17 @@
},
"DataTypeReferenceResponseModel": {
"required": [
"id",
"properties",
"type"
"contentType",
"properties"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"type": {
"type": "string"
"contentType": {
"oneOf": [
{
"$ref": "#/components/schemas/DataTypeContentTypeReferenceModel"
}
]
},
"properties": {
"type": "array",

View File

@@ -0,0 +1,12 @@
namespace Umbraco.Cms.Api.Management.ViewModels.DataType;
public class DataTypeContentTypeReferenceModel
{
public required Guid Id { get; set; }
public required string? Type { get; set; }
public required string? Name { get; set; }
public required string? Icon { get; set; }
}

View File

@@ -2,9 +2,7 @@
public class DataTypeReferenceResponseModel
{
public required Guid Id { get; init; }
public required string Type { get; init; }
public required DataTypeContentTypeReferenceModel ContentType { get; init; }
public required IEnumerable<DataTypePropertyReferenceViewModel> Properties { get; init; }
}