forked from votrongdao/FlowX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportFlows.cs
More file actions
72 lines (63 loc) · 2.51 KB
/
Copy pathReportFlows.cs
File metadata and controls
72 lines (63 loc) · 2.51 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
using FlowX;
namespace Crm;
/// <summary>Saves a report an administrator built.</summary>
[Flow("crm.report.define", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/reports", Idempotent = true)]
public sealed partial class DefineReportFlow : Flow<DefineReport, ReportDefined>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<DefineReport, ReportDefined> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<DefineCrmReport>()
.Return(ctx => ctx.Get<ReportDefined>());
}
}
/// <summary>Runs a saved report.</summary>
/// <remarks><c>Ephemeral</c>: it writes nothing, and a dashboard polls it.</remarks>
[Flow("crm.report.run", Version = "1.0.0", Profile = ExecutionProfile.Ephemeral, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/reports/runs")]
public sealed partial class RunReportFlow : Flow<RunReport, ReportResult>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<RunReport, ReportResult> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<RunCrmReport>()
.Return(ctx => ctx.Get<ReportResult>());
}
}
/// <summary>Saves a dashboard: an ordered set of saved reports.</summary>
[Flow("crm.dashboard.define", Version = "1.0.0", Profile = ExecutionProfile.Durable, Owner = "crm-platform")]
[FlowDeadline("PT15S")]
[HttpTrigger("POST", "/api/v1/crm/dashboards", Idempotent = true)]
public sealed partial class DefineDashboardFlow : Flow<DefineDashboard, DashboardDefined>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<DefineDashboard, DashboardDefined> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<DefineCrmDashboard>()
.Return(ctx => ctx.Get<DashboardDefined>());
}
}
/// <summary>Runs every report on a dashboard, in one request.</summary>
[Flow("crm.dashboard.run", Version = "1.0.0", Profile = ExecutionProfile.Ephemeral, Owner = "crm-platform")]
[FlowDeadline("PT30S")]
[HttpTrigger("POST", "/api/v1/crm/dashboards/runs")]
public sealed partial class RunDashboardFlow : Flow<RunDashboard, DashboardResult>
{
/// <inheritdoc />
protected override void Define(IFlowBuilder<RunDashboard, DashboardResult> flow)
{
ArgumentNullException.ThrowIfNull(flow);
flow
.Step<RunCrmDashboard>()
.Return(ctx => ctx.Get<DashboardResult>());
}
}