Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a1f34d81c | ||
|
|
e539263aa4 |
@@ -15,16 +15,9 @@ namespace TerribleDev.Blog.Web.Factories
|
|||||||
.Aggregate(
|
.Aggregate(
|
||||||
ImmutableDictionary.Create<string, ImmutableList<IPost>>(),
|
ImmutableDictionary.Create<string, ImmutableList<IPost>>(),
|
||||||
(accum, item) => {
|
(accum, item) => {
|
||||||
foreach(var tag in item.tags.Select(i => i.ToLower()))
|
foreach(var tag in item.tags.Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => i.ToLower()))
|
||||||
{
|
{
|
||||||
if(accum.TryGetValue(tag, out var list))
|
accum = accum.TryGetValue(tag, out var list) ? accum.SetItem(tag, list.Add(item)) : accum.Add(tag, ImmutableList.Create(item));
|
||||||
{
|
|
||||||
accum = accum.SetItem(tag, list.Add(item));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
accum = accum.Add(tag, ImmutableList.Create<IPost>(item));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return accum;
|
return accum;
|
||||||
}).ToImmutableSortedDictionary();
|
}).ToImmutableSortedDictionary();
|
||||||
@@ -46,6 +39,7 @@ namespace TerribleDev.Blog.Web.Factories
|
|||||||
return accum.SetItem(highestPage, current.Add(item));
|
return accum.SetItem(highestPage, current.Add(item));
|
||||||
}).ToImmutableDictionary();
|
}).ToImmutableDictionary();
|
||||||
var syndicationPosts = posts.Select(i => i.ToSyndicationItem()).ToImmutableList();
|
var syndicationPosts = posts.Select(i => i.ToSyndicationItem()).ToImmutableList();
|
||||||
|
var postsToPosition = posts.Select((item, index) => (item, index)).ToImmutableDictionary(i => i.item, i => i.index);
|
||||||
return new PostCache()
|
return new PostCache()
|
||||||
{
|
{
|
||||||
PostsAsLists = posts,
|
PostsAsLists = posts,
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ namespace TerribleDev.Blog.Web.Models
|
|||||||
public string SummaryPlainShort { get; set; }
|
public string SummaryPlainShort { get; set; }
|
||||||
public IList<string> tags { get; set; }
|
public IList<string> tags { get; set; }
|
||||||
public IList<string> Images { get; set;}
|
public IList<string> Images { get; set;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace TerribleDev.Blog.Web.Models
|
|||||||
public ImmutableDictionary<string, IPost> UrlToPost { get; set; }
|
public ImmutableDictionary<string, IPost> UrlToPost { get; set; }
|
||||||
public ImmutableDictionary<int, ImmutableList<IPost>> PostsByPage { get; set; }
|
public ImmutableDictionary<int, ImmutableList<IPost>> PostsByPage { get; set; }
|
||||||
public ImmutableList<SyndicationItem> PostsAsSyndication { get; set; }
|
public ImmutableList<SyndicationItem> PostsAsSyndication { get; set; }
|
||||||
|
public ImmutableDictionary<IPost, int> PostToPosition { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
<UserSecretsId>9a1f51b6-f4d9-4df7-a0af-e345176e9927</UserSecretsId>
|
<UserSecretsId>9a1f51b6-f4d9-4df7-a0af-e345176e9927</UserSecretsId>
|
||||||
<ApplicationInsightsResourceId>/subscriptions/088a81c7-d703-41c9-a1d0-476bce11df60/resourcegroups/WebResourceGroup/providers/microsoft.insights/components/tparnellblognew</ApplicationInsightsResourceId>
|
<ApplicationInsightsResourceId>/subscriptions/088a81c7-d703-41c9-a1d0-476bce11df60/resourcegroups/WebResourceGroup/providers/microsoft.insights/components/tparnellblognew</ApplicationInsightsResourceId>
|
||||||
<ApplicationInsightsAnnotationResourceId>/subscriptions/088a81c7-d703-41c9-a1d0-476bce11df60/resourcegroups/WebResourceGroup/providers/microsoft.insights/components/tparnellblognew</ApplicationInsightsAnnotationResourceId>
|
<ApplicationInsightsAnnotationResourceId>/subscriptions/088a81c7-d703-41c9-a1d0-476bce11df60/resourcegroups/WebResourceGroup/providers/microsoft.insights/components/tparnellblognew</ApplicationInsightsAnnotationResourceId>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user