Merge branch 'Feature/program-manager/move' of https://github.com/samsyntax24/OriginalGozareshgir into Feature/program-manager/move
This commit is contained in:
@@ -198,7 +198,8 @@ public class AuthHelper : IAuthHelper
|
||||
new("workshopList",workshopBson),
|
||||
new("WorkshopSlug",slug),
|
||||
new("WorkshopId", account.WorkshopId.ToString()),
|
||||
new("WorkshopName",account.WorkshopName??"")
|
||||
new("WorkshopName",account.WorkshopName??""),
|
||||
new("pm.userId", account.PmUserId?.ToString() ?? "0"),
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -27,10 +27,12 @@ public class AuthViewModel
|
||||
#endregion
|
||||
|
||||
public long SubAccountId { get; set; }
|
||||
public long? PmUserId { get; set; }
|
||||
|
||||
|
||||
public AuthViewModel(long id, long roleId, string fullname, string username, string mobile,string profilePhoto,
|
||||
List<int> permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue, long subAccountId = 0)
|
||||
List<int> permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue,
|
||||
long subAccountId = 0,long? pmUserId = null)
|
||||
{
|
||||
Id = id;
|
||||
RoleId = roleId;
|
||||
@@ -44,6 +46,7 @@ public class AuthViewModel
|
||||
ClientAriaPermission = clientAriaPermission;
|
||||
PositionValue = positionValue;
|
||||
SubAccountId = subAccountId;
|
||||
PmUserId = pmUserId;
|
||||
}
|
||||
|
||||
public AuthViewModel()
|
||||
|
||||
@@ -34,6 +34,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AccountManagement.Application.Contracts.ProgramManager;
|
||||
using Shared.Contracts.PmUser;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
//using AccountManagement.Domain.RoleAgg;
|
||||
@@ -58,9 +59,10 @@ public class AccountApplication : IAccountApplication
|
||||
private readonly ISubAccountPermissionSubtitle1Repository _accountPermissionSubtitle1Repository;
|
||||
private readonly IPmUserRepository _pmUserRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IPmUserQueryService _pmUserQueryService;
|
||||
|
||||
public AccountApplication(IAccountRepository accountRepository, IPasswordHasher passwordHasher,
|
||||
IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository, ISubAccountRepository subAccountRepository, ISubAccountRoleRepository subAccountRoleRepository, IWorkshopSubAccountRepository workshopSubAccountRepository, ISubAccountPermissionSubtitle1Repository accountPermissionSubtitle1Repository, IUnitOfWork unitOfWork, IPmUserRepository pmUserRepository)
|
||||
IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository, ISubAccountRepository subAccountRepository, ISubAccountRoleRepository subAccountRoleRepository, IWorkshopSubAccountRepository workshopSubAccountRepository, ISubAccountPermissionSubtitle1Repository accountPermissionSubtitle1Repository, IUnitOfWork unitOfWork, IPmUserRepository pmUserRepository, IPmUserQueryService pmUserQueryService)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_roleRepository = roleRepository;
|
||||
@@ -75,6 +77,7 @@ public class AccountApplication : IAccountApplication
|
||||
_accountPermissionSubtitle1Repository = accountPermissionSubtitle1Repository;
|
||||
_unitOfWork = unitOfWork;
|
||||
_pmUserRepository = pmUserRepository;
|
||||
_pmUserQueryService = pmUserQueryService;
|
||||
_fileUploader = fileUploader;
|
||||
_passwordHasher = passwordHasher;
|
||||
_accountRepository = accountRepository;
|
||||
@@ -463,8 +466,11 @@ public class AccountApplication : IAccountApplication
|
||||
{
|
||||
positionValue = null;
|
||||
}
|
||||
var pmUserId = _pmUserQueryService.GetCurrentPmUserIdFromAccountId(account.id).GetAwaiter().GetResult();
|
||||
var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname
|
||||
, account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, account.AdminAreaPermission, account.ClientAriaPermission, positionValue);
|
||||
, account.Username, account.Mobile, account.ProfilePhoto,
|
||||
permissions, account.RoleName, account.AdminAreaPermission,
|
||||
account.ClientAriaPermission, positionValue,0,pmUserId);
|
||||
|
||||
if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" &&
|
||||
account.IsActiveString == "true")
|
||||
|
||||
@@ -20,12 +20,14 @@ using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Services.Authentication;
|
||||
using GozareshgirProgramManager.Infrastructure.Services.Role;
|
||||
using GozareshgirProgramManager.Infrastructure.Services.User;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Shared.Contracts.PmRole.Commands;
|
||||
using Shared.Contracts.PmRole.Queries;
|
||||
using Shared.Contracts.PmUser;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure;
|
||||
|
||||
@@ -93,6 +95,7 @@ public static class DependencyInjection
|
||||
services.AddTransient<IPmRoleQueryService, PmRoleQueryService>();
|
||||
|
||||
services.AddTransient<IPmRoleCommandService, PmRoleCommandService>();
|
||||
services.AddTransient<IPmUserQueryService, PmUserQueryService>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Queries.GetSingleUser;
|
||||
using MediatR;
|
||||
using Shared.Contracts.PmUser;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Services.User;
|
||||
|
||||
public class PmUserQueryService : IPmUserQueryService
|
||||
{
|
||||
public readonly IMediator _mediator;
|
||||
|
||||
public PmUserQueryService(IMediator mediator)
|
||||
{
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
public async Task<long?> GetCurrentPmUserIdFromAccountId(long accountId)
|
||||
{
|
||||
var query = new GetSingleUserQuery(accountId.ToString());
|
||||
var result = await _mediator.Send(query);
|
||||
return result.Data?.AccountId ?? null;
|
||||
}
|
||||
}
|
||||
6
Shared.Contracts/PmUser/IPmUserQueryService.cs
Normal file
6
Shared.Contracts/PmUser/IPmUserQueryService.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Shared.Contracts.PmUser;
|
||||
|
||||
public interface IPmUserQueryService
|
||||
{
|
||||
Task<long?> GetCurrentPmUserIdFromAccountId(long accountId);
|
||||
}
|
||||
Reference in New Issue
Block a user