/
get_Type_handler.cs
55 lines (47 loc) · 1.6 KB
/
get_Type_handler.cs
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
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Dovetail.SDK.Bootstrap;
using Dovetail.SDK.Bootstrap.History;
using FubuMVC.Swagger.Specification;
namespace Bootstrap.Web.Handlers.api.histories
{
public class get_Type_handler
{
private readonly IHistoryAssembler _historyAssembler;
public get_Type_handler(IHistoryAssembler historyAssembler)
{
_historyAssembler = historyAssembler;
}
public HistoriesModel Execute(HistoriesRequest request)
{
var ids = request.Ids.Split(',');
var items = request.Since.HasValue ? _historyAssembler.GetHistoriesSince(request.Type, ids, request.Since.Value) : _historyAssembler.GetHistories(request.Type, ids);
return new HistoriesModel
{
HistoryItems = items,
Type = request.Type,
Ids = ids,
Since = request.Since
};
}
}
public class HistoriesModel
{
public string Type { get; set; }
public string[] Ids { get; set; }
public DateTime? Since { get; set; }
public HistoryItem[] HistoryItems { get; set; }
}
[Description("Workflow objects history")]
public class HistoriesRequest : IApi
{
[Required, Description("Type of workflow object. Typically this is 'case'.")]
[AllowableValues("case", "subcase", "solution", "<any workflow object name>")]
public string Type { get; set; }
[Required, Description("Ids of the workflow objects.")]
public string Ids { get; set; }
[Description("")]
public DateTime? Since{ get; set; }
}
}