feat: Initial project structure setup with solution and projects

This commit is contained in:
2025-07-01 10:46:13 -03:00
parent 3170aa4010
commit 76635a0da9
19 changed files with 327 additions and 0 deletions

99
Mercados-Web.sln Normal file
View File

@@ -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

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mercados.Infrastructure\Mercados.Infrastructure.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,6 @@
@Mercados.Api_HostAddress = http://localhost:5045
GET {{Mercados.Api_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@@ -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);
}

View File

@@ -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"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -0,0 +1,6 @@
namespace Mercados.Core;
public class Class1
{
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,6 @@
namespace Mercados.Database;
public class Class1
{
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,6 @@
namespace Mercados.Infrastructure;
public class Class1
{
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Mercados.Core\Mercados.Core.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-Mercados.Worker-0e9a6e84-c8fb-400b-ba7b-193d9981a046</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mercados.Infrastructure\Mercados.Infrastructure.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
using Mercados.Worker;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
host.Run();

View File

@@ -0,0 +1,12 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"Mercados.Worker": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,23 @@
namespace Mercados.Worker;
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
public Worker(ILogger<Worker> 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);
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}