forked from votrongdao/FlowX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlanningFlows.cs
More file actions
125 lines (110 loc) · 4.66 KB
/
Copy pathPlanningFlows.cs
File metadata and controls
125 lines (110 loc) · 4.66 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
using FlowX;
namespace Crm;
/// <summary>Declares a period that plans are made for.</summary>
[Flow("crm.planning.period", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/planning/periods", Idempotent = true)]
public sealed partial class DefinePeriodFlow : Flow<DefinePeriod, PeriodDefined>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<DefinePeriod, PeriodDefined> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<DefinePlanPeriod>()
.Return(ctx => ctx.Get<PeriodDefined>());
}
}
/// <summary>Sets the number and the words a period is planned against.</summary>
[Flow("crm.planning.strategy", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/planning/strategies", Idempotent = true)]
public sealed partial class SetStrategyFlow : Flow<SetStrategy, StrategySet>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<SetStrategy, StrategySet> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<SetSalesStrategy>()
.Return(ctx => ctx.Get<StrategySet>());
}
}
/// <summary>Commits one plan against a period.</summary>
[Flow("crm.planning.plan", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/planning/plans", Idempotent = true)]
public sealed partial class DefinePlanFlow : Flow<DefinePlan, PlanDefined>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<DefinePlan, PlanDefined> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<DefineCrmPlan>()
.Return(ctx => ctx.Get<PlanDefined>());
}
}
/// <summary>Records whether one thing about a deal is actually known.</summary>
[Flow("crm.planning.qualification", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/planning/qualifications", Idempotent = true)]
public sealed partial class AnswerQualificationFlow : Flow<AnswerQualification, QualificationRecorded>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<AnswerQualification, QualificationRecorded> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<RecordQualification>()
.Return(ctx => ctx.Get<QualificationRecorded>());
}
}
/// <summary>Writes a step of the mutual action plan, or marks one done.</summary>
[Flow("crm.planning.step", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/planning/steps", Idempotent = true)]
public sealed partial class SetPlanStepFlow : Flow<SetPlanStep, PlanStepSet>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<SetPlanStep, PlanStepSet> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<SetCrmPlanStep>()
.Return(ctx => ctx.Get<PlanStepSet>());
}
}
/// <summary>Says how a period is looking.</summary>
/// <remarks><c>Ephemeral</c>: it writes nothing, and a management screen polls it.</remarks>
[Flow("crm.planning.rollup", Version = "1.0.0", Profile = ExecutionProfile.Ephemeral, Owner = "crm-platform")]
[FlowDeadline("PT30S")]
[HttpTrigger("POST", "/api/v1/crm/planning/roll-ups")]
public sealed partial class RollUpFlow : Flow<ReadRollUp, PeriodRollUp>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<ReadRollUp, PeriodRollUp> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<ReadPeriodRollUp, ForViewer>(
ctx => new ForViewer(ctx.Input.Period, Caller.Subject(ctx.Principal)))
.Return(ctx => ctx.Get<PeriodRollUp>());
}
}
/// <summary>Says which periods this tenant has declared.</summary>
/// <remarks><c>Ephemeral</c>: it writes nothing, and every screen that is for a period asks it first.</remarks>
[Flow("crm.planning.periods", Version = "1.0.0", Profile = ExecutionProfile.Ephemeral, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/planning/periods/list")]
public sealed partial class DeclaredPeriodsFlow : Flow<ReadPeriods, DeclaredPeriods>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<ReadPeriods, DeclaredPeriods> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<ReadDeclaredPeriods>()
.Return(ctx => ctx.Get<DeclaredPeriods>());
}
}