Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
echo off
|
||||||
|
echo "dotnet ef migrations add InitialCreate --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
|
||||||
|
echo "dotnet ef database update --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
|
||||||
|
echo "dotnet ef migrations remove --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
|
||||||
|
pause
|
||||||
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.BL", "WorkFlo
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Common", "WorkFlowCheck.Common\WorkFlowCheck.Common.csproj", "{7F94D6CB-3358-4687-88E1-FA46053D6B71}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Common", "WorkFlowCheck.Common\WorkFlowCheck.Common.csproj", "{7F94D6CB-3358-4687-88E1-FA46053D6B71}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Web", "WorkFlowCheck.Web\WorkFlowCheck.Web.csproj", "{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -39,6 +41,10 @@ Global
|
|||||||
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.Build.0 = Release|Any CPU
|
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -9,22 +9,23 @@ using Serilog;
|
|||||||
using WorkFlowCheck.BL.Mappings;
|
using WorkFlowCheck.BL.Mappings;
|
||||||
using WorkFlowCheck.BL.Infra;
|
using WorkFlowCheck.BL.Infra;
|
||||||
using WorkFlowCheck.DL.Seed;
|
using WorkFlowCheck.DL.Seed;
|
||||||
|
using WorkFlowCheck.Common.RequestContext;
|
||||||
|
using WorkFlowCheck.API.RequestContext;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.ReadFrom.Configuration(builder.Configuration)
|
.ReadFrom.Configuration(builder.Configuration)
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddAutoMapper(typeof(MapperProfile));
|
builder.Services.AddAutoMapper(typeof(MapperProfile));
|
||||||
|
builder.Services.AddMemoryCache();
|
||||||
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
builder.Services.AddScoped<IRequestContext, HttpRequestContext>();
|
||||||
|
|
||||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
|
|
||||||
builder.Services.AddDbContext<AppDbContext>(options =>
|
builder.Services.AddDbContext<AppDbContext>(options =>
|
||||||
options.UseSqlServer(connectionString));
|
options.UseSqlServer(connectionString, x => x.MigrationsAssembly("WorkFlowCheck.DL")));
|
||||||
//DI
|
//DI
|
||||||
|
|
||||||
DIConfig.DIInit(builder.Services);
|
DIConfig.DIInit(builder.Services);
|
||||||
@@ -74,7 +75,13 @@ builder.Services.AddControllers()
|
|||||||
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddDefaultPolicy(policy =>
|
||||||
|
{
|
||||||
|
policy.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
@@ -95,11 +102,11 @@ if (app.Environment.IsDevelopment())
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Routing és endpointok
|
// Routing és endpointok
|
||||||
app.UseHttpsRedirection();
|
//app.UseHttpsRedirection();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseMiddleware<ApiKeyMiddleware>();
|
app.UseMiddleware<ApiKeyMiddleware>();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
app.UseCors();
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using WorkFlowCheck.Common.Constants;
|
||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
using WorkFlowCheck.Common.RequestContext;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.API.RequestContext
|
||||||
|
{
|
||||||
|
public class HttpRequestContext : IRequestContext
|
||||||
|
{
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IMemoryCache _memoryCache;
|
||||||
|
|
||||||
|
public HttpRequestContext(IHttpContextAccessor httpContextAccessor, IMemoryCache memoryCache)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_memoryCache = memoryCache;
|
||||||
|
|
||||||
|
TraceId = Activity.Current?.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TraceId { get; }
|
||||||
|
|
||||||
|
public int? CurrentUserId => CurrentDbUser?.Id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public string CurrentUsername => CurrentHttpUser?.Identity.Name;
|
||||||
|
public string CurrentUserEmail => CurrentHttpUser?.FindFirst(System.Security.Claims.ClaimTypes.Email)?.Value;
|
||||||
|
public CancellationToken RequestAborted => _httpContextAccessor.HttpContext.RequestAborted;
|
||||||
|
|
||||||
|
private UserDTO CurrentDbUser => _memoryCache.Get<UserDTO>(MemoryCacheNames.UsersNamePrefix + CurrentUserEmail);
|
||||||
|
|
||||||
|
private ClaimsPrincipal CurrentHttpUser => _httpContextAccessor.HttpContext.User;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFC;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
"DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFCUAT;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
||||||
},
|
},
|
||||||
"ApiKey": "RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=",
|
"ApiKey": "RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace WorkFlowCheck.BL.Mappings
|
|||||||
CreateMap<UserDTO, User>()
|
CreateMap<UserDTO, User>()
|
||||||
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
|
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
|
||||||
|
|
||||||
|
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Common.Constants
|
||||||
|
{
|
||||||
|
public static class MemoryCacheNames
|
||||||
|
{
|
||||||
|
public const string UsersNamePrefix = "Users_";
|
||||||
|
public const string TranslationsNamePrefix = "Translations_";
|
||||||
|
public const string Languages = "Languages";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Common.DTO
|
||||||
|
{
|
||||||
|
public class CheckListTemplateHeaderDTO
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShortName { get; set; } = null!;
|
||||||
|
public string Description { get; set; } = null!;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Common.RequestContext
|
||||||
|
{
|
||||||
|
public interface IRequestContext
|
||||||
|
{
|
||||||
|
string TraceId { get; }
|
||||||
|
|
||||||
|
string CurrentUsername { get; }
|
||||||
|
string CurrentUserEmail { get; }
|
||||||
|
int? CurrentUserId { get; }
|
||||||
|
CancellationToken RequestAborted { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,109 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.Common.RequestContext;
|
||||||
using WorkFlowCheck.DL.Configurations;
|
using WorkFlowCheck.DL.Configurations;
|
||||||
|
using WorkFlowCheck.DL.Extensions;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
namespace WorkFlowCheck.DL
|
namespace WorkFlowCheck.DL
|
||||||
{
|
{
|
||||||
public class AppDbContext : DbContext
|
public class AppDbContext : DbContext
|
||||||
{
|
{
|
||||||
|
private readonly IRequestContext _requestContext;
|
||||||
|
|
||||||
|
#if !DEBUG
|
||||||
|
public AppDbContext(DbContextOptions<AppDbContext> options, IRequestContext requestContext)
|
||||||
|
: base(options)
|
||||||
|
{
|
||||||
|
_requestContext = requestContext;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if DEBUG
|
||||||
public AppDbContext(DbContextOptions<AppDbContext> options)
|
public AppDbContext(DbContextOptions<AppDbContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
|
var _requestContext = new { CurrentUserEmail = "", CurrentUsername = "", TraceId = 0 };
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#region Entities DbSet
|
||||||
|
public DbSet<Entities.CheckListHeader> CheckListHeaders { get; set; } = null!;
|
||||||
|
public DbSet<Entities.CheckListTemplateHeader> CheckListTemplateHeaders { get; set; } = null!;
|
||||||
|
public DbSet<Entities.CheckListTemplateRow> CheckListTemplateRows { get; set; } = null!;
|
||||||
|
public DbSet<Entities.CheckPoint> CheckPoints { get; set; } = null!;
|
||||||
|
public DbSet<Entities.Equipment> Equipments { get; set; } = null!;
|
||||||
|
public DbSet<Entities.Location> Locations { get; set; } = null!;
|
||||||
|
public DbSet<Entities.Role> Roles { get; set; } = null!;
|
||||||
public DbSet<Entities.User> Users { get; set; } = null!;
|
public DbSet<Entities.User> Users { get; set; } = null!;
|
||||||
|
public DbSet<Entities.UsersCheckListTemplateHeader> UsersCheckListTemplateHeaders { get; set; } = null!;
|
||||||
|
#endregion
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration());
|
||||||
|
modelBuilder.ApplyConfiguration(new LocationTypeConfiguration());
|
||||||
modelBuilder.ApplyConfiguration(new UserTypeConfiguration());
|
modelBuilder.ApplyConfiguration(new UserTypeConfiguration());
|
||||||
|
|
||||||
|
modelBuilder.RegisterSoftDeleteQueryFilters();
|
||||||
|
}
|
||||||
|
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
SaveChangesCore();
|
||||||
|
return await base.SaveChangesAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
protected virtual void SaveChangesCore()
|
||||||
|
{
|
||||||
|
var utcNow = DateTime.UtcNow;
|
||||||
|
|
||||||
|
var deletedEntries = ChangeTracker
|
||||||
|
.Entries()
|
||||||
|
.Where(e => e.Entity is ISoftDeletableEntity && e.State == EntityState.Deleted);
|
||||||
|
|
||||||
|
UpdateDeletedEntries(deletedEntries);
|
||||||
|
|
||||||
|
var modifiedEntries = ChangeTracker
|
||||||
|
.Entries()
|
||||||
|
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Modified);
|
||||||
|
|
||||||
|
UpdateModifiedEntires(modifiedEntries, utcNow);
|
||||||
|
|
||||||
|
var addedEntries = ChangeTracker
|
||||||
|
.Entries()
|
||||||
|
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Added);
|
||||||
|
|
||||||
|
UpdateAddedEntries(addedEntries, utcNow);
|
||||||
|
}
|
||||||
|
private void UpdateAddedEntries(IEnumerable<EntityEntry> addedEntries, DateTime utcNow)
|
||||||
|
{
|
||||||
|
foreach (var entry in addedEntries)
|
||||||
|
{
|
||||||
|
((IAuditableEntity)entry.Entity).CreatedAt = utcNow;
|
||||||
|
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
|
||||||
|
((IAuditableEntity)entry.Entity).CreatedBy = _requestContext.CurrentUsername;
|
||||||
|
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateModifiedEntires(IEnumerable<EntityEntry> modifiedEntries, DateTime utcNow)
|
||||||
|
{
|
||||||
|
foreach (var entry in modifiedEntries)
|
||||||
|
{
|
||||||
|
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
|
||||||
|
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UpdateDeletedEntries(IEnumerable<EntityEntry> deletedEntries)
|
||||||
|
{
|
||||||
|
foreach (var entry in deletedEntries)
|
||||||
|
{
|
||||||
|
((ISoftDeletableEntity)entry.Entity).IsDeleted = true;
|
||||||
|
entry.State = EntityState.Modified;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Configurations
|
||||||
|
{
|
||||||
|
public class EquipmentTypeConfiguration : IEntityTypeConfiguration<Entities.Equipment>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Entities.Equipment> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("Equipment");
|
||||||
|
builder.HasKey(e => e.Id);
|
||||||
|
builder.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Configurations
|
||||||
|
{
|
||||||
|
public class LocationTypeConfiguration : IEntityTypeConfiguration<Entities.Location>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Entities.Location> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("Location");
|
||||||
|
builder.HasKey(e => e.Id);
|
||||||
|
builder.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Configurations
|
||||||
|
{
|
||||||
|
public class RoleTypeConfiguration : IEntityTypeConfiguration<Entities.Role>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Entities.Role> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("Roles");
|
||||||
|
builder.HasKey(e => e.Id);
|
||||||
|
builder.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Configurations
|
||||||
|
{
|
||||||
|
public class UsersCheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.UsersCheckListTemplateHeader>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Entities.UsersCheckListTemplateHeader> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("UsersCheckListTemplateHeader");
|
||||||
|
builder.HasKey(e => e.Id);
|
||||||
|
builder.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class CheckListHeader : IAuditableEntity, ISoftDeletableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShortName { get; set; } = null!;
|
||||||
|
public string Description { get; set; } = null!;
|
||||||
|
public string DocumentNumber { get; set; } = null!;
|
||||||
|
public bool IsStorno { get; set; }
|
||||||
|
public DateTime LastModAt { get; set; }
|
||||||
|
public string LastModBy { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class CheckListTemplateHeader:ISoftDeletableEntity,IAuditableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShortName { get; set; } = null!;
|
||||||
|
public string Description { get; set; } = null!;
|
||||||
|
public bool IsDeleted { get ; set ; }
|
||||||
|
public DateTime LastModAt { get ; set ; }
|
||||||
|
public string LastModBy { get ; set ; }
|
||||||
|
public DateTime CreatedAt { get ; set ; }
|
||||||
|
public string CreatedBy { get ; set ; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class CheckListTemplateRow : ISoftDeletableEntity, IAuditableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int RowIndex { get; set; }
|
||||||
|
public int CheckListTemplateHeaderId { get; set; }
|
||||||
|
public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; }
|
||||||
|
public int EquipmentId { get; set; }
|
||||||
|
public virtual Equipment Equipment { get; set; }
|
||||||
|
public int CheckPointId { get; set; }
|
||||||
|
public virtual CheckPoint EquipmentPoint { get; set; }
|
||||||
|
public string OperationDescription { get; set; }
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
|
||||||
|
public DateTime LastModAt { get; set; }
|
||||||
|
public string LastModBy { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class CheckPoint : ISoftDeletableEntity, IAuditableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShortName { get; set; }
|
||||||
|
public string Code { get; set; }
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
public DateTime LastModAt { get; set; }
|
||||||
|
public string LastModBy { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class Equipment :ISoftDeletableEntity,IAuditableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShortName { get; set; }
|
||||||
|
public string EquipmentNumber { get; set; }
|
||||||
|
public bool IsDeleted { get ; set ; }
|
||||||
|
public DateTime LastModAt { get ; set ; }
|
||||||
|
public string LastModBy { get ; set ; }
|
||||||
|
public DateTime CreatedAt { get ; set ; }
|
||||||
|
public string CreatedBy { get ; set ; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class Location : ISoftDeletableEntity, IAuditableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string FullName { get; set; } = null!;
|
||||||
|
public bool IsDeleted { get ; set ; }
|
||||||
|
public DateTime LastModAt { get ; set ; }
|
||||||
|
public string LastModBy { get ; set ; }
|
||||||
|
public DateTime CreatedAt { get ; set ; }
|
||||||
|
public string CreatedBy { get ; set ; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class Role :ISoftDeletableEntity,IAuditableEntity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string RoleName { get; set; }
|
||||||
|
public bool IsDeleted { get ; set ; }
|
||||||
|
public DateTime LastModAt { get ; set ; }
|
||||||
|
public string LastModBy { get ; set ; }
|
||||||
|
public DateTime CreatedAt { get ; set ; }
|
||||||
|
public string CreatedBy { get ; set ; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
namespace WorkFlowCheck.DL.Entities
|
namespace WorkFlowCheck.DL.Entities
|
||||||
{
|
{
|
||||||
public class User
|
public class User:IAuditableEntity,ISoftDeletableEntity
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Email { get; set; } = null!;
|
public string Email { get; set; } = null!;
|
||||||
@@ -10,5 +11,10 @@ namespace WorkFlowCheck.DL.Entities
|
|||||||
public string LastName { get; set; } = null!;
|
public string LastName { get; set; } = null!;
|
||||||
public string UserName { get; set; } = null!;
|
public string UserName { get; set; } = null!;
|
||||||
public string? PasswordHash { get; set; } = null;
|
public string? PasswordHash { get; set; } = null;
|
||||||
|
public DateTime LastModAt { get ; set ; }
|
||||||
|
public string LastModBy { get ; set ; }
|
||||||
|
public DateTime CreatedAt { get ; set ; }
|
||||||
|
public string CreatedBy { get ; set ; }
|
||||||
|
public bool IsDeleted { get ; set ; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class UsersCheckListTemplateHeader
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int UsersId { get; set; }
|
||||||
|
public virtual User User { get; set; }
|
||||||
|
public int CheckListTemplateHeaderId { get; set; }
|
||||||
|
public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; }
|
||||||
|
public bool Enabled { get; set; } = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.DL.Interfaces;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Extensions
|
||||||
|
{
|
||||||
|
public static class DbContextExtensions
|
||||||
|
{
|
||||||
|
public static void RegisterSoftDeleteQueryFilters(this ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
foreach (var entityType in modelBuilder.Model.GetEntityTypes().Where(e => typeof(ISoftDeletableEntity).IsAssignableFrom(e.ClrType)))
|
||||||
|
{
|
||||||
|
var parameter = Expression.Parameter(entityType.ClrType);
|
||||||
|
|
||||||
|
var softDeletableProperty = Expression.Property(parameter, nameof(ISoftDeletableEntity.IsDeleted));
|
||||||
|
var compareExpression = Expression.MakeBinary(ExpressionType.Equal, softDeletableProperty, Expression.Constant(false));
|
||||||
|
var lambda = Expression.Lambda(compareExpression, parameter);
|
||||||
|
|
||||||
|
modelBuilder.Entity(entityType.ClrType).HasQueryFilter(lambda);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Interfaces
|
||||||
|
{
|
||||||
|
public interface IAuditableEntity
|
||||||
|
{
|
||||||
|
public DateTime LastModAt { get; set; }
|
||||||
|
public string LastModBy { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Interfaces
|
||||||
|
{
|
||||||
|
public interface ISoftDeletableEntity
|
||||||
|
{
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.12" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.12" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.12">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
@page
|
||||||
|
@model ErrorModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
@if (Model.ShowRequestId)
|
||||||
|
{
|
||||||
|
<p>
|
||||||
|
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||||
|
It can result in displaying sensitive information from exceptions to end users.
|
||||||
|
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||||
|
and restarting the app.
|
||||||
|
</p>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Web.Pages
|
||||||
|
{
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
[IgnoreAntiforgeryToken]
|
||||||
|
public class ErrorModel : PageModel
|
||||||
|
{
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||||
|
|
||||||
|
private readonly ILogger<ErrorModel> _logger;
|
||||||
|
|
||||||
|
public ErrorModel(ILogger<ErrorModel> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
@page
|
||||||
|
@model IndexModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Welcome</h1>
|
||||||
|
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Web.Pages
|
||||||
|
{
|
||||||
|
public class IndexModel : PageModel
|
||||||
|
{
|
||||||
|
private readonly ILogger<IndexModel> _logger;
|
||||||
|
|
||||||
|
public IndexModel(ILogger<IndexModel> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@page
|
||||||
|
@model PrivacyModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Privacy Policy";
|
||||||
|
}
|
||||||
|
<h1>@ViewData["Title"]</h1>
|
||||||
|
|
||||||
|
<p>Use this page to detail your site's privacy policy.</p>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Web.Pages
|
||||||
|
{
|
||||||
|
public class PrivacyModel : PageModel
|
||||||
|
{
|
||||||
|
private readonly ILogger<PrivacyModel> _logger;
|
||||||
|
|
||||||
|
public PrivacyModel(ILogger<PrivacyModel> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - WorkFlowCheck.Web</title>
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||||
|
<link rel="stylesheet" href="~/WorkFlowCheck.Web.styles.css" asp-append-version="true" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" asp-area="" asp-page="/Index">WorkFlowCheck.Web</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||||
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||||
|
<ul class="navbar-nav flex-grow-1">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<main role="main" class="pb-3">
|
||||||
|
@RenderBody()
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="border-top footer text-muted">
|
||||||
|
<div class="container">
|
||||||
|
© 2025 - WorkFlowCheck.Web - <a asp-area="" asp-page="/Privacy">Privacy</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||||
|
for details on configuring this project to bundle and minify static web assets. */
|
||||||
|
|
||||||
|
a.navbar-brand {
|
||||||
|
white-space: normal;
|
||||||
|
text-align: center;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #0077cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-top {
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.border-bottom {
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-shadow {
|
||||||
|
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||||
|
}
|
||||||
|
|
||||||
|
button.accept-policy {
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
line-height: 60px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||||
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@using WorkFlowCheck.Web
|
||||||
|
@namespace WorkFlowCheck.Web.Pages
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Serilog;
|
||||||
|
using WorkFlowCheck.BL.Infra;
|
||||||
|
using WorkFlowCheck.BL.Mappings;
|
||||||
|
using WorkFlowCheck.DL;
|
||||||
|
using WorkFlowCheck.DL.Seed;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(builder.Configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
builder.Services.AddAutoMapper(typeof(MapperProfile));
|
||||||
|
builder.Services.AddMemoryCache();
|
||||||
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|
||||||
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
|
builder.Services.AddDbContext<AppDbContext>(options =>
|
||||||
|
options.UseSqlServer(connectionString, x => x.MigrationsAssembly("WorkFlowCheck.DL")));
|
||||||
|
//DI
|
||||||
|
|
||||||
|
DIConfig.DIInit(builder.Services);
|
||||||
|
|
||||||
|
builder.Host.UseSerilog();
|
||||||
|
// Add services to the container.
|
||||||
|
builder.Services.AddRazorPages();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
using (var scope = app.Services.CreateScope())
|
||||||
|
{
|
||||||
|
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||||
|
DBInitializer.Seed(context);
|
||||||
|
}
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (!app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Error");
|
||||||
|
// 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.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapRazorPages();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:52256",
|
||||||
|
"sslPort": 44330
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:5258",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:7041;http://localhost:5258",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WorkFlowCheck.BL\WorkFlowCheck.BL.csproj" />
|
||||||
|
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"DetailedErrors": true,
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFCUAT;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
||||||
|
},
|
||||||
|
"ApiKey": "RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=",
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Serilog": {
|
||||||
|
"MinimumLevel": "Information",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "Console"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"path": "logs/log-.log",
|
||||||
|
"rollingInterval": "Day"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
html {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||||
|
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin-bottom: 60px;
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||||
|
// for details on configuring this project to bundle and minify static web assets.
|
||||||
|
|
||||||
|
// Write your JavaScript code.
|
||||||
Reference in New Issue
Block a user