Compare commits
15 Commits
152904671a
...
test/20250
Author | SHA1 | Date | |
---|---|---|---|
750bcc81ef | |||
258b4ebfec | |||
2360630544 | |||
1ded384fd7 | |||
67e7fe35f9 | |||
a223dfc7c0 | |||
c173cc3b3b | |||
f121899b3b | |||
523c147957 | |||
ffe955788f | |||
0a2353d738 | |||
09c211a0fe | |||
895e40edc0 | |||
0ba01a91fa | |||
2ea9b4363b |
35
.gitea/workflows/cleanup-tests-branches.yaml
Normal file
35
.gitea/workflows/cleanup-tests-branches.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Cleanup old test branches
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 12 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cleanup_branch:
|
||||||
|
runs-on: windows
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Delete test branches older than 7 days
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
# Obtener la fecha límite (7 días antes)
|
||||||
|
$limitDate = (Get-Date).AddDays(-7)
|
||||||
|
|
||||||
|
# Obtener todas las ramas remotas test/*
|
||||||
|
$branches = git branch -r | Where-Object { $_ -match 'origin/test/' }
|
||||||
|
|
||||||
|
foreach ($branch in $branches) {
|
||||||
|
$branchName = $branch.Trim() -replace '^origin/', ''
|
||||||
|
# Obtener fecha de creación de la rama (aproximación por el primer commit)
|
||||||
|
$firstCommitDate = git log $branchName --reverse --format="%ci" | Select-Object -First 1
|
||||||
|
$branchDate = Get-Date $firstCommitDate
|
||||||
|
|
||||||
|
if ($branchDate -lt $limitDate) {
|
||||||
|
Write-Host "Eliminando rama $branchName creada el $branchDate"
|
||||||
|
git push origin --delete $branchName
|
||||||
|
}
|
||||||
|
}
|
74
.gitea/workflows/construct-test.yaml
Normal file
74
.gitea/workflows/construct-test.yaml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
name: Create Test Construct
|
||||||
|
run-name: Creating test construct
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "Branch to build"
|
||||||
|
required: true
|
||||||
|
default: "dev"
|
||||||
|
schedule:
|
||||||
|
- cron: "0 12 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create_test_branch_and_build:
|
||||||
|
runs-on: windows
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout dev branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: dev
|
||||||
|
|
||||||
|
- name: Create test branch with date
|
||||||
|
id: create_branch
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$date = Get-Date -Format "yyyyMMdd"
|
||||||
|
$branchName = "test/$date"
|
||||||
|
git checkout -b $branchName
|
||||||
|
git push origin $branchName
|
||||||
|
Write-Output "::set-output name=branch::$branchName"
|
||||||
|
|
||||||
|
deploy_docs:
|
||||||
|
needs: create_test_branch_and_build
|
||||||
|
runs-on: windows
|
||||||
|
steps:
|
||||||
|
- name: Checkout test branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.create_branch.outputs.branch }}
|
||||||
|
|
||||||
|
- name: Deploy documentation
|
||||||
|
uses: ./.gitea/workflows/deploy-docs.yaml
|
||||||
|
with:
|
||||||
|
branch: ${{ steps.create_branch.outputs.branch }}
|
||||||
|
|
||||||
|
deploy_back:
|
||||||
|
needs: create_test_branch_and_build
|
||||||
|
runs-on: windows
|
||||||
|
steps:
|
||||||
|
- name: Checkout test branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.create_branch.outputs.branch }}
|
||||||
|
|
||||||
|
- name: Deploy .net project
|
||||||
|
uses: ./.gitea/workflows/deploy-back.yaml
|
||||||
|
with:
|
||||||
|
branch: ${{ steps.create_branch.outputs.branch }}
|
||||||
|
|
||||||
|
deploy_front:
|
||||||
|
needs: create_test_branch_and_build
|
||||||
|
runs-on: windows
|
||||||
|
steps:
|
||||||
|
- name: Checkout test branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.create_branch.outputs.branch }}
|
||||||
|
|
||||||
|
- name: Deploy front project
|
||||||
|
uses: ./.gitea/workflows/deploy-front.yaml
|
||||||
|
with:
|
||||||
|
branch: ${{ steps.create_branch.outputs.branch }}
|
49
.gitea/workflows/deploy-back.yaml
Normal file
49
.gitea/workflows/deploy-back.yaml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: Create Test Construct
|
||||||
|
run-name: Creating test construct
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches: [dev, "test/**"]
|
||||||
|
paths: ["back/**"]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "Branch to deploy"
|
||||||
|
required: true
|
||||||
|
default: "dev"
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_deploy:
|
||||||
|
runs-on: windows
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# build .net project
|
||||||
|
- name: Build .NET Project
|
||||||
|
run: |
|
||||||
|
dotnet restore
|
||||||
|
dotnet build
|
||||||
|
|
||||||
|
# deploy .net to iis site with path = "D:\iis\es\mcvingenieros\mmorales.photo\back"
|
||||||
|
- name: Deploy .net project to iis
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
# deploy to iis site back.mmorales.photo that has path = D:\iis\es\mcvingenieros\mmorales.photo\back\
|
||||||
|
$sourcePath = "D:\iis\es\mcvingenieros\mmorales.photo\back\bin\Release\net9.0\publish"
|
||||||
|
$destinationPath = "D:\iis\es\mcvingenieros\mmorales.photo\back\"
|
||||||
|
|
||||||
|
# Stop IIS site
|
||||||
|
Stop-WebAppPool -Name "mmorales.photo.back"
|
||||||
|
|
||||||
|
# Remove old files
|
||||||
|
Remove-Item -Path $destinationPath\* -Recurse -Force
|
||||||
|
|
||||||
|
# Copy new files
|
||||||
|
Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse
|
||||||
|
|
||||||
|
# Start IIS site
|
||||||
|
Start-WebAppPool -Name "mmorales.photo.back"
|
@@ -4,10 +4,10 @@ run-name: Deploying ${{ gitea.repository }} docs locally
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
types: [closed]
|
||||||
branches: [main]
|
branches: [master]
|
||||||
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [master]
|
||||||
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -15,6 +15,7 @@ on:
|
|||||||
description: "Branch to deploy"
|
description: "Branch to deploy"
|
||||||
required: true
|
required: true
|
||||||
default: "master"
|
default: "master"
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-docs:
|
deploy-docs:
|
||||||
|
48
.gitea/workflows/deploy-front.yaml
Normal file
48
.gitea/workflows/deploy-front.yaml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: deploy front
|
||||||
|
run-name: Deploy Frontend
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches: [dev, "test/**"]
|
||||||
|
paths: ["front/**"]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "Branch to deploy"
|
||||||
|
required: true
|
||||||
|
default: "dev"
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_deploy:
|
||||||
|
runs-on: windows
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# build angular
|
||||||
|
- name: Build Angular
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Deploy to IIS
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
# deploy to iis site front.mmorales.photo that has path = D:\iis\es\mcvingenieros\mmorales.photo\front\
|
||||||
|
$sourcePath = "D:\iis\es\mcvingenieros\mmorales.photo\front\dist"
|
||||||
|
$destinationPath = "D:\iis\es\mcvingenieros\mmorales.photo\front\"
|
||||||
|
|
||||||
|
# Stop IIS site
|
||||||
|
Stop-WebAppPool -Name "mmorales.photo.front"
|
||||||
|
|
||||||
|
# Remove old files
|
||||||
|
Remove-Item -Path $destinationPath\* -Recurse -Force
|
||||||
|
|
||||||
|
# Copy new files
|
||||||
|
Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse
|
||||||
|
|
||||||
|
# Start IIS site
|
||||||
|
Start-WebAppPool -Name "mmorales.photo.front"
|
12
back/Domain/ApplicationDbContext.cs
Normal file
12
back/Domain/ApplicationDbContext.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace back.Domain;
|
||||||
|
|
||||||
|
public class ApplicationDbContext : DbContext
|
||||||
|
{
|
||||||
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
||||||
|
{
|
||||||
|
Database.EnsureCreated();
|
||||||
|
Database.Migrate();
|
||||||
|
}
|
||||||
|
}
|
14
back/Domain/IEntity.cs
Normal file
14
back/Domain/IEntity.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace back.Domain;
|
||||||
|
|
||||||
|
public interface IEntity
|
||||||
|
{
|
||||||
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
string Id
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
20
back/Infrastructure/AutoMapperProfile.cs
Normal file
20
back/Infrastructure/AutoMapperProfile.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
namespace back.Infrastructure;
|
||||||
|
|
||||||
|
public class AutoMapperProfile : Profile
|
||||||
|
{
|
||||||
|
public AutoMapperProfile()
|
||||||
|
{
|
||||||
|
//CreateMap<Users, User>()
|
||||||
|
// .ForMember(dest => dest.UserId, opt => opt.MapFrom(src => src.UserId))
|
||||||
|
// .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName))
|
||||||
|
// .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName))
|
||||||
|
// .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.Email))
|
||||||
|
// .ForMember(dest => dest.BirthYear, opt => opt.MapFrom(src => src.Birthday.Year))
|
||||||
|
// .ForMember(dest => dest.BirthMonth, opt => opt.MapFrom(src => src.Birthday.Month))
|
||||||
|
// .ForMember(dest => dest.BirthDay, opt => opt.MapFrom(src => src.Birthday.Day))
|
||||||
|
// .ForMember(dest => dest.OccupationName, opt => opt.Ignore())
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
150
back/Program.cs
Normal file
150
back/Program.cs
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
using AutoMapper;
|
||||||
|
using back.Domain;
|
||||||
|
using back.Infrastructure;
|
||||||
|
using MCVIngenieros.Healthchecks;
|
||||||
|
using MediatR.Extensions.FluentValidation.AspNetCore;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using OpenTelemetry.Logs;
|
||||||
|
using OpenTelemetry.Metrics;
|
||||||
|
using OpenTelemetry.Resources;
|
||||||
|
using OpenTelemetry.Trace;
|
||||||
|
using Scalar.AspNetCore;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace back;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var configFiles = Path.Combine(AppContext.BaseDirectory, "configs");
|
||||||
|
if (!Directory.Exists(configFiles))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(configFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
|
||||||
|
|
||||||
|
var configurationBuilder = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.AddJsonFile($"appsettings.{environment}.json", optional: false, reloadOnChange: true);
|
||||||
|
|
||||||
|
var configs = Directory.GetFiles(configFiles, "*.json", SearchOption.AllDirectories);
|
||||||
|
foreach (var config in configs)
|
||||||
|
{
|
||||||
|
configurationBuilder.AddJsonFile(config, optional: true, reloadOnChange: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var configuration = configurationBuilder.Build();
|
||||||
|
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.MinimumLevel.Verbose()
|
||||||
|
.Enrich.FromLogContext()
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
builder.Configuration.AddConfiguration(configuration);
|
||||||
|
builder.Host.UseSerilog();
|
||||||
|
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||||
|
|
||||||
|
builder.Services.AddMediatR(cfg =>
|
||||||
|
{
|
||||||
|
cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddFluentValidation([typeof(Program).Assembly]);
|
||||||
|
builder.Services.AddAutoMapper(opts =>
|
||||||
|
{
|
||||||
|
opts.AddProfile<AutoMapperProfile>();
|
||||||
|
opts.AllowNullCollections = true;
|
||||||
|
opts.AllowNullDestinationValues = true;
|
||||||
|
opts.DestinationMemberNamingConvention = new PascalCaseNamingConvention();
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddHealthChecksSupport().DiscoverHealthChecks();
|
||||||
|
builder.Services.AddLogging();
|
||||||
|
builder.Logging.AddOpenTelemetry(options =>
|
||||||
|
{
|
||||||
|
options
|
||||||
|
.SetResourceBuilder(
|
||||||
|
ResourceBuilder.CreateDefault()
|
||||||
|
.AddService(AppDomain.CurrentDomain.FriendlyName))
|
||||||
|
.AddConsoleExporter();
|
||||||
|
});
|
||||||
|
builder.Services.AddOpenTelemetry()
|
||||||
|
.ConfigureResource(resource => resource.AddService(AppDomain.CurrentDomain.FriendlyName))
|
||||||
|
.WithTracing(tracing => tracing
|
||||||
|
.AddAspNetCoreInstrumentation()
|
||||||
|
.AddConsoleExporter())
|
||||||
|
.WithMetrics(metrics => metrics
|
||||||
|
.AddAspNetCoreInstrumentation()
|
||||||
|
.AddConsoleExporter());
|
||||||
|
|
||||||
|
builder.Services.AddDataProtection();
|
||||||
|
|
||||||
|
builder.Services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddDefaultPolicy(policy =>
|
||||||
|
{
|
||||||
|
policy
|
||||||
|
.WithOrigins(builder.Configuration.GetSection("AllowedHosts").Get<string[]>() ?? [])
|
||||||
|
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||||
|
.SetPreflightMaxAge(TimeSpan.FromMinutes(10))
|
||||||
|
.AllowCredentials()
|
||||||
|
.AllowAnyHeader()
|
||||||
|
.AllowAnyMethod();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
builder.Services.AddAntiforgery(options =>
|
||||||
|
{
|
||||||
|
options.HeaderName = "X-XSRF-TOKEN";
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddDbContext<ApplicationDbContext>(opts =>
|
||||||
|
{
|
||||||
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
|
opts.UseSqlite(connectionString);
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddControllers(options =>
|
||||||
|
{
|
||||||
|
options.Filters.Add(new Microsoft.AspNetCore.Mvc.RequireHttpsAttribute());
|
||||||
|
});
|
||||||
|
// 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.MapScalarApiReference("/api-docs", opt =>
|
||||||
|
{
|
||||||
|
opt.WithTitle("My API Documentation");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Fatal(ex, "Application start-up failed");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
back/Properties/launchSettings.json
Normal file
15
back/Properties/launchSettings.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "api-docs",
|
||||||
|
"applicationUrl": "https://localhost:7157",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
back/appsettings.Development.json
Normal file
9
back/appsettings.Development.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
9
back/appsettings.Production.json
Normal file
9
back/appsettings.Production.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "mmorales.photo"
|
||||||
|
}
|
8
back/appsettings.Staging.json
Normal file
8
back/appsettings.Staging.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
back/appsettings.json
Normal file
3
back/appsettings.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
70
back/back.csproj
Normal file
70
back/back.csproj
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Autofac" Version="8.4.0" />
|
||||||
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Autofac.WebApi2" Version="6.1.1" />
|
||||||
|
<PackageReference Include="FluentValidation" Version="12.0.0" />
|
||||||
|
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
|
||||||
|
<PackageReference Include="MCVIngenieros.Healthchecks" Version="0.0.1" />
|
||||||
|
<PackageReference Include="MediatR" Version="13.0.0" />
|
||||||
|
<PackageReference Include="MediatR.Contracts" Version="2.0.1" />
|
||||||
|
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="13.1.0" />
|
||||||
|
<PackageReference Include="MediatR.Extensions.FluentValidation.AspNetCore" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.3.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Abstractions" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Extensions" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.8">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||||
|
<PackageReference Include="OpenTelemetry" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Api" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Api.ProviderBuilderExtensions" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
||||||
|
<PackageReference Include="Scalar.AspNetCore" Version="2.7.2" />
|
||||||
|
<PackageReference Include="Scalar.AspNetCore.Microsoft" Version="2.7.2" />
|
||||||
|
<PackageReference Include="Scalar.AspNetCore.Swashbuckle" Version="2.7.2" />
|
||||||
|
<PackageReference Include="Serilog" Version="4.3.0" />
|
||||||
|
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Enrichers.Process" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.2" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.OpenTelemetry" Version="4.2.0" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="9.0.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Application\" />
|
||||||
|
<Folder Include="Infrastructure\" />
|
||||||
|
<Folder Include="Presentation\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
25
back/back.sln
Normal file
25
back/back.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.14.36401.2 d17.14
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "back", "back.csproj", "{C78E8225-44D3-434B-AC2A-C8F4459BB18C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C78E8225-44D3-434B-AC2A-C8F4459BB18C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C78E8225-44D3-434B-AC2A-C8F4459BB18C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C78E8225-44D3-434B-AC2A-C8F4459BB18C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C78E8225-44D3-434B-AC2A-C8F4459BB18C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {D5ABA005-3E91-4220-9B2C-874C0BED7E34}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
15
back/configs/healthchecks.json
Normal file
15
back/configs/healthchecks.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"HealthChecksConfigs": {
|
||||||
|
"CacheDuration": "00:30:00",
|
||||||
|
"Timeout": "00:00:05",
|
||||||
|
"AssembliesToScan": [
|
||||||
|
"back"
|
||||||
|
]
|
||||||
|
//"MyCheck": {
|
||||||
|
// "RetryAttempts": 2,
|
||||||
|
// "Timeout": "00:05:00",
|
||||||
|
// "RetryDelay": "00:00:10",
|
||||||
|
// "Severity": "Info"
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
41
back/configs/serilog.json
Normal file
41
back/configs/serilog.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.OpenTelemetry" ],
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Information"
|
||||||
|
},
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "Console"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"path": "Logs/log-.txt",
|
||||||
|
"rollingInterval": "Day",
|
||||||
|
"fileSizeLimitBytes": 5242880,
|
||||||
|
"rollOnFileSizeLimit": true,
|
||||||
|
"retainedFileCountLimit": 31,
|
||||||
|
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "OpenTelemetry",
|
||||||
|
"Args": {
|
||||||
|
"endpoint": "http://localhost:4317",
|
||||||
|
"protocol": "Grpc",
|
||||||
|
"resourceAttributes": {
|
||||||
|
"service.name": "back.mmorales.photo",
|
||||||
|
"deployment.environment": "development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Enrich": [
|
||||||
|
"FromLogContext",
|
||||||
|
"WithThreadId",
|
||||||
|
"WithProcessId",
|
||||||
|
"WithEnvironmentName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
51
docs/gitflow.md
Normal file
51
docs/gitflow.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Galerias Fotograficas -- Git flow
|
||||||
|
|
||||||
|
Para poder aportar al desarrollo de nuevas funcionalidades en las galerías fotográficas, todos los cambios pasan un flujo de tests al hacer push sobre cualqueir rama.
|
||||||
|
|
||||||
|
Cuando se hace push sobre una rama, se hará un merge de `dev` automaticamente. Tras este merge, se comprobará que no hayan conflictos.
|
||||||
|
Justo después, se compilará el back, el front, los tests y los documentos. En caso de que alguno de estos pasos falle, se notificará al desarrollador responsable para que pueda solucionarlo.
|
||||||
|
Una vez al dia, se realizará una revisión de las ramas en `dev` para generar una rama `staging/{date}` que se publicará con los cambios del día anterior, siempre y cuando hayan conseguido pasar todos los tests.
|
||||||
|
|
||||||
|
Para poder aportar sobre nuevas funcionalidades, se deben seguir los siguientes pasos:
|
||||||
|
|
||||||
|
1. Crear una nueva rama a partir de `dev` que se llame `feature/[nombre-de-la-funcionalidad]`.
|
||||||
|
2. Realizar los cambios necesarios en la nueva rama.
|
||||||
|
3. Hacer push de la rama al repositorio remoto.
|
||||||
|
4. Crear un Pull Request (PR) para que los cambios sean revisados e integrados en `dev`.
|
||||||
|
|
||||||
|
Una vez que el PR sea aprobado, los cambios se fusionarán en `dev`.
|
||||||
|
|
||||||
|
Se seguirá el siguiente flujo:
|
||||||
|
|
||||||
|
gitGraph
|
||||||
|
commit
|
||||||
|
branch develop
|
||||||
|
checkout develop
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
checkout develop
|
||||||
|
branch "feature/one"
|
||||||
|
checkout develop
|
||||||
|
commit
|
||||||
|
checkout "feature/one"
|
||||||
|
commit
|
||||||
|
checkout develop
|
||||||
|
branch "feature/two"
|
||||||
|
checkout develop
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
checkout "feature/two"
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
merge develop
|
||||||
|
checkout develop
|
||||||
|
merge "feature/two"
|
||||||
|
checkout "feature/one"
|
||||||
|
commit
|
||||||
|
merge develop
|
||||||
|
checkout develop
|
||||||
|
merge "feature/one"
|
||||||
|
commit
|
||||||
|
checkout main
|
||||||
|
merge develop id: "release" tag: "release/{date}"
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Reference in New Issue
Block a user