Skip to content

Commit

Permalink
EN-125 Add due date to content item variant
Browse files Browse the repository at this point in the history
  • Loading branch information
František Záhora authored and pokornyd committed Apr 8, 2024
1 parent ecb2c50 commit 2422546
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "4b628214-e4fe-4fe0-b1ff-955df33e1515"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "4b628214-e4fe-4fe0-b1ff-955df33e1515"
},
Expand Down Expand Up @@ -357,6 +360,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "4b628214-e4fe-4fe0-b1ff-955df33e1515"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "00000000-0000-0000-0000-000000000000"
},
Expand Down Expand Up @@ -358,6 +361,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "00000000-0000-0000-0000-000000000000"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "10000000-0000-0000-0000-000000000000"
},
Expand Down Expand Up @@ -358,6 +361,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "10000000-0000-0000-0000-000000000000"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "20000000-0000-0000-0000-000000000000"
},
Expand Down Expand Up @@ -354,10 +357,16 @@
"workflow_identifier": {
"id": "00000000-0000-0000-0000-000000000000"
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"step_identifier": {
"id": "eee6db3b-545a-4785-8e86-e3772c8756f9"
}
},
"due_date": {
"value": "2092-01-07T06:04:00.7069564Z"
},
"item": {
"id": "20000000-0000-0000-0000-000000000000"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ private static LanguageVariantModel GetExpectedLanguageVariantModel(
LastModified = DateTimeOffset.Parse("2021-11-06T13:57:26.7069564Z").UtcDateTime,
Workflow = new WorkflowStepIdentifier(Reference.ById(Guid.Parse("00000000-0000-0000-0000-000000000000")), Reference.ById(Guid.Parse("eee6db3b-545a-4785-8e86-e3772c8756f9"))),
Schedule = GetExpectedScheduleResponseModel(),
DueDate = GetExpectedDueDateModel(),
Elements = ElementsData.GetExpectedDynamicElements(),
};

Expand All @@ -450,6 +451,7 @@ private static List<LanguageVariantModel<ComplexTestModel>> GetExpectedComplexTe
LastModified = DateTimeOffset.Parse("2021-11-06T13:57:26.7069564Z").UtcDateTime,
Workflow = new WorkflowStepIdentifier(Reference.ById(Guid.Parse("00000000-0000-0000-0000-000000000000")), Reference.ById(Guid.Parse("eee6db3b-545a-4785-8e86-e3772c8756f9"))),
Schedule = GetExpectedScheduleResponseModel(),
DueDate = GetExpectedDueDateModel(),
Elements = ElementsData.GetExpectedStronglyTypedElementsModel(),
};

Expand All @@ -461,6 +463,9 @@ private static List<LanguageVariantModel<ComplexTestModel>> GetExpectedComplexTe
UnpublishDisplayTimeZone = "Europe/Prague"
};

private static DueDateResponseModel GetExpectedDueDateModel() =>
new() { Value = DateTimeOffset.Parse("2092-01-07T06:04:00.7069564Z").UtcDateTime };

private class CombinationOfIdentifiersAndUrl : IEnumerable<object[]>
{

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
using System;

namespace Kontent.Ai.Management.Models.LanguageVariants;

/// <summary>
/// Represents due date model.
/// </summary>
public class DueDateResponseModel
{
/// <summary>
/// Gets or sets ISO-8601 formatted date-time for due date.
/// </summary>
[JsonProperty("value")]
public DateTime? Value { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ public sealed class LanguageVariantModel
/// </summary>
[JsonProperty("workflow")]
public WorkflowStepIdentifier Workflow { get; set; }

/// <summary>
/// Gets or sets due date.
/// </summary>
[JsonProperty("due_date")]
public DueDateResponseModel DueDate { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Kontent.Ai.Management.Models.Publishing;
using Kontent.Ai.Management.Models.LanguageVariants;
using Kontent.Ai.Management.Models.Shared;
using Kontent.Ai.Management.Models.Workflow;
using Newtonsoft.Json;
Expand Down Expand Up @@ -46,4 +47,10 @@ namespace Kontent.Ai.Management.Models.StronglyTyped;
/// </summary>
[JsonProperty("workflow")]
public WorkflowStepIdentifier Workflow { get; set; }

/// <summary>
/// Gets or sets due date.
/// </summary>
[JsonProperty("due_date")]
public DueDateResponseModel DueDate { get; set; }
}
3 changes: 2 additions & 1 deletion Kontent.Ai.Management/Modules/ModelBuilders/ModelProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ internal ModelProvider()
LastModified = variant.LastModified,
Schedule = variant.Schedule,
Workflow = variant.Workflow,
Elements = _elementModelProvider.GetStronglyTypedElements<T>(variant.Elements)
DueDate = variant.DueDate,
Elements = _elementModelProvider.GetStronglyTypedElements<T>(variant.Elements),
};

public LanguageVariantUpsertModel GetLanguageVariantUpsertModel<T>(T variantElements, WorkflowStepIdentifier workflow = null) where T : new() =>
Expand Down

0 comments on commit 2422546

Please sign in to comment.