diff --git a/SurveyBackend/SurveyBackend.API/Program.cs b/SurveyBackend/SurveyBackend.API/Program.cs new file mode 100644 index 0000000..3a98e82 --- /dev/null +++ b/SurveyBackend/SurveyBackend.API/Program.cs @@ -0,0 +1,31 @@ +namespace SurveyBackend; + +public class Program +{ + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + builder.Services.AddAuthorization(); + + // 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.Run(); + } +} \ No newline at end of file diff --git a/SurveyBackend/SurveyBackend/Properties/launchSettings.json b/SurveyBackend/SurveyBackend.API/Properties/launchSettings.json similarity index 100% rename from SurveyBackend/SurveyBackend/Properties/launchSettings.json rename to SurveyBackend/SurveyBackend.API/Properties/launchSettings.json diff --git a/SurveyBackend/SurveyBackend/SurveyBackend.csproj b/SurveyBackend/SurveyBackend.API/SurveyBackend.API.csproj similarity index 88% rename from SurveyBackend/SurveyBackend/SurveyBackend.csproj rename to SurveyBackend/SurveyBackend.API/SurveyBackend.API.csproj index 1060e38..41529c3 100644 --- a/SurveyBackend/SurveyBackend/SurveyBackend.csproj +++ b/SurveyBackend/SurveyBackend.API/SurveyBackend.API.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + SurveyBackend diff --git a/SurveyBackend/SurveyBackend/SurveyBackend.http b/SurveyBackend/SurveyBackend.API/SurveyBackend.http similarity index 100% rename from SurveyBackend/SurveyBackend/SurveyBackend.http rename to SurveyBackend/SurveyBackend.API/SurveyBackend.http diff --git a/SurveyBackend/SurveyBackend/appsettings.Development.json b/SurveyBackend/SurveyBackend.API/appsettings.Development.json similarity index 100% rename from SurveyBackend/SurveyBackend/appsettings.Development.json rename to SurveyBackend/SurveyBackend.API/appsettings.Development.json diff --git a/SurveyBackend/SurveyBackend/appsettings.json b/SurveyBackend/SurveyBackend.API/appsettings.json similarity index 100% rename from SurveyBackend/SurveyBackend/appsettings.json rename to SurveyBackend/SurveyBackend.API/appsettings.json diff --git a/SurveyBackend/SurveyBackend.Core/Models/User.cs b/SurveyBackend/SurveyBackend.Core/Models/User.cs new file mode 100644 index 0000000..509c503 --- /dev/null +++ b/SurveyBackend/SurveyBackend.Core/Models/User.cs @@ -0,0 +1,11 @@ +namespace SurveyBackend.Core.Models; + +public class User +{ + public int Id { get; set; } + public string Username { get; set; } + public string Email { get; set; } + + public byte[] PasswordHash { get; set; } + public byte[] PasswordSalt { get; set; } +} \ No newline at end of file diff --git a/SurveyBackend/SurveyBackend.Core/SurveyBackend.Core.csproj b/SurveyBackend/SurveyBackend.Core/SurveyBackend.Core.csproj new file mode 100644 index 0000000..3a63532 --- /dev/null +++ b/SurveyBackend/SurveyBackend.Core/SurveyBackend.Core.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/SurveyBackend/SurveyBackend.sln b/SurveyBackend/SurveyBackend.sln index b7d1a9a..a7701f0 100644 --- a/SurveyBackend/SurveyBackend.sln +++ b/SurveyBackend/SurveyBackend.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SurveyBackend", "SurveyBackend\SurveyBackend.csproj", "{2941E98A-5311-4B97-B8B0-8DBF5E1C3B56}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SurveyBackend.API", "SurveyBackend.API\SurveyBackend.API.csproj", "{2941E98A-5311-4B97-B8B0-8DBF5E1C3B56}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SurveyBackend.Core", "SurveyBackend.Core\SurveyBackend.Core.csproj", "{596B4603-4066-4FF2-9C96-5357193F7229}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -12,5 +14,9 @@ Global {2941E98A-5311-4B97-B8B0-8DBF5E1C3B56}.Debug|Any CPU.Build.0 = Debug|Any CPU {2941E98A-5311-4B97-B8B0-8DBF5E1C3B56}.Release|Any CPU.ActiveCfg = Release|Any CPU {2941E98A-5311-4B97-B8B0-8DBF5E1C3B56}.Release|Any CPU.Build.0 = Release|Any CPU + {596B4603-4066-4FF2-9C96-5357193F7229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {596B4603-4066-4FF2-9C96-5357193F7229}.Debug|Any CPU.Build.0 = Debug|Any CPU + {596B4603-4066-4FF2-9C96-5357193F7229}.Release|Any CPU.ActiveCfg = Release|Any CPU + {596B4603-4066-4FF2-9C96-5357193F7229}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/SurveyBackend/SurveyBackend/Program.cs b/SurveyBackend/SurveyBackend/Program.cs deleted file mode 100644 index 5a9ed2b..0000000 --- a/SurveyBackend/SurveyBackend/Program.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace SurveyBackend; - -public class Program -{ - public static void Main(string[] args) - { - var builder = WebApplication.CreateBuilder(args); - - // Add services to the container. - builder.Services.AddAuthorization(); - - // 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(); - - var summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - app.MapGet("/weatherforecast", (HttpContext httpContext) => - { - var forecast = 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(); - return forecast; - }) - .WithName("GetWeatherForecast") - .WithOpenApi(); - - app.Run(); - } -} \ No newline at end of file diff --git a/SurveyBackend/SurveyBackend/WeatherForecast.cs b/SurveyBackend/SurveyBackend/WeatherForecast.cs deleted file mode 100644 index 75b15b6..0000000 --- a/SurveyBackend/SurveyBackend/WeatherForecast.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace SurveyBackend; - -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