-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMutationRequestDecisionQuery.cs
More file actions
77 lines (67 loc) · 2.57 KB
/
Copy pathMutationRequestDecisionQuery.cs
File metadata and controls
77 lines (67 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using ModularityKit.Mutator.Governance.Abstractions.Requests.Decisions;
namespace ModularityKit.Mutator.Governance.Abstractions.Queries.Model;
/// <summary>
/// Defines storage agnostic filters for decision oriented governance queries.
/// </summary>
public sealed record MutationRequestDecisionQuery
{
/// <summary>
/// Request level filters applied before decisions are projected.
/// </summary>
public MutationRequestQuery RequestQuery { get; init; } = new();
/// <summary>
/// Decision categories to include.
/// </summary>
public IReadOnlySet<MutationRequestDecisionCategory> Categories { get; init; }
= new HashSet<MutationRequestDecisionCategory>();
/// <summary>
/// Decision codes to include.
/// </summary>
public IReadOnlySet<string> Codes { get; init; } = new HashSet<string>();
/// <summary>
/// Decision actor identifiers to include.
/// </summary>
public IReadOnlySet<string> ActorIds { get; init; } = new HashSet<string>();
/// <summary>
/// Decision actor names to include.
/// </summary>
public IReadOnlySet<string> ActorNames { get; init; } = new HashSet<string>();
/// <summary>
/// Inclusive lower bound for decision timestamps.
/// </summary>
public DateTimeOffset? From { get; init; }
/// <summary>
/// Inclusive upper bound for decision timestamps.
/// </summary>
public DateTimeOffset? To { get; init; }
/// <summary>
/// Creates query for recent version-resolution decisions.
/// </summary>
public static MutationRequestDecisionQuery RecentVersionResolutions()
=> new()
{
Categories = new HashSet<MutationRequestDecisionCategory>
{
MutationRequestDecisionCategory.VersionResolution
}
};
/// <summary>
/// Creates query for recent execution outcomes.
/// </summary>
public static MutationRequestDecisionQuery RecentExecutionOutcomes()
=> new()
{
Categories = new HashSet<MutationRequestDecisionCategory>
{
MutationRequestDecisionCategory.Lifecycle
},
Codes = new HashSet<string>
{
MutationRequestLifecycleDecisionType.Executed.ToString(),
MutationRequestLifecycleDecisionType.Rejected.ToString(),
MutationRequestLifecycleDecisionType.Canceled.ToString(),
MutationRequestLifecycleDecisionType.Expired.ToString(),
MutationRequestLifecycleDecisionType.Superseded.ToString()
}
};
}