feat: restructure ProgramManager area and integrate Shared.Contracts
This commit is contained in:
@@ -42,16 +42,7 @@ public static class DependencyInjection
|
||||
// Register IAppDbContext
|
||||
services.AddScoped<IProgramManagerDbContext>(provider =>
|
||||
provider.GetRequiredService<ProgramManagerDbContext>());
|
||||
|
||||
|
||||
|
||||
#region GozareshgirDbContext
|
||||
|
||||
services.AddDbContext<GozareshgirDbContext>(x => x.UseSqlServer(configuration.GetConnectionString("GozareshgirDb")));
|
||||
|
||||
services.AddScoped<IGozareshgirDbContext>(provider =>
|
||||
provider.GetRequiredService<GozareshgirDbContext>());
|
||||
#endregion
|
||||
|
||||
// Unit of Work
|
||||
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.HolidayAgg;
|
||||
using GozareshgirProgramManager.Domain.HolidayItemAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
|
||||
public class GozareshgirDbContext : DbContext, IGozareshgirDbContext
|
||||
{
|
||||
public GozareshgirDbContext(DbContextOptions<GozareshgirDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<HolidayItem> HolidayItems { get; set; } = null!;
|
||||
public DbSet<Holiday> Holidays { get; set; } = null!;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(GozareshgirDbContext).Assembly);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class AuthHelper : IAuthHelper
|
||||
/// </summary>
|
||||
public long? GetCurrentUserId()
|
||||
{
|
||||
var userIdClaim = _httpContextAccessor.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
var userIdClaim = _httpContextAccessor.HttpContext?.User?.FindFirst("pm.userId")?.Value;
|
||||
return long.TryParse(userIdClaim, out var userId) ? userId : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user