Creation of ADO Connection
This commit is contained in:
@ -2,11 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Attribute
|
||||
internal class Attribute
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
[JsonConstructor]
|
||||
public Attribute(bool isLocked,
|
||||
string name)
|
||||
@ -15,7 +13,13 @@ public class Attribute
|
||||
Name = name;
|
||||
}
|
||||
|
||||
[JsonPropertyName("isLocked")] public bool IsLocked { get; set; }
|
||||
[JsonPropertyName("name")] public string Name { get; set; }
|
||||
[JsonPropertyName("isLocked")] public bool IsLocked { get; }
|
||||
[JsonPropertyName("name")] public string Name { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Attribute))]
|
||||
internal partial class AttributeSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,12 +2,20 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Avatar
|
||||
internal class Avatar
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public Avatar(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; } // { init; get; }
|
||||
[JsonPropertyName("href")] public string Href { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Avatar))]
|
||||
internal partial class AvatarSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,8 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class CommentVersionRef
|
||||
internal class CommentVersionRef
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public CommentVersionRef(
|
||||
int commentId,
|
||||
@ -16,8 +17,14 @@ public class CommentVersionRef
|
||||
URL = url;
|
||||
}
|
||||
|
||||
[JsonPropertyName("commentId")] public int CommentId { get; } // { init; get; }
|
||||
[JsonPropertyName("url")] public string URL { get; } // { init; get; }
|
||||
[JsonPropertyName("version")] public int Version { get; } // { init; get; }
|
||||
[JsonPropertyName("commentId")] public int CommentId { get; }
|
||||
[JsonPropertyName("url")] public string URL { get; }
|
||||
[JsonPropertyName("version")] public int Version { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(CommentVersionRef))]
|
||||
internal partial class CommentVersionRefSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,8 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class CustomRequester
|
||||
internal class CustomRequester
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public CustomRequester(
|
||||
string descriptor,
|
||||
@ -31,4 +32,11 @@ public class CustomRequester
|
||||
[JsonPropertyName("_links")] public Links Links { get; }
|
||||
[JsonPropertyName("uniqueName")] public string UniqueName { get; }
|
||||
[JsonPropertyName("url")] public string Url { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(CustomRequester))]
|
||||
internal partial class CustomRequesterSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Fields
|
||||
internal class Fields
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
@ -72,35 +72,41 @@ public class Fields
|
||||
SystemWorkItemType = systemWorkItemType;
|
||||
}
|
||||
|
||||
[JsonPropertyName("Custom.Requester")] public CustomRequester? CustomRequester { get; } // { init; get; }
|
||||
[JsonPropertyName("Custom.RRminusOE")] public float? CustomRRminusOE { get; } // { init; get; }
|
||||
[JsonPropertyName("Custom.WSJF")] public float? CustomWSJF { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedDate")] public DateTime MicrosoftVSTSCommonActivatedDate { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.BusinessValue")] public float? MicrosoftVSTSCommonBusinessValue { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ClosedDate")] public DateTime MicrosoftVSTSCommonClosedDate { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.Priority")] public int MicrosoftVSTSCommonPriority { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedDate")] public DateTime MicrosoftVSTSCommonResolvedDate { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")] public DateTime MicrosoftVSTSCommonStateChangeDate { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.TimeCriticality")] public float? MicrosoftVSTSCommonTimeCriticality { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")] public float? MicrosoftVSTSSchedulingEffort { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.StartDate")] public DateTime MicrosoftVSTSSchedulingStartDate { get; } // { init; get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")] public DateTime MicrosoftVSTSSchedulingTargetDate { get; } // { init; get; }
|
||||
[JsonPropertyName("System.AreaPath")] public string SystemAreaPath { get; } // { init; get; }
|
||||
[JsonPropertyName("System.AssignedTo")] public SystemAssignedTo? SystemAssignedTo { get; } // { init; get; }
|
||||
[JsonPropertyName("System.ChangedBy")] public SystemChangedBy SystemChangedBy { get; } // { init; get; }
|
||||
[JsonPropertyName("System.ChangedDate")] public DateTime SystemChangedDate { get; } // { init; get; }
|
||||
[JsonPropertyName("System.CommentCount")] public int SystemCommentCount { get; } // { init; get; }
|
||||
[JsonPropertyName("System.CreatedBy")] public SystemCreatedBy SystemCreatedBy { get; } // { init; get; }
|
||||
[JsonPropertyName("System.CreatedDate")] public DateTime SystemCreatedDate { get; } // { init; get; }
|
||||
[JsonPropertyName("System.Description")] public string SystemDescription { get; } // { init; get; }
|
||||
[JsonPropertyName("System.History")] public string SystemHistory { get; } // { init; get; }
|
||||
[JsonPropertyName("System.IterationPath")] public string SystemIterationPath { get; } // { init; get; }
|
||||
[JsonPropertyName("System.Parent")] public int SystemParent { get; } // { init; get; }
|
||||
[JsonPropertyName("System.Reason")] public string SystemReason { get; } // { init; get; }
|
||||
[JsonPropertyName("System.State")] public string SystemState { get; } // { init; get; }
|
||||
[JsonPropertyName("System.Tags")] public string SystemTags { get; } // { init; get; }
|
||||
[JsonPropertyName("System.TeamProject")] public string SystemTeamProject { get; } // { init; get; }
|
||||
[JsonPropertyName("System.Title")] public string SystemTitle { get; } // { init; get; }
|
||||
[JsonPropertyName("System.WorkItemType")] public string SystemWorkItemType { get; } // { init; get; }
|
||||
[JsonPropertyName("Custom.Requester")] public CustomRequester? CustomRequester { get; }
|
||||
[JsonPropertyName("Custom.RRminusOE")] public float? CustomRRminusOE { get; }
|
||||
[JsonPropertyName("Custom.WSJF")] public float? CustomWSJF { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedDate")] public DateTime MicrosoftVSTSCommonActivatedDate { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.BusinessValue")] public float? MicrosoftVSTSCommonBusinessValue { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ClosedDate")] public DateTime MicrosoftVSTSCommonClosedDate { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.Priority")] public int MicrosoftVSTSCommonPriority { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedDate")] public DateTime MicrosoftVSTSCommonResolvedDate { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")] public DateTime MicrosoftVSTSCommonStateChangeDate { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Common.TimeCriticality")] public float? MicrosoftVSTSCommonTimeCriticality { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")] public float? MicrosoftVSTSSchedulingEffort { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.StartDate")] public DateTime MicrosoftVSTSSchedulingStartDate { get; }
|
||||
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")] public DateTime MicrosoftVSTSSchedulingTargetDate { get; }
|
||||
[JsonPropertyName("System.AreaPath")] public string SystemAreaPath { get; }
|
||||
[JsonPropertyName("System.AssignedTo")] public SystemAssignedTo? SystemAssignedTo { get; }
|
||||
[JsonPropertyName("System.ChangedBy")] public SystemChangedBy SystemChangedBy { get; }
|
||||
[JsonPropertyName("System.ChangedDate")] public DateTime SystemChangedDate { get; }
|
||||
[JsonPropertyName("System.CommentCount")] public int SystemCommentCount { get; }
|
||||
[JsonPropertyName("System.CreatedBy")] public SystemCreatedBy SystemCreatedBy { get; }
|
||||
[JsonPropertyName("System.CreatedDate")] public DateTime SystemCreatedDate { get; }
|
||||
[JsonPropertyName("System.Description")] public string SystemDescription { get; }
|
||||
[JsonPropertyName("System.History")] public string SystemHistory { get; }
|
||||
[JsonPropertyName("System.IterationPath")] public string SystemIterationPath { get; }
|
||||
[JsonPropertyName("System.Parent")] public int SystemParent { get; }
|
||||
[JsonPropertyName("System.Reason")] public string SystemReason { get; }
|
||||
[JsonPropertyName("System.State")] public string SystemState { get; }
|
||||
[JsonPropertyName("System.Tags")] public string SystemTags { get; }
|
||||
[JsonPropertyName("System.TeamProject")] public string SystemTeamProject { get; }
|
||||
[JsonPropertyName("System.Title")] public string SystemTitle { get; }
|
||||
[JsonPropertyName("System.WorkItemType")] public string SystemWorkItemType { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Fields))]
|
||||
internal partial class FieldsSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,12 +2,20 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Html
|
||||
internal class Html
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public Html(
|
||||
string href
|
||||
) => Href = href;
|
||||
|
||||
public string Href { get; } // { init; get; }
|
||||
[JsonPropertyName("href")] public string Href { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Html))]
|
||||
internal partial class HtmlSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,12 +2,20 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Links
|
||||
internal class Links
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public Links(
|
||||
Avatar avatar
|
||||
) => Avatar = avatar;
|
||||
|
||||
[JsonPropertyName("avatar")] public Avatar Avatar { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Links))]
|
||||
internal partial class LinksSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -1,27 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Record
|
||||
internal class Record
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
[JsonConstructor]
|
||||
public Record(WorkItem workItem, WorkItem? parent, Record[] children)
|
||||
public Record(WorkItem workItem, WorkItem? parent, Record[] children, Record[] related, Record[] successors)
|
||||
{
|
||||
WorkItem = workItem;
|
||||
Parent = parent;
|
||||
Children = children;
|
||||
Related = related;
|
||||
Successors = successors;
|
||||
}
|
||||
|
||||
public WorkItem WorkItem { get; set; }
|
||||
public WorkItem? Parent { get; set; }
|
||||
public Record[] Children { get; set; }
|
||||
[JsonPropertyName("WorkItem")] public WorkItem WorkItem { get; set; }
|
||||
[JsonPropertyName("Parent")] public WorkItem? Parent { get; set; }
|
||||
[JsonPropertyName("Children")] public Record[] Children { get; set; }
|
||||
[JsonPropertyName("Related")] public Record[] Related { get; set; }
|
||||
[JsonPropertyName("Successors")] public Record[] Successors { get; set; }
|
||||
|
||||
public static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record> children) =>
|
||||
new(workItem, parent, children.ToArray());
|
||||
internal static Record GetWithoutNesting(Record record, string? violation)
|
||||
{
|
||||
Record result;
|
||||
WorkItem workItem = new(record.WorkItem.ActivatedDate,
|
||||
record.WorkItem.AreaPath,
|
||||
record.WorkItem.AssignedTo,
|
||||
record.WorkItem.BusinessValue,
|
||||
record.WorkItem.ChangedDate,
|
||||
record.WorkItem.ClosedDate,
|
||||
record.WorkItem.CommentCount,
|
||||
record.WorkItem.CreatedDate,
|
||||
record.WorkItem.Description,
|
||||
record.WorkItem.Effort,
|
||||
record.WorkItem.Id,
|
||||
record.WorkItem.IterationPath,
|
||||
record.WorkItem.Parent,
|
||||
record.WorkItem.Priority,
|
||||
record.WorkItem.Relations,
|
||||
record.WorkItem.Requester,
|
||||
record.WorkItem.ResolvedDate,
|
||||
record.WorkItem.Revision,
|
||||
record.WorkItem.RiskReductionMinusOpportunityEnablement,
|
||||
record.WorkItem.StartDate,
|
||||
record.WorkItem.State,
|
||||
record.WorkItem.Tags,
|
||||
record.WorkItem.TargetDate,
|
||||
record.WorkItem.TimeCriticality,
|
||||
record.WorkItem.Title,
|
||||
record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
|
||||
record.WorkItem.WeightedShortestJobFirst,
|
||||
record.WorkItem.WorkItemType);
|
||||
result = new(workItem, record.Parent, Array.Empty<Record>(), Array.Empty<Record>(), Array.Empty<Record>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Record Get(Record record, bool keepRelations)
|
||||
{
|
||||
Record result;
|
||||
WorkItem? parentWorkItem = keepRelations ? record.Parent : WorkItem.GetWithOutRelations(record.Parent);
|
||||
WorkItem? workItem = keepRelations ? record.WorkItem : WorkItem.GetWithOutRelations(record.WorkItem) ?? throw new Exception();
|
||||
List<Record> childRecords = new();
|
||||
List<Record> relatedRecords = new();
|
||||
List<Record> successorRecords = new();
|
||||
foreach (Record r in record.Children)
|
||||
childRecords.Add(Get(r, keepRelations));
|
||||
foreach (Record r in record.Related)
|
||||
relatedRecords.Add(Get(r, keepRelations));
|
||||
foreach (Record r in record.Successors)
|
||||
successorRecords.Add(Get(r, keepRelations));
|
||||
result = new(workItem, parentWorkItem, childRecords.ToArray(), relatedRecords.ToArray(), successorRecords.ToArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static Record Get(WorkItem workItem, WorkItem? parent, ReadOnlyCollection<Record> children, ReadOnlyCollection<Record> related, ReadOnlyCollection<Record> successors, bool keepRelations)
|
||||
{
|
||||
Record result;
|
||||
Record record = new(workItem, parent, children.ToArray(), related.ToArray(), successors.ToArray());
|
||||
result = Get(record, keepRelations);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int? GetIdFromUrl(string relationName, Relation relation)
|
||||
{
|
||||
int? result;
|
||||
string[] segments = relation?.Attributes is null || relation.Attributes.Name != relationName ? Array.Empty<string>() : relation.URL.Split('/');
|
||||
if (segments.Length < 2)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
if (!int.TryParse(segments[segments.Length - 1], out int id))
|
||||
result = null;
|
||||
else
|
||||
result = id;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static ReadOnlyCollection<Record> GetKeyValuePairs(ReadOnlyDictionary<int, WorkItem> keyValuePairs, WorkItem workItem, string relationName, List<bool> nests, bool keepRelations)
|
||||
{
|
||||
List<Record> results = new();
|
||||
int? childId;
|
||||
Record record;
|
||||
nests.Add(true);
|
||||
WorkItem? childWorkItem;
|
||||
WorkItem? parentWorkItem;
|
||||
List<WorkItem> collection = new();
|
||||
ReadOnlyCollection<Record> childRecords;
|
||||
ReadOnlyCollection<Record> relatedRecords;
|
||||
ReadOnlyCollection<Record> successorRecords;
|
||||
if (workItem.Relations is not null && workItem.Relations.Length > 0)
|
||||
{
|
||||
collection.Clear();
|
||||
foreach (Relation relation in workItem.Relations)
|
||||
{
|
||||
childId = GetIdFromUrl(relationName, relation);
|
||||
if (childId is not null && workItem.Parent is not null && relation?.URL is not null && relation.URL.Contains(workItem.Parent.Value.ToString()))
|
||||
continue;
|
||||
if (childId is null || !keyValuePairs.TryGetValue(childId.Value, out childWorkItem))
|
||||
continue;
|
||||
collection.Add(childWorkItem);
|
||||
}
|
||||
collection = (from l in collection orderby l.State != "Closed", l.Id select l).ToList();
|
||||
foreach (WorkItem w in collection)
|
||||
{
|
||||
if (nests.Count > 99)
|
||||
break;
|
||||
if (w.Parent is null)
|
||||
parentWorkItem = null;
|
||||
else
|
||||
_ = keyValuePairs.TryGetValue(w.Parent.Value, out parentWorkItem);
|
||||
childRecords = GetKeyValuePairs(keyValuePairs, w, "Child", nests, keepRelations); // Forward
|
||||
// records = GetKeyValuePairs(keyValuePairs, w, "Predecessor", nests); // Reverse
|
||||
// successorRecords = GetKeyValuePairs(keyValuePairs, w, "Successor", nests); // Forward
|
||||
// if (successorRecords.Count > 0)
|
||||
// {
|
||||
// if (successorRecords.Count > 0)
|
||||
// { }
|
||||
// }
|
||||
successorRecords = new(Array.Empty<Record>());
|
||||
relatedRecords = GetKeyValuePairs(keyValuePairs, w, "Related", nests, keepRelations); // Related
|
||||
record = Get(w, parentWorkItem, childRecords, relatedRecords, successorRecords, keepRelations);
|
||||
results.Add(record);
|
||||
}
|
||||
}
|
||||
return new(results);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Record))]
|
||||
internal partial class RecordSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,11 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Relation
|
||||
internal class Relation
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
|
||||
[JsonConstructor]
|
||||
public Relation(string rel,
|
||||
string url,
|
||||
@ -21,4 +19,16 @@ public class Relation
|
||||
[JsonPropertyName("rel")] public string Rel { get; set; }
|
||||
[JsonPropertyName("url")] public string URL { get; set; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Relation))]
|
||||
internal partial class RelationSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Relation[]))]
|
||||
internal partial class RelationCollectionSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,8 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class SystemAssignedTo
|
||||
internal class SystemAssignedTo
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public SystemAssignedTo(
|
||||
string displayName,
|
||||
@ -32,4 +33,10 @@ public class SystemAssignedTo
|
||||
[JsonPropertyName("uniqueName")] public string UniqueName { get; }
|
||||
[JsonPropertyName("url")] public string Url { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(SystemAssignedTo))]
|
||||
internal partial class SystemAssignedToSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,8 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class SystemChangedBy
|
||||
internal class SystemChangedBy
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public SystemChangedBy(
|
||||
string displayName,
|
||||
@ -32,4 +33,10 @@ public class SystemChangedBy
|
||||
[JsonPropertyName("uniqueName")] public string UniqueName { get; }
|
||||
[JsonPropertyName("url")] public string Url { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(SystemChangedBy))]
|
||||
internal partial class SystemChangedBySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,8 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class SystemCreatedBy
|
||||
internal class SystemCreatedBy
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public SystemCreatedBy(
|
||||
string displayName,
|
||||
@ -32,4 +33,10 @@ public class SystemCreatedBy
|
||||
[JsonPropertyName("uniqueName")] public string UniqueName { get; }
|
||||
[JsonPropertyName("url")] public string Url { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(SystemCreatedBy))]
|
||||
internal partial class SystemCreatedBySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -2,8 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class Value
|
||||
internal class Value
|
||||
{
|
||||
|
||||
[JsonConstructor]
|
||||
public Value(
|
||||
int id,
|
||||
@ -28,4 +29,11 @@ public class Value
|
||||
[JsonPropertyName("relations")] public Relation[] Relations { get; }
|
||||
[JsonPropertyName("rev")] public int Rev { get; }
|
||||
[JsonPropertyName("url")] public string Url { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Value))]
|
||||
internal partial class ValueSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.json.WorkItems;
|
||||
|
||||
public class WorkItem
|
||||
internal class WorkItem
|
||||
{
|
||||
|
||||
#nullable enable
|
||||
@ -70,68 +70,78 @@ public class WorkItem
|
||||
|
||||
public override string ToString() => $"{Id} - {WorkItemType} - {Title}";
|
||||
|
||||
public static Record Get(Record record, string? violation)
|
||||
public static WorkItem? GetWithOutRelations(WorkItem? workItem)
|
||||
{
|
||||
Record result;
|
||||
WorkItem workItem = new(record.WorkItem.ActivatedDate,
|
||||
record.WorkItem.AreaPath,
|
||||
record.WorkItem.AssignedTo,
|
||||
record.WorkItem.BusinessValue,
|
||||
record.WorkItem.ChangedDate,
|
||||
record.WorkItem.ClosedDate,
|
||||
record.WorkItem.CommentCount,
|
||||
record.WorkItem.CreatedDate,
|
||||
record.WorkItem.Description,
|
||||
record.WorkItem.Effort,
|
||||
record.WorkItem.Id,
|
||||
record.WorkItem.IterationPath,
|
||||
record.WorkItem.Parent,
|
||||
record.WorkItem.Priority,
|
||||
record.WorkItem.Relations,
|
||||
record.WorkItem.Requester,
|
||||
record.WorkItem.ResolvedDate,
|
||||
record.WorkItem.Revision,
|
||||
record.WorkItem.RiskReductionMinusOpportunityEnablement,
|
||||
record.WorkItem.StartDate,
|
||||
record.WorkItem.State,
|
||||
record.WorkItem.Tags,
|
||||
record.WorkItem.TargetDate,
|
||||
record.WorkItem.TimeCriticality,
|
||||
record.WorkItem.Title,
|
||||
record.WorkItem.Violation is null ? violation : record.WorkItem.Violation,
|
||||
record.WorkItem.WeightedShortestJobFirst,
|
||||
record.WorkItem.WorkItemType);
|
||||
result = new(workItem, record.Parent, Array.Empty<Record>());
|
||||
WorkItem? result = workItem is null ? null : new(workItem.ActivatedDate,
|
||||
workItem.AreaPath,
|
||||
workItem.AssignedTo,
|
||||
workItem.BusinessValue,
|
||||
workItem.ChangedDate,
|
||||
workItem.ClosedDate,
|
||||
workItem.CommentCount,
|
||||
workItem.CreatedDate,
|
||||
workItem.Description,
|
||||
workItem.Effort,
|
||||
workItem.Id,
|
||||
workItem.IterationPath,
|
||||
workItem.Parent,
|
||||
workItem.Priority,
|
||||
Array.Empty<Relation>(),
|
||||
workItem.Requester,
|
||||
workItem.ResolvedDate,
|
||||
workItem.Revision,
|
||||
workItem.RiskReductionMinusOpportunityEnablement,
|
||||
workItem.StartDate,
|
||||
workItem.State,
|
||||
workItem.Tags,
|
||||
workItem.TargetDate,
|
||||
workItem.TimeCriticality,
|
||||
workItem.Title,
|
||||
workItem.Violation,
|
||||
workItem.WeightedShortestJobFirst,
|
||||
workItem.WorkItemType);
|
||||
return result;
|
||||
}
|
||||
|
||||
public DateTime? ActivatedDate { get; set; }
|
||||
public string AreaPath { get; set; }
|
||||
public string? AssignedTo { get; set; }
|
||||
public long? BusinessValue { get; set; }
|
||||
public DateTime ChangedDate { get; set; }
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
public int CommentCount { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string Description { get; set; }
|
||||
public long? Effort { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string IterationPath { get; set; }
|
||||
public int? Parent { get; set; }
|
||||
public int? Priority { get; set; }
|
||||
public Relation[]? Relations { get; set; }
|
||||
public string? Requester { get; set; }
|
||||
public DateTime? ResolvedDate { get; set; }
|
||||
public int Revision { get; set; }
|
||||
public long? RiskReductionMinusOpportunityEnablement { get; set; }
|
||||
public DateTime? StartDate { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public DateTime? TargetDate { get; set; }
|
||||
public long? TimeCriticality { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string? Violation { get; set; }
|
||||
public string WorkItemType { get; set; }
|
||||
public long? WeightedShortestJobFirst { get; set; }
|
||||
[JsonPropertyName("ActivatedDate")] public DateTime? ActivatedDate { get; }
|
||||
[JsonPropertyName("AreaPath")] public string AreaPath { get; }
|
||||
[JsonPropertyName("AssignedTo")] public string? AssignedTo { get; }
|
||||
[JsonPropertyName("BusinessValue")] public long? BusinessValue { get; }
|
||||
[JsonPropertyName("ChangedDate")] public DateTime ChangedDate { get; }
|
||||
[JsonPropertyName("ClosedDate")] public DateTime? ClosedDate { get; }
|
||||
[JsonPropertyName("CommentCount")] public int CommentCount { get; }
|
||||
[JsonPropertyName("CreatedDate")] public DateTime CreatedDate { get; }
|
||||
[JsonPropertyName("Description")] public string Description { get; }
|
||||
[JsonPropertyName("Effort")] public long? Effort { get; }
|
||||
[JsonPropertyName("Id")] public int Id { get; }
|
||||
[JsonPropertyName("IterationPath")] public string IterationPath { get; }
|
||||
[JsonPropertyName("Parent")] public int? Parent { get; }
|
||||
[JsonPropertyName("Priority")] public int? Priority { get; }
|
||||
[JsonPropertyName("Relations")] public Relation[]? Relations { get; }
|
||||
[JsonPropertyName("Requester")] public string? Requester { get; }
|
||||
[JsonPropertyName("ResolvedDate")] public DateTime? ResolvedDate { get; }
|
||||
[JsonPropertyName("Revision")] public int Revision { get; }
|
||||
[JsonPropertyName("RiskReductionMinusOpportunityEnablement")] public long? RiskReductionMinusOpportunityEnablement { get; }
|
||||
[JsonPropertyName("StartDate")] public DateTime? StartDate { get; }
|
||||
[JsonPropertyName("State")] public string State { get; }
|
||||
[JsonPropertyName("Tags")] public string Tags { get; }
|
||||
[JsonPropertyName("TargetDate")] public DateTime? TargetDate { get; }
|
||||
[JsonPropertyName("TimeCriticality")] public long? TimeCriticality { get; }
|
||||
[JsonPropertyName("Title")] public string Title { get; }
|
||||
[JsonPropertyName("Violation")] public string? Violation { get; }
|
||||
[JsonPropertyName("WeightedShortestJobFirst")] public long? WeightedShortestJobFirst { get; }
|
||||
[JsonPropertyName("WorkItemType")] public string WorkItemType { get; }
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(WorkItem))]
|
||||
internal partial class WorkItemSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(WorkItem[]))]
|
||||
internal partial class WorkItemCollectionSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user