Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Added Rule title, uri, isArchived fields to history #59

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SSW.Rules.AzFuncs/Domain/RuleHistoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ namespace SSW.Rules.AzFuncs.Domain;
public class RuleHistoryCache : BaseEntity
{
public string MarkdownFilePath { get; set; }
public string? Title { get; set; }
public string? Uri { get; set; }
public bool? IsArchived { get; set; }
public DateTime ChangedAtDateTime { get; set; }
public string ChangedByDisplayName { get; set; }
public string ChangedByEmail { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion SSW.Rules.AzFuncs/Domain/RuleHistoryData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ namespace SSW.Rules.AzFuncs.Domain;
public class RuleHistoryData
{
public string file { get; set; }
public string? title { get; set; }
public string? uri { get; set; }
public bool? isArchived { get; set; }
public string lastUpdated { get; set; }
public string lastUpdatedBy { get; set; }
public string lastUpdatedByEmail { get; set; }
public string created { get; set; }
public string createdBy { get; set; }
public string createdByEmail { get; set; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public async Task<HttpResponseData> Run(
ruleHistory.AddRange(results.Select(history => new RuleHistoryData
{
file = history.MarkdownFilePath,
title = history.Title,
uri = history.Uri,
isArchived = history.IsArchived,
lastUpdated = history.ChangedAtDateTime.ToString(DateFormat, CultureInfo.InvariantCulture),
lastUpdatedBy = history.ChangedByDisplayName,
lastUpdatedByEmail = history.ChangedByEmail,
Expand Down
6 changes: 6 additions & 0 deletions SSW.Rules.AzFuncs/Functions/History/UpdateRuleHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public async Task<HttpResponseData> Run(
await dbContext.RuleHistoryCache.Add(new RuleHistoryCache
{
MarkdownFilePath = historyEntry.file,
Title = historyEntry.title,
Uri = historyEntry.uri,
IsArchived = historyEntry.isArchived,
ChangedAtDateTime = DateTime.ParseExact(historyEntry.lastUpdated, DateFormat, _provider),
ChangedByDisplayName = historyEntry.lastUpdatedBy,
ChangedByEmail = historyEntry.lastUpdatedByEmail,
Expand All @@ -58,6 +61,9 @@ await dbContext.RuleHistoryCache.Add(new RuleHistoryCache
}
else
{
historyCache.Title = historyEntry.title;
historyCache.Uri = historyEntry.uri;
historyCache.IsArchived = historyEntry.isArchived;
historyCache.ChangedAtDateTime = DateTime.ParseExact(historyEntry.lastUpdated, DateFormat, _provider);
historyCache.ChangedByDisplayName = historyEntry.lastUpdatedBy;
historyCache.ChangedByEmail = historyEntry.lastUpdatedByEmail;
Expand Down
Loading