From 76635a0da92e596850bd8fb475ad0190b568847f Mon Sep 17 00:00:00 2001 From: dmolinari Date: Tue, 1 Jul 2025 10:46:13 -0300 Subject: [PATCH] feat: Initial project structure setup with solution and projects --- Mercados-Web.sln | 99 +++++++++++++++++++ src/Mercados.Api/Mercados.Api.csproj | 17 ++++ src/Mercados.Api/Mercados.Api.http | 6 ++ src/Mercados.Api/Program.cs | 41 ++++++++ .../Properties/launchSettings.json | 23 +++++ src/Mercados.Api/appsettings.Development.json | 8 ++ src/Mercados.Api/appsettings.json | 9 ++ src/Mercados.Core/Class1.cs | 6 ++ src/Mercados.Core/Mercados.Core.csproj | 9 ++ src/Mercados.Database/Class1.cs | 6 ++ .../Mercados.Database.csproj | 9 ++ src/Mercados.Infrastructure/Class1.cs | 6 ++ .../Mercados.Infrastructure.csproj | 13 +++ src/Mercados.Worker/Mercados.Worker.csproj | 17 ++++ src/Mercados.Worker/Program.cs | 7 ++ .../Properties/launchSettings.json | 12 +++ src/Mercados.Worker/Worker.cs | 23 +++++ .../appsettings.Development.json | 8 ++ src/Mercados.Worker/appsettings.json | 8 ++ 19 files changed, 327 insertions(+) create mode 100644 Mercados-Web.sln create mode 100644 src/Mercados.Api/Mercados.Api.csproj create mode 100644 src/Mercados.Api/Mercados.Api.http create mode 100644 src/Mercados.Api/Program.cs create mode 100644 src/Mercados.Api/Properties/launchSettings.json create mode 100644 src/Mercados.Api/appsettings.Development.json create mode 100644 src/Mercados.Api/appsettings.json create mode 100644 src/Mercados.Core/Class1.cs create mode 100644 src/Mercados.Core/Mercados.Core.csproj create mode 100644 src/Mercados.Database/Class1.cs create mode 100644 src/Mercados.Database/Mercados.Database.csproj create mode 100644 src/Mercados.Infrastructure/Class1.cs create mode 100644 src/Mercados.Infrastructure/Mercados.Infrastructure.csproj create mode 100644 src/Mercados.Worker/Mercados.Worker.csproj create mode 100644 src/Mercados.Worker/Program.cs create mode 100644 src/Mercados.Worker/Properties/launchSettings.json create mode 100644 src/Mercados.Worker/Worker.cs create mode 100644 src/Mercados.Worker/appsettings.Development.json create mode 100644 src/Mercados.Worker/appsettings.json diff --git a/Mercados-Web.sln b/Mercados-Web.sln new file mode 100644 index 0000000..d5c0283 --- /dev/null +++ b/Mercados-Web.sln @@ -0,0 +1,99 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercados.Core", "src\Mercados.Core\Mercados.Core.csproj", "{210587C0-C079-4854-B657-D4EC3E7D027D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercados.Infrastructure", "src\Mercados.Infrastructure\Mercados.Infrastructure.csproj", "{D5946C47-E9B7-49ED-B5D7-C769A2AD3531}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercados.Database", "src\Mercados.Database\Mercados.Database.csproj", "{58B7BBE5-AF6D-403D-9118-893C0C28A157}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercados.Worker", "src\Mercados.Worker\Mercados.Worker.csproj", "{8E654200-21A4-4DD1-B2BB-91B4390E950D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercados.Api", "src\Mercados.Api\Mercados.Api.csproj", "{0C3A1D0D-EE56-43CB-AFF4-5051C9739579}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {210587C0-C079-4854-B657-D4EC3E7D027D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Debug|x64.ActiveCfg = Debug|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Debug|x64.Build.0 = Debug|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Debug|x86.ActiveCfg = Debug|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Debug|x86.Build.0 = Debug|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Release|Any CPU.Build.0 = Release|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Release|x64.ActiveCfg = Release|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Release|x64.Build.0 = Release|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Release|x86.ActiveCfg = Release|Any CPU + {210587C0-C079-4854-B657-D4EC3E7D027D}.Release|x86.Build.0 = Release|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Debug|x64.ActiveCfg = Debug|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Debug|x64.Build.0 = Debug|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Debug|x86.ActiveCfg = Debug|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Debug|x86.Build.0 = Debug|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Release|Any CPU.Build.0 = Release|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Release|x64.ActiveCfg = Release|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Release|x64.Build.0 = Release|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Release|x86.ActiveCfg = Release|Any CPU + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531}.Release|x86.Build.0 = Release|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Debug|x64.ActiveCfg = Debug|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Debug|x64.Build.0 = Debug|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Debug|x86.ActiveCfg = Debug|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Debug|x86.Build.0 = Debug|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Release|Any CPU.Build.0 = Release|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Release|x64.ActiveCfg = Release|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Release|x64.Build.0 = Release|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Release|x86.ActiveCfg = Release|Any CPU + {58B7BBE5-AF6D-403D-9118-893C0C28A157}.Release|x86.Build.0 = Release|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Debug|x64.ActiveCfg = Debug|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Debug|x64.Build.0 = Debug|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Debug|x86.ActiveCfg = Debug|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Debug|x86.Build.0 = Debug|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Release|Any CPU.Build.0 = Release|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Release|x64.ActiveCfg = Release|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Release|x64.Build.0 = Release|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Release|x86.ActiveCfg = Release|Any CPU + {8E654200-21A4-4DD1-B2BB-91B4390E950D}.Release|x86.Build.0 = Release|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Debug|x64.ActiveCfg = Debug|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Debug|x64.Build.0 = Debug|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Debug|x86.ActiveCfg = Debug|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Debug|x86.Build.0 = Debug|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Release|Any CPU.Build.0 = Release|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Release|x64.ActiveCfg = Release|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Release|x64.Build.0 = Release|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Release|x86.ActiveCfg = Release|Any CPU + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {210587C0-C079-4854-B657-D4EC3E7D027D} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + {D5946C47-E9B7-49ED-B5D7-C769A2AD3531} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + {58B7BBE5-AF6D-403D-9118-893C0C28A157} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + {8E654200-21A4-4DD1-B2BB-91B4390E950D} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + {0C3A1D0D-EE56-43CB-AFF4-5051C9739579} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + EndGlobalSection +EndGlobal diff --git a/src/Mercados.Api/Mercados.Api.csproj b/src/Mercados.Api/Mercados.Api.csproj new file mode 100644 index 0000000..8c7c090 --- /dev/null +++ b/src/Mercados.Api/Mercados.Api.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + diff --git a/src/Mercados.Api/Mercados.Api.http b/src/Mercados.Api/Mercados.Api.http new file mode 100644 index 0000000..f049508 --- /dev/null +++ b/src/Mercados.Api/Mercados.Api.http @@ -0,0 +1,6 @@ +@Mercados.Api_HostAddress = http://localhost:5045 + +GET {{Mercados.Api_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/src/Mercados.Api/Program.cs b/src/Mercados.Api/Program.cs new file mode 100644 index 0000000..ee9d65d --- /dev/null +++ b/src/Mercados.Api/Program.cs @@ -0,0 +1,41 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => +{ + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; +}) +.WithName("GetWeatherForecast"); + +app.Run(); + +record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} diff --git a/src/Mercados.Api/Properties/launchSettings.json b/src/Mercados.Api/Properties/launchSettings.json new file mode 100644 index 0000000..d9e0359 --- /dev/null +++ b/src/Mercados.Api/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5045", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7256;http://localhost:5045", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Mercados.Api/appsettings.Development.json b/src/Mercados.Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/Mercados.Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Mercados.Api/appsettings.json b/src/Mercados.Api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/Mercados.Api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/Mercados.Core/Class1.cs b/src/Mercados.Core/Class1.cs new file mode 100644 index 0000000..b48b8f0 --- /dev/null +++ b/src/Mercados.Core/Class1.cs @@ -0,0 +1,6 @@ +namespace Mercados.Core; + +public class Class1 +{ + +} diff --git a/src/Mercados.Core/Mercados.Core.csproj b/src/Mercados.Core/Mercados.Core.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/src/Mercados.Core/Mercados.Core.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/src/Mercados.Database/Class1.cs b/src/Mercados.Database/Class1.cs new file mode 100644 index 0000000..da9d75c --- /dev/null +++ b/src/Mercados.Database/Class1.cs @@ -0,0 +1,6 @@ +namespace Mercados.Database; + +public class Class1 +{ + +} diff --git a/src/Mercados.Database/Mercados.Database.csproj b/src/Mercados.Database/Mercados.Database.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/src/Mercados.Database/Mercados.Database.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/src/Mercados.Infrastructure/Class1.cs b/src/Mercados.Infrastructure/Class1.cs new file mode 100644 index 0000000..4a2d363 --- /dev/null +++ b/src/Mercados.Infrastructure/Class1.cs @@ -0,0 +1,6 @@ +namespace Mercados.Infrastructure; + +public class Class1 +{ + +} diff --git a/src/Mercados.Infrastructure/Mercados.Infrastructure.csproj b/src/Mercados.Infrastructure/Mercados.Infrastructure.csproj new file mode 100644 index 0000000..bfbcf29 --- /dev/null +++ b/src/Mercados.Infrastructure/Mercados.Infrastructure.csproj @@ -0,0 +1,13 @@ + + + + + + + + net9.0 + enable + enable + + + diff --git a/src/Mercados.Worker/Mercados.Worker.csproj b/src/Mercados.Worker/Mercados.Worker.csproj new file mode 100644 index 0000000..5648ea4 --- /dev/null +++ b/src/Mercados.Worker/Mercados.Worker.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + dotnet-Mercados.Worker-0e9a6e84-c8fb-400b-ba7b-193d9981a046 + + + + + + + + + + diff --git a/src/Mercados.Worker/Program.cs b/src/Mercados.Worker/Program.cs new file mode 100644 index 0000000..84690ec --- /dev/null +++ b/src/Mercados.Worker/Program.cs @@ -0,0 +1,7 @@ +using Mercados.Worker; + +var builder = Host.CreateApplicationBuilder(args); +builder.Services.AddHostedService(); + +var host = builder.Build(); +host.Run(); diff --git a/src/Mercados.Worker/Properties/launchSettings.json b/src/Mercados.Worker/Properties/launchSettings.json new file mode 100644 index 0000000..6280438 --- /dev/null +++ b/src/Mercados.Worker/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "Mercados.Worker": { + "commandName": "Project", + "dotnetRunMessages": true, + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Mercados.Worker/Worker.cs b/src/Mercados.Worker/Worker.cs new file mode 100644 index 0000000..0e00bb3 --- /dev/null +++ b/src/Mercados.Worker/Worker.cs @@ -0,0 +1,23 @@ +namespace Mercados.Worker; + +public class Worker : BackgroundService +{ + private readonly ILogger _logger; + + public Worker(ILogger logger) + { + _logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + if (_logger.IsEnabled(LogLevel.Information)) + { + _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); + } + await Task.Delay(1000, stoppingToken); + } + } +} diff --git a/src/Mercados.Worker/appsettings.Development.json b/src/Mercados.Worker/appsettings.Development.json new file mode 100644 index 0000000..b2dcdb6 --- /dev/null +++ b/src/Mercados.Worker/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/src/Mercados.Worker/appsettings.json b/src/Mercados.Worker/appsettings.json new file mode 100644 index 0000000..b2dcdb6 --- /dev/null +++ b/src/Mercados.Worker/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +}