Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added histories view for getting the history from multiple objects by id
/api/histories/case?ids=1,2,3,4,5,6 * ids=1,2,3,4,5 * (optional) since datetime Note it won't likely behave nice if you have weird spaces between the comma delimited ids
- Loading branch information
Showing
9 changed files
with
139 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<viewdata model="Bootstrap.Web.Handlers.api.histories.HistoriesModel" /> | ||
<use namespace="FubuCore" /> | ||
<use namespace="Dovetail.SDK.Bootstrap.History" /> | ||
|
||
<content:pagehead> | ||
<h1>History for ${Model.Type} By Id</h1> | ||
</content:pagehead> | ||
|
||
<div class="history-item" each="var item in Model.HistoryItems"> | ||
<div class="history-item-header ${item.Type}-item"> | ||
<h3> | ||
<span class="action-taken">${item.Title} for ${item.Type} ${item.Id}</span> | ||
<span class="date-ago" data-time="${item.When}">${item.When.ToString("yyyy-MM-ddTHH:mm:ssZ")}</span> | ||
</h3> | ||
<div class="history-item-description"> | ||
<span class="agent-name">By ${item.Who.Name}</span> | ||
<span class="at-on-date" data-time="${item.When}">${item.When.ToString("yyyy-MM-ddTHH:mm:ssZ")}</span> | ||
</div> | ||
|
||
<div class="history-item-details"> | ||
<div class="notes"> | ||
!{item.Detail} | ||
</div> | ||
<div class="internal" if="item.Internal.IsNotEmpty()"> | ||
!{item.Internal} | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters