diff --git a/SharpRSS.API/Controllers/WeatherForecastController.cs b/SharpRSS.API/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..b532598 --- /dev/null +++ b/SharpRSS.API/Controllers/WeatherForecastController.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace SharpRSS.API.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} \ No newline at end of file diff --git a/SharpRSS.API/Program.cs b/SharpRSS.API/Program.cs new file mode 100644 index 0000000..a5c1260 --- /dev/null +++ b/SharpRSS.API/Program.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); \ No newline at end of file diff --git a/SharpRSS.API/Properties/launchSettings.json b/SharpRSS.API/Properties/launchSettings.json new file mode 100644 index 0000000..d280f35 --- /dev/null +++ b/SharpRSS.API/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:12878", + "sslPort": 44388 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5259", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7267;http://localhost:5259", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/SharpRSS.API/SharpRSS.API.csproj b/SharpRSS.API/SharpRSS.API.csproj new file mode 100644 index 0000000..00462b6 --- /dev/null +++ b/SharpRSS.API/SharpRSS.API.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + 10 + + + + + + + + + + + + diff --git a/SharpRSS.API/WeatherForecast.cs b/SharpRSS.API/WeatherForecast.cs new file mode 100644 index 0000000..1492547 --- /dev/null +++ b/SharpRSS.API/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace SharpRSS.API +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} \ No newline at end of file diff --git a/SharpRSS.API/appsettings.Development.json b/SharpRSS.API/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/SharpRSS.API/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/SharpRSS.API/appsettings.json b/SharpRSS.API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/SharpRSS.API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/SharpRSS.Blazor/App.razor b/SharpRSS.Blazor/App.razor new file mode 100644 index 0000000..37a2310 --- /dev/null +++ b/SharpRSS.Blazor/App.razor @@ -0,0 +1,12 @@ + + + + + + + Not found + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/SharpRSS.Blazor/MainLayout.razor b/SharpRSS.Blazor/MainLayout.razor new file mode 100644 index 0000000..04a84e5 --- /dev/null +++ b/SharpRSS.Blazor/MainLayout.razor @@ -0,0 +1,3 @@ +@inherits LayoutComponentBase + +
@Body
\ No newline at end of file diff --git a/SharpRSS.Blazor/Pages/Index.razor b/SharpRSS.Blazor/Pages/Index.razor new file mode 100644 index 0000000..64a40ca --- /dev/null +++ b/SharpRSS.Blazor/Pages/Index.razor @@ -0,0 +1,3 @@ +@page "/" + +

Hello, world!

\ No newline at end of file diff --git a/SharpRSS.Blazor/Pages/_Host.cshtml b/SharpRSS.Blazor/Pages/_Host.cshtml new file mode 100644 index 0000000..2862296 --- /dev/null +++ b/SharpRSS.Blazor/Pages/_Host.cshtml @@ -0,0 +1,30 @@ +@page "/" +@using Microsoft.AspNetCore.Components.Web +@namespace SharpRSS.Blazor.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + + + + + + + + + + + + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + + \ No newline at end of file diff --git a/SharpRSS.Blazor/Program.cs b/SharpRSS.Blazor/Program.cs new file mode 100644 index 0000000..52b0ed4 --- /dev/null +++ b/SharpRSS.Blazor/Program.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddRazorPages(); +builder.Services.AddServerSideBlazor(); + +var app = builder.Build(); + +if (!app.Environment.IsDevelopment()) +{ + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); + +app.UseStaticFiles(); + +app.UseRouting(); + +app.MapBlazorHub(); +app.MapFallbackToPage("/_Host"); + +app.Run(); \ No newline at end of file diff --git a/SharpRSS.Blazor/Properties/launchSettings.json b/SharpRSS.Blazor/Properties/launchSettings.json new file mode 100644 index 0000000..a16f734 --- /dev/null +++ b/SharpRSS.Blazor/Properties/launchSettings.json @@ -0,0 +1,35 @@ +{ + "iisSettings": { + "iisExpress": { + "applicationUrl": "http://localhost:51228", + "sslPort": 44393 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5205", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7043;http://localhost:5205", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/SharpRSS.Blazor/SharpRSS.Blazor.csproj b/SharpRSS.Blazor/SharpRSS.Blazor.csproj new file mode 100644 index 0000000..5dfc7d6 --- /dev/null +++ b/SharpRSS.Blazor/SharpRSS.Blazor.csproj @@ -0,0 +1,15 @@ + + + + net7.0 + enable + enable + 10 + + + + + + + + diff --git a/SharpRSS.Blazor/_Imports.razor b/SharpRSS.Blazor/_Imports.razor new file mode 100644 index 0000000..8cd577e --- /dev/null +++ b/SharpRSS.Blazor/_Imports.razor @@ -0,0 +1,4 @@ +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.JSInterop +@using SharpRSS.Blazor \ No newline at end of file diff --git a/SharpRSS.Blazor/appsettings.Development.json b/SharpRSS.Blazor/appsettings.Development.json new file mode 100644 index 0000000..770d3e9 --- /dev/null +++ b/SharpRSS.Blazor/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/SharpRSS.Blazor/appsettings.json b/SharpRSS.Blazor/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/SharpRSS.Blazor/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/SharpRSS.Blazor/wwwroot/css/site.css b/SharpRSS.Blazor/wwwroot/css/site.css new file mode 100644 index 0000000..08e7f0b --- /dev/null +++ b/SharpRSS.Blazor/wwwroot/css/site.css @@ -0,0 +1,28 @@ +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 3.5rem; + top: 0.5rem; + } + +.blazor-error-boundary { + background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjb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ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; + padding: 1rem 1rem 1rem 3.7rem; + color: white; +} + + .blazor-error-boundary::after { + content: "An error has occurred." + } diff --git a/SharpRSS.sln b/SharpRSS.sln index 7dd82e5..d02ddbc 100644 --- a/SharpRSS.sln +++ b/SharpRSS.sln @@ -9,10 +9,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpRss", "SharpRss\SharpR EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ToolQit", "ToolQit\ToolQit\ToolQit.csproj", "{BD905344-9DBF-4986-B853-E70B22848876}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpSyndicationApi", "SharpSyndicationApi\SharpSyndicationApi.csproj", "{349033BA-F5C3-4CDB-AFEA-9E85711FFBD5}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolQit.Logging.Serilog", "..\ToolQit\ToolQit.Logging.Serilog\ToolQit.Logging.Serilog.csproj", "{E040C5E3-8847-41B8-8AE4-D6DE6E33F9BA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRSS.Blazor", "SharpRSS.Blazor\SharpRSS.Blazor.csproj", "{3CF5125A-76B4-4E88-9F03-181C446F1C1D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRSS.API", "SharpRSS.API\SharpRSS.API.csproj", "{5A657342-BB00-4B0C-88E7-35CACDE6DA2F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,14 +33,18 @@ Global {BD905344-9DBF-4986-B853-E70B22848876}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD905344-9DBF-4986-B853-E70B22848876}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD905344-9DBF-4986-B853-E70B22848876}.Release|Any CPU.Build.0 = Release|Any CPU - {349033BA-F5C3-4CDB-AFEA-9E85711FFBD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {349033BA-F5C3-4CDB-AFEA-9E85711FFBD5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {349033BA-F5C3-4CDB-AFEA-9E85711FFBD5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {349033BA-F5C3-4CDB-AFEA-9E85711FFBD5}.Release|Any CPU.Build.0 = Release|Any CPU {E040C5E3-8847-41B8-8AE4-D6DE6E33F9BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E040C5E3-8847-41B8-8AE4-D6DE6E33F9BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {E040C5E3-8847-41B8-8AE4-D6DE6E33F9BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {E040C5E3-8847-41B8-8AE4-D6DE6E33F9BA}.Release|Any CPU.Build.0 = Release|Any CPU + {3CF5125A-76B4-4E88-9F03-181C446F1C1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CF5125A-76B4-4E88-9F03-181C446F1C1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CF5125A-76B4-4E88-9F03-181C446F1C1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CF5125A-76B4-4E88-9F03-181C446F1C1D}.Release|Any CPU.Build.0 = Release|Any CPU + {5A657342-BB00-4B0C-88E7-35CACDE6DA2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A657342-BB00-4B0C-88E7-35CACDE6DA2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A657342-BB00-4B0C-88E7-35CACDE6DA2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A657342-BB00-4B0C-88E7-35CACDE6DA2F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SharpRss/Core/IDbAccess.cs b/SharpRss/Core/IDbAccess.cs deleted file mode 100644 index 4ec7849..0000000 --- a/SharpRss/Core/IDbAccess.cs +++ /dev/null @@ -1,14 +0,0 @@ - -namespace SharpRss.Core -{ - public struct DbState - { - - } - - // Interface for implementing the database endpoints. - public interface IDbAccess - { - - } -} \ No newline at end of file diff --git a/SharpSyndicationApi.Contracts/Category/CategoryRequest.cs b/SharpSyndicationApi.Contracts/Category/CategoryRequest.cs new file mode 100644 index 0000000..89c9982 --- /dev/null +++ b/SharpSyndicationApi.Contracts/Category/CategoryRequest.cs @@ -0,0 +1,9 @@ +namespace SharpSyndicationApi.Contracts.Category +{ + public record CategoryRequest + { + public string Name { get; set; } + public string HexColor { get; set; } + public string Icon { get; set; } + } +} \ No newline at end of file diff --git a/SharpSyndicationApi.Contracts/SharpSyndicationApi.Contracts.csproj b/SharpSyndicationApi.Contracts/SharpSyndicationApi.Contracts.csproj new file mode 100644 index 0000000..43cf144 --- /dev/null +++ b/SharpSyndicationApi.Contracts/SharpSyndicationApi.Contracts.csproj @@ -0,0 +1,14 @@ + + + + netstandard2.1 + enable + enable + 10 + + + + + + + diff --git a/SharpSyndicationApi/Controllers/CategoryController.cs b/SharpSyndicationApi/Controllers/CategoryController.cs index d5b9602..ee313a3 100644 --- a/SharpSyndicationApi/Controllers/CategoryController.cs +++ b/SharpSyndicationApi/Controllers/CategoryController.cs @@ -1,8 +1,6 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using SharpSyndicationApi.Models; diff --git a/SharpSyndicationApi/SharpSyndicationApi.csproj b/SharpSyndicationApi/SharpSyndicationApi.csproj index de639d3..289cdc4 100644 --- a/SharpSyndicationApi/SharpSyndicationApi.csproj +++ b/SharpSyndicationApi/SharpSyndicationApi.csproj @@ -18,6 +18,7 @@ +