diff --git a/SharpRss/DbAccess.cs b/SharpRss/DbAccess.cs index 0c0d670..038c46f 100644 --- a/SharpRss/DbAccess.cs +++ b/SharpRss/DbAccess.cs @@ -58,8 +58,8 @@ namespace SharpRss if (category == null) return modelReturn; await using SqliteConnection dbc = new SqliteConnection(ConnectionString); dbc.Open(); - int affected = await dbc.ExecuteAsync("INSERT OR REPLACE INTO category (id, name, hex_color, last_updated) VALUES (IFNULL((SELECT id FROM category WHERE name=@Name), @Id), @Name, @HexColor, @LastUpdated)", - new { Id = category.Id, Name = category.Name, HexColor = category.HexColor, LastUpdated = category.LastUpdated.ToUnixTimeMilliseconds() }); + int affected = await dbc.ExecuteAsync("INSERT OR REPLACE INTO category (id, name, hex_color, icon, last_updated) VALUES (IFNULL((SELECT id FROM category WHERE name=@Name), @Id), @Name, @HexColor, @Icon, @LastUpdated)", + new { Id = category.Id, Name = category.Name, HexColor = category.HexColor, Icon = category.Icon, LastUpdated = category.LastUpdated.ToUnixTimeMilliseconds() }); if (affected <= 0) return modelReturn; var catModel = await GetCategoriesAsync(); modelReturn = catModel.Where(x => x.Name == category.Name).ToHashSet().FirstOrDefault() ?? null; diff --git a/SharpRss/Services/SyndicationService.cs b/SharpRss/Services/SyndicationService.cs index 3ca65b3..42872f1 100644 --- a/SharpRss/Services/SyndicationService.cs +++ b/SharpRss/Services/SyndicationService.cs @@ -117,10 +117,10 @@ namespace SharpRss.Services } private async void SetupTestCategoriesAndFeedsAsync() { - /*Log.Information("Setting up test data..."); + Log.Information("Setting up test data..."); try { - CategoryModel? newsCategory = await CreateCategoryAsync(new CategoryModel() { Name = "News" }); + CategoryModel? newsCategory = await CreateCategoryAsync(new CategoryModel() { Name = "News", Icon = ""}); if (newsCategory != null) { await AddSubscriptionAsync("https://www.nu.nl/rss/Algemeen", newsCategory); @@ -129,7 +129,7 @@ namespace SharpRss.Services await AddSubscriptionAsync("http://news.google.com/?output=atom", newsCategory); } - CategoryModel? techCategory = await CreateCategoryAsync(new CategoryModel() { Name = "Tech" }); + CategoryModel? techCategory = await CreateCategoryAsync(new CategoryModel() { Name = "Tech", Icon = ""}); if (techCategory != null) { await AddSubscriptionAsync("https://itsfoss.com/feed", techCategory); @@ -138,7 +138,7 @@ namespace SharpRss.Services await AddSubscriptionAsync("https://feeds.arstechnica.com/arstechnica/gadgets", techCategory); } - CategoryModel? youtubeCategory = await CreateCategoryAsync(new CategoryModel() { Name = "YouTube" }); + CategoryModel? youtubeCategory = await CreateCategoryAsync(new CategoryModel() { Name = "YouTube", Icon = ""}); if (youtubeCategory != null) { await AddSubscriptionAsync("https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw", youtubeCategory); @@ -157,7 +157,7 @@ namespace SharpRss.Services catch (Exception e) { Log.Error(e, "Exception!"); - }*/ + } } } } \ No newline at end of file diff --git a/WebSharpRSS/MainLayout.razor b/WebSharpRSS/MainLayout.razor index 2e2c2c1..e3df2c5 100644 --- a/WebSharpRSS/MainLayout.razor +++ b/WebSharpRSS/MainLayout.razor @@ -1,6 +1,6 @@ @inherits LayoutComponentBase - +