feat: introduce Shared.Contracts for account management and refactor related services
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\0_Framework\0_Framework.csproj" />
|
||||
<ProjectReference Include="..\Shared.Contracts\Shared.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -32,9 +32,11 @@ using AccountManagement.Domain.TicketAccessAccountAgg;
|
||||
using AccountManagement.Domain.TicketAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using AccountMangement.Infrastructure.EFCore.Repository;
|
||||
using AccountMangement.Infrastructure.EFCore.Services;
|
||||
using Company.Domain.WorkshopAccountAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Shared.Contracts.Account;
|
||||
using TaskManager.Application;
|
||||
using TaskManager.Infrastructure.EFCore.Repository;
|
||||
|
||||
@@ -46,6 +48,7 @@ namespace AccountManagement.Configuration
|
||||
{
|
||||
services.AddTransient<IAccountApplication, AccountApplication>();
|
||||
services.AddTransient<IAccountRepository, AccountRepository>();
|
||||
services.AddTransient<IAccountQueryService, AccountQueryService>();
|
||||
|
||||
services.AddTransient<IRoleApplication, RoleApplication>();
|
||||
services.AddTransient<IRoleRepository, RoleRepository>();
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AccountManagement.Application.Contracts\AccountManagement.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\AccountManagement.Domain\AccountManagement.Domain.csproj" />
|
||||
<ProjectReference Include="..\Company.Domain\Company.Domain.csproj" />
|
||||
<ProjectReference Include="..\Shared.Contracts\Shared.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace AccountMangement.Infrastructure.EFCore.Services;
|
||||
|
||||
public class AccountQueryService : IAccountQueryService
|
||||
{
|
||||
private readonly AccountContext _accountContext;
|
||||
|
||||
public AccountQueryService(AccountContext accountContext)
|
||||
{
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
|
||||
public async Task<AccountBasicDto> GetAccountAsync(long accountId)
|
||||
{
|
||||
return await _accountContext.Accounts
|
||||
.Where(x => x.id == accountId)
|
||||
.Select(x => new AccountBasicDto
|
||||
{
|
||||
Id = x.id,
|
||||
Username = x.Username,
|
||||
Fullname = x.Fullname,
|
||||
IsActive = x.IsActiveString == "true"
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<List<AccountBasicDto>> GetProgramManagerAccountListAsync(List<long> accountIds)
|
||||
{
|
||||
var ids = accountIds?.ToHashSet() ?? new HashSet<long>();
|
||||
if (ids.Count == 0)
|
||||
return [];
|
||||
|
||||
return await _accountContext.Accounts
|
||||
.Where(x => ids.Contains(x.id))
|
||||
.Select(x => new AccountBasicDto
|
||||
{
|
||||
Id = x.id,
|
||||
Username = x.Username,
|
||||
Fullname = x.Fullname,
|
||||
IsActive = x.IsActiveString == "true"
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -104,128 +104,378 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GozareshgirProgramManager.D
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GozareshgirProgramManager.Infrastructure", "ProgramManager\src\Infrastructure\GozareshgirProgramManager.Infrastructure\GozareshgirProgramManager.Infrastructure.csproj", "{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.Contracts", "Shared.Contracts\Shared.Contracts.csproj", "{37F4BC4C-B620-4EFA-B4A7-A9797289E901}"
|
||||
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
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CB6E0A25-B826-4EB0-80CD-D926B1A3D5D5}.Release|x86.Build.0 = Release|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Release|x64.Build.0 = Release|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{26316896-07EB-4D55-AA88-17A57EF615DD}.Release|x86.Build.0 = Release|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Release|x64.Build.0 = Release|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{618761ED-3835-4C52-A91F-2240FAE39A71}.Release|x86.Build.0 = Release|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0AF931F3-B576-4B42-80EC-CD19BAD3F95F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Release|x64.Build.0 = Release|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0327F97A-D526-4BD7-92A3-E5B36BB30AC5}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AB39F1D0-7164-489F-9524-67AEC1DF78B4}.Release|x86.Build.0 = Release|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Release|x64.Build.0 = Release|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{35B6B963-974A-4414-8609-B0668181FA64}.Release|x86.Build.0 = Release|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{68D25B12-9F11-454B-BD3A-C96EBBC888F8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Release|x64.Build.0 = Release|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C2EBA38E-5C71-4457-BA80-283FB6A848AC}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E2251AF9-237D-4F63-A3D4-6B9C270D0ED8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1D38F80F-8400-43C2-88B3-D2A369AAF1F0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{55799DFE-885F-4B35-AFEE-0D0CE24E6ED9}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F138CA45-A2CA-4C77-B8AA-5AC6B4ECB834}.Release|x86.Build.0 = Release|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|x86.Build.0 = Release|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|x64.Build.0 = Release|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|x86.Build.0 = Release|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|x64.Build.0 = Release|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|x86.Build.0 = Release|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{339E05B6-E99F-4403-AFDF-CD0540E96C8D}.Release|x86.Build.0 = Release|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{02892882-2A02-484B-BAF9-7E63F6BDCFA0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BF98173C-42AF-4897-A7CB-4CACEB2B52A2}.Release|x86.Build.0 = Release|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|x64.Build.0 = Release|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{97E148FA-3C36-40DD-B121-D90C1C0F3B47}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4CDAA60E-C7DD-4883-85CC-E7E26CCC6ED3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F78FBB92-294B-88BA-168D-F0C578B0D7D6}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B57EB542-C028-4A77-9386-9DFF1E60FDCB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D2B4F1D7-6336-4B30-910C-219F4119303F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{408281FE-615F-4CBE-BD95-2E86F5ACC6C3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Release|x64.Build.0 = Release|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{37F4BC4C-B620-4EFA-B4A7-A9797289E901}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Shared.Contracts\Shared.Contracts.csproj" />
|
||||
<ProjectReference Include="..\..\Domain\GozareshgirProgramManager.Domain\GozareshgirProgramManager.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PersianTools.Core;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
||||
|
||||
@@ -14,12 +15,14 @@ namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUse
|
||||
public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGroupCreatingQuery, GetUserToGroupCreatingResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IGozareshgirDbContext _gozareshgirDbContext;
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public GetUserToGroupCreatingQueryHandler(IProgramManagerDbContext context, IGozareshgirDbContext gozareshgirDbContext)
|
||||
public GetUserToGroupCreatingQueryHandler(
|
||||
IProgramManagerDbContext context,
|
||||
IAccountQueryService accountQueryService)
|
||||
{
|
||||
_context = context;
|
||||
_gozareshgirDbContext = gozareshgirDbContext;
|
||||
_accountQueryService = accountQueryService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetUserToGroupCreatingResponse>> Handle(GetUserToGroupCreatingQuery request, CancellationToken cancellationToken)
|
||||
@@ -50,36 +53,47 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
||||
var lastMonthStart = lastMonth;
|
||||
var lastMonthEnd = lastMonth;
|
||||
|
||||
// دریافت لیست تنظیمات حقوق با Checkout ها
|
||||
var settingsAndCheckouts = await (
|
||||
from s in _context.SalaryPaymentSettings
|
||||
|
||||
var query =
|
||||
await (from u in _context.Users
|
||||
|
||||
// LEFT JOIN
|
||||
// تنظیمات حقوق
|
||||
join s in _context.SalaryPaymentSettings
|
||||
on u.Id equals s.AccountId into sJoin
|
||||
from s in sJoin.DefaultIfEmpty()
|
||||
|
||||
// LEFT JOIN
|
||||
//فیش
|
||||
// LEFT JOIN با Checkouts
|
||||
join ch in _context.Checkouts
|
||||
.Where(x => x.CheckoutStartDate < lastMonthStart
|
||||
&& x.CheckoutEndDate >= lastMonthStart)
|
||||
on u.Id equals ch.UserId into chJoin
|
||||
on s.AccountId equals ch.UserId into chJoin
|
||||
from ch in chJoin.DefaultIfEmpty()
|
||||
|
||||
group new { s, ch } by new { u.Id, u.FullName } into g
|
||||
|
||||
select new GetUserWhoHaveSettingsAndCheckoutDto
|
||||
select new
|
||||
{
|
||||
UserId = g.Key.Id,
|
||||
FullName = g.Key.FullName,
|
||||
|
||||
HasSalarySettings = g.Any(x => x.s != null),
|
||||
HasCheckout = g.Any(x => x.ch != null)
|
||||
AccountId = s.AccountId,
|
||||
HasCheckout = ch != null
|
||||
})
|
||||
.GroupBy(x => x.AccountId)
|
||||
.Select(g => new
|
||||
{
|
||||
AccountId = g.Key,
|
||||
HasCheckout = g.Any(x => x.HasCheckout)
|
||||
})
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
// دریافت اطلاعات Account ها از AccountManagement
|
||||
var accountIds = settingsAndCheckouts.Select(x => x.AccountId).Distinct().ToList();
|
||||
var accounts = await _accountQueryService.GetProgramManagerAccountListAsync(accountIds);
|
||||
var accountsDict = accounts.ToDictionary(a => a.Id);
|
||||
|
||||
// ترکیب دادهها
|
||||
var query = settingsAndCheckouts
|
||||
.Where(x => accountsDict.ContainsKey(x.AccountId))
|
||||
.Select(x => new GetUserWhoHaveSettingsAndCheckoutDto
|
||||
{
|
||||
UserId = x.AccountId,
|
||||
FullName = accountsDict[x.AccountId].Fullname,
|
||||
HasSalarySettings = true, // چون از SalaryPaymentSettings اومده پس حتماً تنظیمات داره
|
||||
HasCheckout = x.HasCheckout
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.TransferSection;
|
||||
|
||||
@@ -10,15 +10,15 @@ public class TransferSectionCommandHandler : IBaseCommandHandler<TransferSection
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly ITaskSectionRepository _taskSectionRepository;
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public TransferSectionCommandHandler(
|
||||
ITaskSectionRepository taskSectionRepository,
|
||||
IUserRepository userRepository,
|
||||
IAccountQueryService accountQueryService,
|
||||
IUnitOfWork unitOfWork)
|
||||
{
|
||||
_taskSectionRepository = taskSectionRepository;
|
||||
_userRepository = userRepository;
|
||||
_accountQueryService = accountQueryService;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
@@ -31,16 +31,16 @@ public class TransferSectionCommandHandler : IBaseCommandHandler<TransferSection
|
||||
return OperationResult.NotFound("بخش پروژه یافت نشد");
|
||||
}
|
||||
|
||||
// بررسی وجود کاربر مبدا
|
||||
var fromUser = await _userRepository.GetByIdAsync(request.FromUserId);
|
||||
if (fromUser == null)
|
||||
// بررسی وجود حساب مبدا
|
||||
var fromAccount = await _accountQueryService.GetAccountAsync(request.FromUserId);
|
||||
if (fromAccount == null)
|
||||
{
|
||||
return OperationResult.NotFound($"کاربر مبدا با شناسه {request.FromUserId} یافت نشد");
|
||||
}
|
||||
|
||||
// بررسی وجود کاربر مقصد
|
||||
var toUser = await _userRepository.GetByIdAsync(request.ToUserId);
|
||||
if (toUser == null)
|
||||
// بررسی وجود حساب مقصد
|
||||
var toAccount = await _accountQueryService.GetAccountAsync(request.ToUserId);
|
||||
if (toAccount == null)
|
||||
{
|
||||
return OperationResult.NotFound($"کاربر مقصد با شناسه {request.ToUserId} یافت نشد");
|
||||
}
|
||||
@@ -66,4 +66,3 @@ public class TransferSectionCommandHandler : IBaseCommandHandler<TransferSection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
|
||||
|
||||
@@ -8,11 +9,13 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
{
|
||||
private readonly IProgramManagerDbContext _programManagerDbContext;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public ProjectBoardListQueryHandler(IProgramManagerDbContext programManagerDbContext, IAuthHelper authHelper)
|
||||
public ProjectBoardListQueryHandler(IProgramManagerDbContext programManagerDbContext, IAuthHelper authHelper, IAccountQueryService accountQueryService)
|
||||
{
|
||||
_programManagerDbContext = programManagerDbContext;
|
||||
_authHelper = authHelper;
|
||||
_accountQueryService = accountQueryService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<List<ProjectBoardListResponse>>> Handle(ProjectBoardListQuery request,
|
||||
@@ -30,10 +33,9 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var activityUserIds = data.SelectMany(x => x.Activities).Select(a => a.UserId).Distinct().ToList();
|
||||
var users = await _programManagerDbContext.Users.AsNoTracking()
|
||||
.Where(x => activityUserIds.Contains(x.Id))
|
||||
.Select(x => new { x.Id, x.FullName })
|
||||
.ToDictionaryAsync(x => x.Id, x => x.FullName, cancellationToken);
|
||||
// Fetch account basics in batch and map to FullName
|
||||
var accounts = await _accountQueryService.GetProgramManagerAccountListAsync(activityUserIds);
|
||||
var users = accounts.ToDictionary(a => a.Id, a => a.Fullname);
|
||||
|
||||
var result = data.Select(x =>
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using DNTPersianUtils.Core;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.SetTimeProject;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectSetTimeDetails;
|
||||
|
||||
@@ -14,10 +12,12 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
: IBaseQueryHandler<ProjectSetTimeDetailsQuery, ProjectSetTimeResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public ProjectSetTimeDetailsQueryHandler(IProgramManagerDbContext context)
|
||||
public ProjectSetTimeDetailsQueryHandler(IProgramManagerDbContext context, IAccountQueryService accountQueryService)
|
||||
{
|
||||
_context = context;
|
||||
_accountQueryService = accountQueryService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<ProjectSetTimeResponse>> Handle(ProjectSetTimeDetailsQuery request,
|
||||
@@ -36,10 +36,10 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
var userIds = task.Sections.Select(x => x.OriginalAssignedUserId)
|
||||
.Distinct().ToList();
|
||||
|
||||
var users = await _context.Users
|
||||
.Where(x => userIds.Contains(x.Id))
|
||||
.AsNoTracking()
|
||||
.ToListAsync(cancellationToken);
|
||||
// Fetch account basics in batch (instead of _context.Users)
|
||||
var accounts = await _accountQueryService.GetProgramManagerAccountListAsync(userIds);
|
||||
var accountDict = accounts.ToDictionary(a => a.Id);
|
||||
|
||||
var skillIds = task.Sections.Select(x => x.SkillId)
|
||||
.Distinct().ToList();
|
||||
|
||||
@@ -51,8 +51,8 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
var res = new ProjectSetTimeResponse(
|
||||
task.Sections.Select(ts =>
|
||||
{
|
||||
var user = users.FirstOrDefault(x => x.Id == ts.OriginalAssignedUserId);
|
||||
var skill = skills.FirstOrDefault(x => x.Id == ts.SkillId);
|
||||
var account = accountDict.GetValueOrDefault(ts.OriginalAssignedUserId);
|
||||
return new ProjectSetTimeResponseSections
|
||||
{
|
||||
AdditionalTimes = ts.AdditionalTimes
|
||||
@@ -65,7 +65,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
SkillName = skill?.Name ?? "",
|
||||
TotalAdditionalTime = (int)ts.GetTotalAdditionalTime().TotalHours,
|
||||
TotalEstimateTime = (int)ts.FinalEstimatedHours.TotalHours,
|
||||
UserName = user?.UserName ?? "",
|
||||
UserName = account?.Username ?? "",
|
||||
SectionId = ts.Id,
|
||||
InitialDescription = ts.InitialDescription ?? "",
|
||||
InitialTime = (int)ts.InitialEstimatedHours.TotalHours
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.PermissionAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Roles.Commands.CreateRole;
|
||||
|
||||
public class CreateRoleCommandHandler : IBaseCommandHandler<CreateRoleCommand>
|
||||
{
|
||||
private readonly IRoleRepository _roleRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public CreateRoleCommandHandler(IRoleRepository roleRepository, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_roleRepository = roleRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(CreateRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if(string.IsNullOrWhiteSpace(request.RoleName))
|
||||
return OperationResult.Failure("نام نقش خالی است");
|
||||
if(!request.Permissions.Any())
|
||||
return OperationResult.Failure("هیچ دسترسی داده نشده است");
|
||||
var permissions = request.Permissions.Where(x => x > 0).Select(x => new Permission(x)).ToList();
|
||||
|
||||
var role = new Role(request.RoleName, request.GozareshgirRoleId, permissions);
|
||||
await _roleRepository.CreateAsync(role);
|
||||
await _unitOfWork.SaveChangesAsync();
|
||||
return OperationResult.Success();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public record CreateRoleCommand : IBaseCommand
|
||||
{
|
||||
public string RoleName { get; set; }
|
||||
public List<int> Permissions { get; set; }
|
||||
|
||||
public long? GozareshgirRoleId { get; set; }
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.PermissionAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Roles.Commands.EditRole;
|
||||
|
||||
public class EditRoleCommandHandler : IBaseCommandHandler<EditRoleCommand>
|
||||
{
|
||||
private readonly IRoleRepository _roleRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public EditRoleCommandHandler(IRoleRepository roleRepository, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_roleRepository = roleRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(EditRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_roleRepository.Exists(x => x.RoleName == request.RoleName && x.GozareshgirRoleId != request.GozareshgirRoleId))
|
||||
return OperationResult.Failure("نام نقش تکراری است");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.RoleName))
|
||||
return OperationResult.Failure("نام نقش خالی است");
|
||||
|
||||
if(request.GozareshgirRoleId == null || request.GozareshgirRoleId == 0)
|
||||
return OperationResult.Failure("آی دی نقش از سمت گزارشگیر خالی است");
|
||||
|
||||
var permissions = request.Permissions.Where(x => x > 0).Select(x => new Permission(x)).ToList();
|
||||
|
||||
|
||||
var role =await _roleRepository.GetByGozareshgirRoleIdAsync(request.GozareshgirRoleId);
|
||||
|
||||
if (role != null)
|
||||
{
|
||||
role?.Edit(request.RoleName, permissions);
|
||||
|
||||
await _unitOfWork.SaveChangesAsync();
|
||||
}
|
||||
|
||||
return OperationResult.Success();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public record EditRoleCommand : IBaseCommand
|
||||
{
|
||||
public string RoleName { get; set; }
|
||||
public List<int> Permissions { get; set; }
|
||||
|
||||
public long? GozareshgirRoleId { get; set; }
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Roles.Queries.GetRoles;
|
||||
|
||||
public class GetRolesQueryHandler : IBaseQueryHandler<GetRolesQuery, GetRolesResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public GetRolesQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetRolesResponse>> Handle(GetRolesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = _context.Roles.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.RoleName))
|
||||
query = query.Where(x => x.RoleName.Contains(request.RoleName));
|
||||
if (request.GozareshgirRoleId > 0)
|
||||
query = query.Where(x => x.GozareshgirRoleId == request.GozareshgirRoleId);
|
||||
|
||||
var roles = await query
|
||||
.Select(p => new GetRolesDto()
|
||||
{
|
||||
Id = p.Id,
|
||||
RoleName = p.RoleName,
|
||||
GozareshgirRoleId = p.GozareshgirRoleId,
|
||||
Permissions = p.Permissions.Select(x=>x.Code).ToList()
|
||||
|
||||
})
|
||||
.ToListAsync(cancellationToken);
|
||||
if(!roles.Any())
|
||||
return OperationResult<GetRolesResponse>.NotFound("یافت نشد");
|
||||
|
||||
var response = new GetRolesResponse(
|
||||
roles
|
||||
);
|
||||
|
||||
return OperationResult<GetRolesResponse>.Success(response);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public record GetRolesQuery(string? RoleName, long? GozareshgirRoleId) : IBaseQuery<GetRolesResponse>;
|
||||
|
||||
public record GetRolesResponse(List<GetRolesDto> Role);
|
||||
|
||||
public record GetRolesDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی نقش
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام نقش
|
||||
/// </summary>
|
||||
public string RoleName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی نقش در گزارشگیر
|
||||
/// </summary>
|
||||
public long? GozareshgirRoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لیست کدهای دسترسی
|
||||
/// </summary>
|
||||
public List<int> Permissions { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,33 +3,36 @@ using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Commands.CreateSalarySettings;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetSalarySettingToEdit;
|
||||
|
||||
public class GetSalarySettingToEditQueryHandler : IBaseQueryHandler<GetSalarySettingToEditQuery, GetSalarySettingToEditResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public GetSalarySettingToEditQueryHandler(IProgramManagerDbContext context)
|
||||
public GetSalarySettingToEditQueryHandler(IProgramManagerDbContext context, IAccountQueryService accountQueryService)
|
||||
{
|
||||
_context = context;
|
||||
_accountQueryService = accountQueryService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetSalarySettingToEditResponse>> Handle(GetSalarySettingToEditQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var user =await _context.Users.FirstOrDefaultAsync(x => x.Id == request.UserId);
|
||||
if(user == null)
|
||||
// دریافت اطلاعات حساب از AccountManagement
|
||||
var account = await _accountQueryService.GetAccountAsync(request.UserId);
|
||||
if (account == null)
|
||||
return OperationResult<GetSalarySettingToEditResponse>.NotFound("کاربر یافت نشد");
|
||||
|
||||
var editSalarySettingsList = await _context.SalaryPaymentSettings
|
||||
.Where(x => x.AccountId == request.UserId)
|
||||
.Select(x => new GetSalarySettingToEdit()
|
||||
{
|
||||
Id = x.Id,
|
||||
HolidayWorking = x.HolidayWorking,
|
||||
UserId = x.AccountId,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
|
||||
WorkingHoursList = x.WorkingHoursList.Select(wh => new WorkingHoursListDto
|
||||
{
|
||||
StartShiftOne = wh.HasShiftOne ? wh.StartShiftOne.ToString(@"hh\:mm") : null,
|
||||
@@ -44,12 +47,16 @@ public class GetSalarySettingToEditQueryHandler : IBaseQueryHandler<GetSalarySet
|
||||
IsActiveDay = wh.IsActiveDay
|
||||
}).OrderBy(wh => wh.PersianDayOfWeek).ToList(),
|
||||
|
||||
}).FirstOrDefaultAsync(x => x.UserId == request.UserId);
|
||||
}).FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
var response = new GetSalarySettingToEditResponse(request.UserId,user.FullName,editSalarySettingsList);
|
||||
if (editSalarySettingsList == null)
|
||||
{
|
||||
return OperationResult<GetSalarySettingToEditResponse>.NotFound("تنظیمات مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
var response = new GetSalarySettingToEditResponse(request.UserId, account.Fullname, editSalarySettingsList);
|
||||
|
||||
return OperationResult<GetSalarySettingToEditResponse>.Success(response);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +64,6 @@ public record GetSalarySettingToEditResponse(long UserId, string FullName, GetSa
|
||||
|
||||
public record GetSalarySettingToEditQuery(long UserId) : IBaseQuery<GetSalarySettingToEditResponse>;
|
||||
|
||||
|
||||
public record GetSalarySettingToEdit
|
||||
{
|
||||
/// <summary>
|
||||
@@ -77,12 +83,10 @@ public record GetSalarySettingToEdit
|
||||
/// <summary>
|
||||
/// حقوق ماهانه
|
||||
/// </summary>
|
||||
public string MonthlySalary { get; set; }
|
||||
public string MonthlySalary { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// لیست روزهای هفته و ساعات کاری
|
||||
/// </summary>
|
||||
public List<WorkingHoursListDto> WorkingHoursList { get; set; }
|
||||
public List<WorkingHoursListDto> WorkingHoursList { get; set; } = new();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,62 +4,71 @@ using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
|
||||
|
||||
public class GetUserListWhoHaveSettingsQueryHandler : IBaseQueryHandler<GetUserListWhoHaveSettingsQuery, GetUserListWhoHaveSettingsResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public GetUserListWhoHaveSettingsQueryHandler(IProgramManagerDbContext context)
|
||||
public GetUserListWhoHaveSettingsQueryHandler(IProgramManagerDbContext context, IAccountQueryService accountQueryService)
|
||||
{
|
||||
_context = context;
|
||||
_accountQueryService = accountQueryService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetUserListWhoHaveSettingsResponse>> Handle(GetUserListWhoHaveSettingsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = await (
|
||||
from u in _context.Users
|
||||
join s in _context.SalaryPaymentSettings
|
||||
on u.Id equals s.AccountId into settingsGroup
|
||||
select new GetUserWhoHaveSettingsDto
|
||||
// Get all salary settings
|
||||
var allSettings = await _context.SalaryPaymentSettings.ToListAsync(cancellationToken);
|
||||
|
||||
// Get all unique account IDs
|
||||
var accountIds = allSettings.Select(s => s.AccountId).Distinct().ToList();
|
||||
|
||||
// Get all user data in one batch through AccountQueryService
|
||||
var accounts = await _accountQueryService.GetProgramManagerAccountListAsync(accountIds);
|
||||
var accountDictionary = accounts.ToDictionary(a => a.Id, a => a);
|
||||
|
||||
// Map settings to DTOs
|
||||
var userSettingsQuery = allSettings
|
||||
.Where(setting => accountDictionary.ContainsKey(setting.AccountId))
|
||||
.Select(setting =>
|
||||
{
|
||||
UserId = u.Id,
|
||||
FullName = u.FullName,
|
||||
HasSalarySettings = settingsGroup.Any(),
|
||||
MontlySalary = settingsGroup.Any() ? settingsGroup.FirstOrDefault().MonthlySalary.ToMoney() : "",
|
||||
WeeklyWorkingTimeAvrageInt = settingsGroup
|
||||
.SelectMany(x => x.WorkingHoursList)
|
||||
.Sum(w => (int?)w.ShiftDurationInMinutes) ?? 0
|
||||
}
|
||||
).ToListAsync(cancellationToken);
|
||||
var userBasic = accountDictionary[setting.AccountId];
|
||||
return new GetUserWhoHaveSettingsDto
|
||||
{
|
||||
UserId = userBasic.Id,
|
||||
FullName = userBasic.Fullname,
|
||||
HasSalarySettings = true,
|
||||
MontlySalary = setting.MonthlySalary.ToMoney(),
|
||||
WeeklyWorkingTimeAvrageInt = setting.WorkingHoursList?.Sum(w => (int?)w.ShiftDurationInMinutes) ?? 0
|
||||
};
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var list = userSettingsQuery;
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.FullName))
|
||||
query = query.Where(x => x.FullName.Contains(request.FullName)).ToList();
|
||||
list = list.Where(x => x.FullName.Contains(request.FullName)).ToList();
|
||||
|
||||
if (request.HasSalarySettings != HasSalarySettings.Default)
|
||||
{
|
||||
bool hasSettings = request.HasSalarySettings == HasSalarySettings.HasSettings;
|
||||
|
||||
query = query.Where(x => x.HasSalarySettings == hasSettings).ToList();
|
||||
list = list.Where(x => x.HasSalarySettings == hasSettings).ToList();
|
||||
}
|
||||
|
||||
var operationQuery = query.Select(user =>
|
||||
var operationQuery = list.Select(user =>
|
||||
{
|
||||
var weeklyWorkingTimeAvrage = user.WeeklyWorkingTimeAvrageInt.ConvertIntDurationToHoursAndMinutes();
|
||||
|
||||
return new GetUserWhoHaveSettingsDto
|
||||
{
|
||||
UserId = user.UserId,
|
||||
FullName = user.FullName,
|
||||
HasSalarySettings = user.HasSalarySettings,
|
||||
MontlySalary = user.MontlySalary,
|
||||
WeeklyWorkingTimeAvrageInt = user.WeeklyWorkingTimeAvrageInt,
|
||||
WeeklyWorkingTimeAvrage = weeklyWorkingTimeAvrage
|
||||
};
|
||||
return user with { WeeklyWorkingTimeAvrage = weeklyWorkingTimeAvrage };
|
||||
}).ToList();
|
||||
|
||||
var response = new GetUserListWhoHaveSettingsResponse(operationQuery);
|
||||
|
||||
return OperationResult<GetUserListWhoHaveSettingsResponse>.Success(response);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
|
||||
|
||||
public record CreateUserCommand(string FullName, string UserName, string Password, string Mobile, string? Email, long? AccountId, List<long> Roles) : IBaseCommand;
|
||||
@@ -1,43 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
|
||||
|
||||
public class CreateUserCommandHandler : IBaseCommandHandler<CreateUserCommand>
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public CreateUserCommandHandler(IUnitOfWork unitOfWork, IUserRepository userRepository)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_userRepository = userRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(CreateUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
#region CustomValidation
|
||||
if (_userRepository.Exists(x => x.FullName == request.FullName))
|
||||
return OperationResult.Failure("نام و خانوادگی تکراری است");
|
||||
if (_userRepository.Exists(x => x.UserName == request.UserName))
|
||||
return OperationResult.Failure("نام کاربری تکراری است");
|
||||
if (_userRepository.Exists(x=> !string.IsNullOrWhiteSpace(x.Mobile) && x.Mobile == request.Mobile))
|
||||
return OperationResult.ValidationError("این شماره همراه قبلا به فرد دیگری اختصاص داده شده است");
|
||||
if(request.AccountId == 0)
|
||||
return OperationResult.Failure("آی دی اکانت، از سمت گزارشگیر صفر است");
|
||||
#endregion
|
||||
|
||||
var userRoles = request.Roles.Where(x => x > 0).Select(x => new RoleUser(x)).ToList() ;
|
||||
var create = new User(request.FullName, request.UserName, request.Password, request.Mobile,
|
||||
request.Email, request?.AccountId, userRoles);
|
||||
|
||||
await _userRepository.CreateAsync(create);
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
return OperationResult.Success();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
|
||||
|
||||
public class CreateUserCommandValidators : AbstractValidator<CreateUserCommand>
|
||||
{
|
||||
public CreateUserCommandValidators()
|
||||
{
|
||||
RuleFor(x => x.FullName)
|
||||
.NotEmpty()
|
||||
.NotNull()
|
||||
.WithMessage("نام و نام خانوادگی نمی تواند خالی باشد");
|
||||
|
||||
RuleFor(x => x.Mobile)
|
||||
.NotNull().NotEmpty().WithMessage("شماره همراه نمی تواند خالی باشد");
|
||||
RuleFor(x=>x.Mobile)
|
||||
.Length(11).WithMessage("طول شماره همراه می بایست 11 رقم باشد");
|
||||
RuleFor(x => x.UserName)
|
||||
.NotEmpty().NotNull().WithMessage("نام کاربری نمیتوان خالی باشد");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.EditUser;
|
||||
|
||||
public class EditUserCommandHandler :IBaseCommandHandler<EditUserCommand>
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public EditUserCommandHandler(IUserRepository userRepository, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(EditUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var user = await _userRepository.GetByGozareshgirAccountId(request.AccountId);
|
||||
if (user != null)
|
||||
{
|
||||
var userRoles = request.Roles.Where(x => x > 0).Select(x => new RoleUser(x)).ToList();
|
||||
user.Edit(request.FullName, request.UserName, request.Mobile, userRoles, request.IsActive);
|
||||
await _unitOfWork.SaveChangesAsync();
|
||||
}
|
||||
|
||||
return OperationResult.Success();
|
||||
}
|
||||
}
|
||||
|
||||
public record EditUserCommand(string FullName, string UserName, string Mobile,long AccountId, List<long> Roles, bool IsActive) : IBaseCommand;
|
||||
@@ -1,11 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using MediatR;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.LoginUser;
|
||||
|
||||
/// <summary>
|
||||
/// دستور ورود کاربر به سیستم
|
||||
/// </summary>
|
||||
public record LoginUserCommand(long UserId) : IBaseCommand<LoginResponse>;
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.LoginUser;
|
||||
|
||||
/// <summary>
|
||||
/// Handler برای ورود کاربر به سیستم
|
||||
/// </summary>
|
||||
public class LoginUserCommandHandler : IRequestHandler<LoginUserCommand, OperationResult<LoginResponse>>
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IUserRefreshTokenRepository _refreshTokenRepository;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public LoginUserCommandHandler(
|
||||
IUserRepository userRepository,
|
||||
IAuthHelper authHelper,
|
||||
IUnitOfWork unitOfWork, IUserRefreshTokenRepository refreshTokenRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
_authHelper = authHelper;
|
||||
_unitOfWork = unitOfWork;
|
||||
_refreshTokenRepository = refreshTokenRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<LoginResponse>> Handle(LoginUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
// اعتبارسنجی
|
||||
if (request.UserId <= 0)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("شناسه کاربری معتبر نیست", ErrorType.BadRequest);
|
||||
}
|
||||
|
||||
// یافتن کاربر
|
||||
var user = await _userRepository.GetUserWithRolesByIdAsync(request.UserId, cancellationToken);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("کاربر یافت نشد", ErrorType.NotFound);
|
||||
}
|
||||
|
||||
// بررسی فعال بودن کاربر
|
||||
if (!user.IsActive)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("حساب کاربری غیرفعال است", ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
// تولید توکنها با استفاده از AuthHelper
|
||||
var roles = user.RoleUser
|
||||
.Select(r => r.RoleId.ToString()).ToList();
|
||||
|
||||
var session = _authHelper.SignIn(
|
||||
user.Id,
|
||||
user.UserName,
|
||||
user.FullName,
|
||||
user.AccountId??0,
|
||||
roles);
|
||||
// دریافت اطلاعات درخواست با استفاده از AuthHelper
|
||||
var ipAddress = _authHelper.GetClientIpAddress();
|
||||
var userAgent = _authHelper.GetUserAgent();
|
||||
|
||||
// ذخیره Refresh Token در دیتابیس
|
||||
//user.AddRefreshToken(refreshToken, refreshTokenExpiration, ipAddress, userAgent);
|
||||
|
||||
var refreshTokenEntity = new UserRefreshToken(
|
||||
user.Id,
|
||||
session.RefreshToken,
|
||||
session.RefreshTokenExpiration,
|
||||
ipAddress,
|
||||
userAgent);
|
||||
|
||||
await _refreshTokenRepository.CreateAsync(refreshTokenEntity);
|
||||
|
||||
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
|
||||
|
||||
// ساخت پاسخ (RefreshToken به فرانت داده نمیشود)
|
||||
var response = new LoginResponse
|
||||
{
|
||||
AccessToken = session.AccessToken,
|
||||
ExpiresAt = session.AccessTokenExpiration,
|
||||
UserId = user.Id,
|
||||
FullName = user.FullName,
|
||||
UserName = user.UserName,
|
||||
Roles = user.RoleUser.Select(r => r.RoleId).ToList()
|
||||
};
|
||||
|
||||
return OperationResult<LoginResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using MediatR;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.RefreshUserToken;
|
||||
|
||||
/// <summary>
|
||||
/// دستور تازهسازی توکن دسترسی کاربر
|
||||
/// </summary>
|
||||
public record RefreshUserTokenCommand() : IBaseCommand;
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MediatR;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.RefreshUserToken;
|
||||
|
||||
/// <summary>
|
||||
/// Handler برای تازهسازی توکن دسترسی
|
||||
/// </summary>
|
||||
public class RefreshUserTokenCommandHandler : IBaseCommandHandler<RefreshUserTokenCommand>
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public RefreshUserTokenCommandHandler(
|
||||
IAuthHelper authHelper,
|
||||
IProgramManagerDbContext context)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(RefreshUserTokenCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var refreshToken = _authHelper.GetRefreshTokenFromCookie();
|
||||
|
||||
// یافتن کاربر و Refresh Token فعال از دیتابیس
|
||||
var user = await _context.Users
|
||||
.Include(u => u.RefreshTokens)
|
||||
.Include(u => u.RoleUser)
|
||||
.FirstOrDefaultAsync(u => u.RefreshTokens.Any(r=>r.Token ==refreshToken), cancellationToken);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return OperationResult<AccessTokenResponse>.Failure("کاربر یافت نشد", ErrorType.NotFound);
|
||||
}
|
||||
|
||||
// بررسی فعال بودن کاربر
|
||||
if (!user.IsActive)
|
||||
{
|
||||
return OperationResult<AccessTokenResponse>.Failure("حساب کاربری غیرفعال است", ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
// پیدا کردن Refresh Token فعال
|
||||
var activeRefreshToken = user.RefreshTokens
|
||||
.FirstOrDefault(rt => rt.Token == refreshToken && rt.IsActive);
|
||||
|
||||
if (activeRefreshToken == null)
|
||||
{
|
||||
return OperationResult<AccessTokenResponse>.Failure(
|
||||
"نشست شما منقضی شده است. لطفاً دوباره وارد شوید",
|
||||
ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
if (!activeRefreshToken.IsActive|| activeRefreshToken.IsRevoked||activeRefreshToken.IsExpired)
|
||||
{
|
||||
return OperationResult<AccessTokenResponse>.Failure(
|
||||
"نشست شما منقضی شده است. لطفاً دوباره وارد شوید",
|
||||
ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
// تولید Access Token جدید با استفاده از AuthHelper
|
||||
var roles = user.RoleUser.Select(r => r.RoleId.ToString()).ToList();
|
||||
var newAccessToken = _authHelper.GenerateAccessToken(
|
||||
user.Id,
|
||||
user.UserName,
|
||||
user.FullName,
|
||||
user.AccountId,
|
||||
roles);
|
||||
|
||||
var response = new AccessTokenResponse
|
||||
{
|
||||
AccessToken = newAccessToken,
|
||||
ExpiresAt = DateTime.UtcNow.AddMinutes(30),
|
||||
UserId = user.Id,
|
||||
FullName = user.FullName,
|
||||
UserName = user.UserName
|
||||
};
|
||||
|
||||
return OperationResult<AccessTokenResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using MediatR;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.SignOutUser;
|
||||
|
||||
/// <summary>
|
||||
/// دستور خروج کاربر از سیستم
|
||||
/// </summary>
|
||||
public record SignOutUserCommand(string RefreshToken) : IBaseCommand;
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.SignOutUser;
|
||||
|
||||
/// <summary>
|
||||
/// Handler برای خروج کاربر از سیستم
|
||||
/// </summary>
|
||||
public class SignOutUserCommandHandler : IBaseCommandHandler<SignOutUserCommand>
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public SignOutUserCommandHandler(
|
||||
IAuthHelper _authHelper,
|
||||
IProgramManagerDbContext context,
|
||||
IUnitOfWork unitOfWork)
|
||||
{
|
||||
this._authHelper = _authHelper;
|
||||
_context = context;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(SignOutUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
// دریافت UserId از Claims با استفاده از AuthHelper
|
||||
var userId = _authHelper.GetCurrentUserId();
|
||||
|
||||
if (!userId.HasValue)
|
||||
{
|
||||
return OperationResult.Failure("کاربر احراز هویت نشده است", ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.RefreshToken))
|
||||
{
|
||||
return OperationResult.Failure("توکن تازهسازی یافت نشد", ErrorType.BadRequest);
|
||||
}
|
||||
|
||||
// یافتن کاربر
|
||||
var user = await _context.Users
|
||||
.Include(u => u.RefreshTokens)
|
||||
.FirstOrDefaultAsync(u => u.Id == userId.Value, cancellationToken);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return OperationResult.Failure("کاربر یافت نشد", ErrorType.NotFound);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// لغو Refresh Token
|
||||
user.RevokeRefreshToken(request.RefreshToken);
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
_authHelper.SignOut();
|
||||
|
||||
return OperationResult.Success();
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
return OperationResult.Failure(ex.Message, ErrorType.BadRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.SsoLogin;
|
||||
|
||||
/// <summary>
|
||||
/// دستور ورود از طریق SSO با استفاده از توکن JWT
|
||||
/// </summary>
|
||||
public record SsoLoginCommand(string Token) : IBaseCommand<LoginResponse>;
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using MediatR;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Commands.SsoLogin;
|
||||
|
||||
/// <summary>
|
||||
/// Handler برای ورود از طریق SSO با استفاده از JWT Token
|
||||
/// </summary>
|
||||
public class SsoLoginCommandHandler : IRequestHandler<SsoLoginCommand, OperationResult<LoginResponse>>
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly IUserRefreshTokenRepository _refreshTokenRepository;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public SsoLoginCommandHandler(
|
||||
IUserRepository userRepository,
|
||||
IAuthHelper authHelper,
|
||||
IUnitOfWork unitOfWork,
|
||||
IUserRefreshTokenRepository refreshTokenRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
_authHelper = authHelper;
|
||||
_unitOfWork = unitOfWork;
|
||||
_refreshTokenRepository = refreshTokenRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<LoginResponse>> Handle(SsoLoginCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
// اعتبارسنجی
|
||||
if (string.IsNullOrWhiteSpace(request.Token))
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("توکن SSO معتبر نیست", ErrorType.BadRequest);
|
||||
}
|
||||
|
||||
// اعتبارسنجی توکن و استخراج Claims
|
||||
var principal = _authHelper.ValidateToken(request.Token);
|
||||
if (principal == null)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("توکن SSO نامعتبر یا منقضی شده است", ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
// استخراج AccountId از Claims
|
||||
var accountIdClaim = principal.FindFirst("AccountId")?.Value;
|
||||
if (string.IsNullOrEmpty(accountIdClaim) || !long.TryParse(accountIdClaim, out var accountId))
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("AccountId در توکن یافت نشد", ErrorType.BadRequest);
|
||||
}
|
||||
|
||||
// یافتن کاربر بر اساس AccountId
|
||||
var user = await _userRepository.GetByGozareshgirAccountId(accountId);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("کاربر با AccountId مشخص شده یافت نشد", ErrorType.NotFound);
|
||||
}
|
||||
|
||||
// بررسی فعال بودن کاربر
|
||||
if (!user.IsActive)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("حساب کاربری غیرفعال است", ErrorType.Unauthorized);
|
||||
}
|
||||
|
||||
// بارگذاری نقشهای کاربر
|
||||
user = await _userRepository.GetUserWithRolesByIdAsync(user.Id, cancellationToken);
|
||||
if (user == null)
|
||||
{
|
||||
return OperationResult<LoginResponse>.Failure("خطا در بارگذاری اطلاعات کاربر", ErrorType.InternalServerError);
|
||||
}
|
||||
|
||||
// تولید توکنهای جدید برای کاربر
|
||||
var roles = user.RoleUser
|
||||
.Select(r => r.RoleId.ToString()).ToList();
|
||||
|
||||
var session = _authHelper.SignIn(
|
||||
user.Id,
|
||||
user.UserName,
|
||||
user.FullName,
|
||||
user.AccountId ?? 0,
|
||||
roles);
|
||||
|
||||
// دریافت اطلاعات درخواست
|
||||
var ipAddress = _authHelper.GetClientIpAddress();
|
||||
var userAgent = _authHelper.GetUserAgent();
|
||||
|
||||
// ذخیره Refresh Token در دیتابیس
|
||||
var refreshTokenEntity = new UserRefreshToken(
|
||||
user.Id,
|
||||
session.RefreshToken,
|
||||
session.RefreshTokenExpiration,
|
||||
ipAddress,
|
||||
userAgent);
|
||||
|
||||
await _refreshTokenRepository.CreateAsync(refreshTokenEntity);
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
|
||||
// ساخت پاسخ
|
||||
var response = new LoginResponse
|
||||
{
|
||||
AccessToken = session.AccessToken,
|
||||
ExpiresAt = session.AccessTokenExpiration,
|
||||
UserId = user.Id,
|
||||
FullName = user.FullName,
|
||||
UserName = user.UserName,
|
||||
Roles = user.RoleUser.Select(r => r.RoleId).ToList()
|
||||
};
|
||||
|
||||
return OperationResult<LoginResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Queries.GetSingleUser;
|
||||
|
||||
public class GetSingleUserQueryHandler : IBaseQueryHandler<GetSingleUserQuery, GetSingleUserResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public GetSingleUserQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetSingleUserResponse>> Handle(GetSingleUserQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.accountId))
|
||||
{
|
||||
long accountId = 0;
|
||||
try
|
||||
{
|
||||
accountId = Convert.ToInt64(request.accountId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return (OperationResult<GetSingleUserResponse>)OperationResult.Failure("فقط عدد وارد کنید");
|
||||
}
|
||||
|
||||
|
||||
if (accountId > 0)
|
||||
{
|
||||
var user = await _context.Users
|
||||
.FirstOrDefaultAsync(x => x.AccountId == accountId);
|
||||
|
||||
|
||||
if(user != null)
|
||||
{
|
||||
List<long> roles = user.RoleUser.Select(x => x.RoleId).ToList();
|
||||
var response = new GetSingleUserResponse
|
||||
{
|
||||
FullName = user.FullName,
|
||||
UserName = user.UserName,
|
||||
ProfilePhotoPath = user.ProfilePhotoPath,
|
||||
Mobile = user.Mobile,
|
||||
IsActive = user.IsActive,
|
||||
AccountId = user.AccountId,
|
||||
Roles = roles,
|
||||
RoleListDto = await _context.Roles.Where(x => roles.Contains(x.Id)).Select(x=> new RoleListDto()
|
||||
{
|
||||
RoleName = x.RoleName,
|
||||
RoleId = x.Id,
|
||||
Permissions = x.Permissions.Select(x=>x.Code).ToList()
|
||||
}).ToListAsync(),
|
||||
};
|
||||
|
||||
return OperationResult<GetSingleUserResponse>.Success(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (OperationResult<GetSingleUserResponse>)OperationResult.NotFound("کاربر یافت نشد");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (OperationResult<GetSingleUserResponse>)OperationResult.Failure("آی دی اکانت گزارشگیر پر نشده است");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public record GetSingleUserResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کاربری
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مسیر عکس پروفایل
|
||||
/// </summary>
|
||||
public string ProfilePhotoPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره موبایل
|
||||
/// </summary>
|
||||
public string Mobile { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// فعال/غیر فعال بودن یوزر
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کاربر در گزارشگیر
|
||||
/// </summary>
|
||||
public long? AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نقش ها
|
||||
/// </summary>
|
||||
public List<long> Roles { get; set; }
|
||||
|
||||
public List<RoleListDto> RoleListDto { get; set; }
|
||||
};
|
||||
|
||||
|
||||
public record RoleListDto
|
||||
{
|
||||
public string RoleName { get; set; }
|
||||
public long RoleId { get; set; }
|
||||
public List<int> Permissions { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public record GetSingleUserQuery(string? accountId) : IBaseQuery<GetSingleUserResponse>;
|
||||
@@ -1,48 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Queries.GetSingleUser;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Queries.GetUserSelectList;
|
||||
|
||||
public class GetUserSelectListQueryHandler : IBaseQueryHandler<GetUserSelectListQuery, GetUserSelectListResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public GetUserSelectListQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetUserSelectListResponse>> Handle(GetUserSelectListQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var query = await _context.Users.Select(x => new GetUserSelectListDto()
|
||||
{
|
||||
FullName = x.FullName,
|
||||
Id = x.Id
|
||||
}).ToListAsync();
|
||||
|
||||
var response = new GetUserSelectListResponse(query);
|
||||
|
||||
|
||||
return OperationResult<GetUserSelectListResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public record GetUserSelectListResponse(List<GetUserSelectListDto>? GetUserSelectListDto);
|
||||
|
||||
public record GetUserSelectListDto
|
||||
{
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کاربر
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
}
|
||||
public record GetUserSelectListQuery() : IBaseQuery<GetUserSelectListResponse>;
|
||||
@@ -1,5 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Queries.GetUsers;
|
||||
|
||||
public record GetUsersQuery(string? FullName, string? UserName, string? Mobile) : IBaseQuery<GetUsersResponse>;
|
||||
@@ -1,49 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Queries.GetUsers;
|
||||
|
||||
public class GetUsersQueryHandler :IBaseQueryHandler<GetUsersQuery, GetUsersResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public GetUsersQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetUsersResponse>> Handle(GetUsersQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = _context.Users.AsQueryable();
|
||||
|
||||
//if (request.ParentId != null)
|
||||
//{
|
||||
// query = query.Where(x => x.ParentId == request.ParentId);
|
||||
//}
|
||||
|
||||
var users = await query
|
||||
.Select(p => new GetUserDto()
|
||||
{
|
||||
|
||||
FullName = p.FullName,
|
||||
Mobile = p.Mobile,
|
||||
UserName = p.UserName,
|
||||
AccountId = p.AccountId,
|
||||
IsActive = p.IsActive,
|
||||
ProfilePhotoPath = p.ProfilePhotoPath,
|
||||
|
||||
|
||||
})
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var response = new GetUsersResponse(
|
||||
users
|
||||
);
|
||||
|
||||
return OperationResult<GetUsersResponse>.Success(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
namespace GozareshgirProgramManager.Application.Modules.Users.Queries.GetUsers;
|
||||
|
||||
public record GetUsersResponse(List<GetUserDto> User);
|
||||
|
||||
public record GetUserDto
|
||||
{
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کاربری
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مسیر عکس پروفایل
|
||||
/// </summary>
|
||||
public string ProfilePhotoPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره موبایل
|
||||
/// </summary>
|
||||
public string Mobile { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// فعال/غیر فعال بودن یوزر
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کاربر در گزارشگیر
|
||||
/// </summary>
|
||||
public long? AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نقش ها
|
||||
/// </summary>
|
||||
public List<long> Roles { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.PermissionAgg.Entities;
|
||||
|
||||
public class Permission
|
||||
{
|
||||
public long Id { get; private set; }
|
||||
public int Code { get; private set; }
|
||||
public Role Role { get; private set; }
|
||||
|
||||
public Permission(int code)
|
||||
{
|
||||
Code = code;
|
||||
}
|
||||
}
|
||||
@@ -6,21 +6,14 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Services.Authentication;
|
||||
using MediatR;
|
||||
using FluentValidation;
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -56,11 +49,6 @@ public static class DependencyInjection
|
||||
// Unit of Work
|
||||
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
||||
|
||||
//Users
|
||||
services.AddScoped<IUserRepository, UserRepository>();
|
||||
|
||||
//Roles
|
||||
services.AddScoped<IRoleRepository, RoleRepository>();
|
||||
|
||||
//WorkingHours
|
||||
services.AddScoped<ISalaryPaymentSettingRepository, SalaryPaymentSettingRepository>();
|
||||
@@ -84,8 +72,6 @@ public static class DependencyInjection
|
||||
|
||||
services.AddScoped<ISkillRepository, SkillRepository>();
|
||||
|
||||
services.AddScoped<IUserRefreshTokenRepository, UserRefreshTokenRepository>();
|
||||
|
||||
// JWT Settings
|
||||
services.Configure<JwtSettings>(configuration.GetSection("JwtSettings"));
|
||||
|
||||
|
||||
@@ -4,10 +4,7 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class RefreshTokenMapping : IEntityTypeConfiguration<UserRefreshToken>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserRefreshToken> builder)
|
||||
{
|
||||
builder.ToTable("UserRefreshTokens");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Token)
|
||||
.HasMaxLength(500)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.ExpiresAt)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.RevokedAt)
|
||||
.IsRequired(false);
|
||||
|
||||
builder.Property(x => x.IpAddress)
|
||||
.HasMaxLength(50)
|
||||
.IsRequired(false);
|
||||
|
||||
builder.Property(x => x.UserAgent)
|
||||
.HasMaxLength(500)
|
||||
.IsRequired(false);
|
||||
|
||||
builder.Property(x => x.UserId)
|
||||
.IsRequired();
|
||||
|
||||
// رابطه با User
|
||||
builder.HasOne(x => x.User)
|
||||
.WithMany(u => u.RefreshTokens)
|
||||
.HasForeignKey(x => x.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// Index برای بهینهسازی جستجو
|
||||
builder.HasIndex(x => x.Token)
|
||||
.IsUnique();
|
||||
|
||||
builder.HasIndex(x => x.UserId);
|
||||
|
||||
builder.HasIndex(x => x.ExpiresAt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class RoleMapping : IEntityTypeConfiguration<Role>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Role> builder)
|
||||
{
|
||||
builder.ToTable("PmRoles");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.RoleName).HasMaxLength(100).IsRequired();
|
||||
|
||||
builder.OwnsMany(x => x.Permissions, navigationBuilder =>
|
||||
{
|
||||
navigationBuilder.HasKey(x => x.Id);
|
||||
navigationBuilder.ToTable("PmRolePermissions");
|
||||
navigationBuilder.WithOwner(x => x.Role);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class UserMapping :IEntityTypeConfiguration<User>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<User> builder)
|
||||
{
|
||||
builder.ToTable("Users");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.FullName).HasMaxLength(100).IsRequired();
|
||||
builder.Property(x => x.UserName).HasMaxLength(100).IsRequired();
|
||||
builder.Property(x => x.Password).HasMaxLength(1000).IsRequired();
|
||||
builder.Property(x => x.ProfilePhotoPath).HasMaxLength(500).IsRequired(false);
|
||||
builder.Property(x => x.Mobile).HasMaxLength(20).IsRequired();
|
||||
builder.Property(x => x.Email).HasMaxLength(150).IsRequired(false); ;
|
||||
builder.Property(x => x.VerifyCode).HasMaxLength(10).IsRequired(false);
|
||||
builder.OwnsMany(x => x.RoleUser, navigationBuilder =>
|
||||
{
|
||||
navigationBuilder.HasKey(x => x.Id);
|
||||
navigationBuilder.ToTable("RoleUsers");
|
||||
navigationBuilder.WithOwner(x => x.User);
|
||||
});
|
||||
|
||||
builder.HasMany(x=>x.RefreshTokens)
|
||||
.WithOne(x=>x.User)
|
||||
.HasForeignKey(x=>x.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
|
||||
public class RoleRepository : RepositoryBase<long, Role>, IRoleRepository
|
||||
{
|
||||
private readonly ProgramManagerDbContext _context;
|
||||
public RoleRepository(ProgramManagerDbContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Role?> GetByGozareshgirRoleIdAsync(long? gozareshgirRolId)
|
||||
{
|
||||
return await _context.Roles.FirstOrDefaultAsync(x => x.GozareshgirRoleId == gozareshgirRolId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetSalarySettingToEdit;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.DTOs;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.DTOs;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.Contracts.Account;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
|
||||
public class SalaryPaymentSettingRepository : RepositoryBase<long, SalaryPaymentSetting>, ISalaryPaymentSettingRepository
|
||||
{
|
||||
private readonly ProgramManagerDbContext _context;
|
||||
public SalaryPaymentSettingRepository(ProgramManagerDbContext context) : base(context)
|
||||
private readonly IAccountQueryService _accountQueryService;
|
||||
|
||||
public SalaryPaymentSettingRepository(ProgramManagerDbContext context, IAccountQueryService accountQueryService) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_accountQueryService = accountQueryService;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,31 +28,36 @@ public class SalaryPaymentSettingRepository : RepositoryBase<long, SalaryPayment
|
||||
|
||||
public async Task<List<UserSalarySettingDto>> GetAllSettings(List<long> userIdList)
|
||||
{
|
||||
_context.SalaryPaymentSettings.AsNoTracking();
|
||||
var query = await _context.SalaryPaymentSettings.Where(s=> userIdList.Contains(s.AccountId))
|
||||
.Join(_context.Users.AsNoTracking(),
|
||||
setting => setting.AccountId,
|
||||
user => user.Id,
|
||||
(setting, user) => new { setting, user }
|
||||
)
|
||||
.Select(x => new UserSalarySettingDto
|
||||
// دریافت تنظیمات حقوق
|
||||
var settings = await _context.SalaryPaymentSettings
|
||||
.AsNoTracking()
|
||||
.Where(s => userIdList.Contains(s.AccountId))
|
||||
.ToListAsync();
|
||||
|
||||
// دریافت اطلاعات پایه کاربران از ACL
|
||||
var accountIds = settings.Select(s => s.AccountId).Distinct().ToList();
|
||||
var accounts = await _accountQueryService.GetProgramManagerAccountListAsync(accountIds);
|
||||
var accountDictionary = accounts.ToDictionary(a => a.Id, a => a);
|
||||
|
||||
// ترکیب دادهها
|
||||
var result = settings.Select(setting => new UserSalarySettingDto
|
||||
{
|
||||
UserId = x.user.Id,
|
||||
HolidayWorking = x.setting!.HolidayWorking,
|
||||
FullName = x.user.FullName,
|
||||
MonthlySalary = x.setting.MonthlySalary,
|
||||
WorkingHoursListDto = x.setting.WorkingHoursList
|
||||
UserId = setting.AccountId,
|
||||
HolidayWorking = setting.HolidayWorking,
|
||||
FullName = accountDictionary.ContainsKey(setting.AccountId)
|
||||
? accountDictionary[setting.AccountId].Username
|
||||
: "Unknown",
|
||||
MonthlySalary = setting.MonthlySalary,
|
||||
WorkingHoursListDto = setting.WorkingHoursList
|
||||
.Where(wh => wh.IsActiveDay)
|
||||
.Select(wh => new WorkingHoursListDto()
|
||||
.Select(wh => new WorkingHoursListDto
|
||||
{
|
||||
ShiftDuration = wh.ShiftDuration,
|
||||
PersianDayOfWeek = wh.PersianDayOfWeek
|
||||
}).ToList()
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return query;
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void RemoveRangeSalarySettings(List<SalaryPaymentSetting> removedItems)
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Linq.Expressions;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
|
||||
public class UserRefreshTokenRepository : RepositoryBase<Guid, UserRefreshToken>, IUserRefreshTokenRepository
|
||||
{
|
||||
private readonly ProgramManagerDbContext _context;
|
||||
public UserRefreshTokenRepository(ProgramManagerDbContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
|
||||
public class UserRepository : RepositoryBase<long, User>, IUserRepository
|
||||
{
|
||||
private readonly ProgramManagerDbContext _context;
|
||||
public UserRepository(ProgramManagerDbContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public Task<User?> GetByIdAsync(long id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<User?> GetByGozareshgirAccountId(long accountId)
|
||||
{
|
||||
return await _context.Users.FirstOrDefaultAsync(x => x.AccountId == accountId);
|
||||
}
|
||||
|
||||
public Task<User?> GetByEmailAsync(string email)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<User?> GetByMobileAsync(string mobile)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<User>> GetAllAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<User>> GetActiveUsersAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<User> AddAsync(User user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Update(User user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Delete(User user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<bool> ExistsAsync(long id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<bool> UsernameExistsAsync(string username)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<bool> EmailExistsAsync(string email)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<bool> MobileExistsAsync(string mobile)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<User?> GetUserWithRolesByIdAsync(long userId, CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Users.Include(x => x.RoleUser)
|
||||
.FirstOrDefaultAsync(x=>x.Id == userId, cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,5 @@ namespace Query.Bootstrapper
|
||||
services.AddTransient<IGetWorkshopWithRollCallHandler, GetWorkshopWithRollCallHandler>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.LoginUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.RefreshUserToken;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.SignOutUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.SsoLogin;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;
|
||||
|
||||
/// <summary>
|
||||
/// کنترلر احراز هویت
|
||||
/// </summary>
|
||||
public class AuthController : ProgramManagerBaseController
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public AuthController(IAuthHelper authHelper, IMediator mediator)
|
||||
{
|
||||
_authHelper = authHelper;
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ورود به سیستم با شناسه کاربری
|
||||
/// </summary>
|
||||
/// <param name="request">شناسه کاربر</param>
|
||||
/// <returns>فقط Access Token - Refresh Token در سرور ذخیره میشود</returns>
|
||||
[HttpPost("login")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<OperationResult<LoginResponse>>> Login([FromBody] LoginByIdRequest request)
|
||||
{
|
||||
var command = new LoginUserCommand(request.UserId);
|
||||
var result = await _mediator.Send(command);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ورود به سیستم از طریق SSO با استفاده از توکن JWT
|
||||
/// توکن JWT از query string دریافت میشود و Claims آن استخراج میشود
|
||||
/// سپس کاربر بر اساس AccountId موجود در Claims لاگین میشود
|
||||
/// </summary>
|
||||
/// <param name="token">JWT Token از سیستم خارجی</param>
|
||||
/// <returns>Access Token و اطلاعات کاربر</returns>
|
||||
[HttpGet("sso-login")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<OperationResult<LoginResponse>>> SsoLogin([FromQuery] string token)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
return BadRequest(OperationResult<LoginResponse>.Failure("توکن الزامی است", ErrorType.BadRequest));
|
||||
}
|
||||
|
||||
var command = new SsoLoginCommand(token);
|
||||
var result = await _mediator.Send(command);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// خروج از سیستم
|
||||
/// </summary>
|
||||
[HttpPost("signout")]
|
||||
[Authorize]
|
||||
public new async Task<ActionResult<OperationResult>> SignOut()
|
||||
{
|
||||
// دریافت Refresh Token از Header با استفاده از AuthHelper
|
||||
var refreshToken = _authHelper.GetRefreshTokenFromCookie();
|
||||
|
||||
if (string.IsNullOrEmpty(refreshToken))
|
||||
{
|
||||
return OperationResult.Failure("توکن تازهسازی یافت نشد");
|
||||
}
|
||||
|
||||
var command = new SignOutUserCommand(refreshToken);
|
||||
var result = await _mediator.Send(command);
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
return StatusCode(result.ErrorType switch
|
||||
{
|
||||
ErrorType.Unauthorized => 401,
|
||||
ErrorType.BadRequest => 400,
|
||||
ErrorType.NotFound => 404,
|
||||
_ => 500
|
||||
}, result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تازهسازی توکن دسترسی
|
||||
/// توکن منقضی شده را میگیرد و Access Token جدید برمیگرداند
|
||||
/// Refresh Token از دیتابیس خوانده میشود و به فرانت داده نمیشود
|
||||
/// </summary>
|
||||
[HttpPost("refresh")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<OperationResult>> RefreshAccessToken()
|
||||
{
|
||||
|
||||
var refreshTokenCommand = new RefreshUserTokenCommand();
|
||||
var result = await _mediator.Send(refreshTokenCommand);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات کاربر جاری
|
||||
/// </summary>
|
||||
[HttpGet("current")]
|
||||
public IActionResult GetCurrentUser()
|
||||
{
|
||||
if (!_authHelper.IsAuthenticated())
|
||||
{
|
||||
return Unauthorized(new { message = "کاربر احراز هویت نشده است" });
|
||||
}
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
userId = _authHelper.GetCurrentUserId(),
|
||||
fullName= _authHelper.GetCurrentFullName(),
|
||||
roles = _authHelper.GetCurrentUserRoles()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// درخواست ورود با شناسه کاربری
|
||||
/// </summary>
|
||||
public class LoginByIdRequest
|
||||
{
|
||||
public long UserId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Roles.Commands.CreateRole;
|
||||
using GozareshgirProgramManager.Application.Modules.Roles.Commands.EditRole;
|
||||
using GozareshgirProgramManager.Application.Modules.Roles.Queries.GetRoles;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;
|
||||
|
||||
public class RoleController : ProgramManagerBaseController
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public RoleController(IMediator mediator)
|
||||
{
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<OperationResult<GetRolesResponse>>> Get([FromQuery] GetRolesQuery query)
|
||||
{
|
||||
var res = await _mediator.Send(query);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<OperationResult>> Create([FromBody] CreateRoleCommand command)
|
||||
{
|
||||
var res = await _mediator.Send(command);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost("edit")]
|
||||
public async Task<ActionResult<OperationResult>> Edit([FromBody] EditRoleCommand command)
|
||||
{
|
||||
var res = await _mediator.Send(command);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.EditUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Queries.GetSingleUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Queries.GetUsers;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Queries.GetUserSelectList;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;
|
||||
|
||||
public class UserController : ProgramManagerBaseController
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
|
||||
public UserController(IMediator mediator)
|
||||
{
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<OperationResult<GetUsersResponse>>> Get([FromQuery] GetUsersQuery query)
|
||||
{
|
||||
var res = await _mediator.Send(query);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{accountId}")]
|
||||
public async Task<ActionResult<OperationResult<GetSingleUserResponse>>> GetUserByAccountId(string accountId)
|
||||
{
|
||||
var query = new GetSingleUserQuery(accountId);
|
||||
var res = await _mediator.Send(query);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet("GetUserSelectList")]
|
||||
public async Task<ActionResult<OperationResult<GetUserSelectListResponse>>> GetUserSelectList()
|
||||
{
|
||||
var query = new GetUserSelectListQuery();
|
||||
var res = await _mediator.Send(query);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("create")]
|
||||
public async Task<ActionResult<OperationResult>> Create([FromBody] CreateUserCommand command)
|
||||
{
|
||||
var res = await _mediator.Send(command);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("edit")]
|
||||
public async Task<ActionResult<OperationResult>> Edit([FromBody] EditUserCommand command)
|
||||
{
|
||||
var res = await _mediator.Send(command);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
using AccountManagement.Domain.InternalApiCaller;
|
||||
using FluentValidation;
|
||||
using GozareshgirProgramManager.Application._Bootstrapper;
|
||||
using GozareshgirProgramManager.Application.Modules.Users.Commands.CreateUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.CreateProject;
|
||||
using GozareshgirProgramManager.Infrastructure;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Seed;
|
||||
|
||||
@@ -63,7 +63,7 @@ var connectionStringProgramManager = builder.Configuration.GetConnectionString("
|
||||
|
||||
builder.Services.AddProgramManagerApplication();
|
||||
builder.Services.AddProgramManagerInfrastructure(builder.Configuration);
|
||||
builder.Services.AddValidatorsFromAssemblyContaining<CreateUserCommandValidators>();
|
||||
builder.Services.AddValidatorsFromAssemblyContaining<CreateProjectCommandValidator>();
|
||||
builder.Services.AddScoped<IDataSeeder, DataSeeder>();
|
||||
#region MongoDb
|
||||
|
||||
|
||||
14
Shared.Contracts/Account/AccountBasicDto.cs
Normal file
14
Shared.Contracts/Account/AccountBasicDto.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Shared.Contracts.Account;
|
||||
/// </summary>
|
||||
/// این DTO هیچ وابستگی به DbContext یا Entity ندارد
|
||||
/// DTO مینیمال برای انتقال اطلاعات پایه حساب کاربری بین ماژولها
|
||||
/// <summary>
|
||||
public class AccountBasicDto
|
||||
{
|
||||
public bool IsActive { get; init; }
|
||||
public string Fullname { get; init; }
|
||||
public string Username { get; init; }
|
||||
public long Id { get; init; }
|
||||
}
|
||||
|
||||
|
||||
25
Shared.Contracts/Account/IAccountQueryService.cs
Normal file
25
Shared.Contracts/Account/IAccountQueryService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Shared.Contracts.Account;
|
||||
|
||||
/// <summary>
|
||||
/// Contract Interface برای دسترسی به اطلاعات پایه کاربران از سایر ماژولها
|
||||
/// این Interface به عنوان ACL (Anti-Corruption Layer) عمل میکند
|
||||
///
|
||||
/// مزایا:
|
||||
/// - هیچ وابستگی به Implementation ندارد
|
||||
/// - ماژولهای دیگر فقط به این Contract دسترسی دارند
|
||||
/// - امکان تبدیل به Microservice بدون Breaking Change
|
||||
/// - Testability بالا (Mock کردن آسان)
|
||||
/// </summary>
|
||||
public interface IAccountQueryService
|
||||
{
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات پایه یک کاربر
|
||||
/// </summary>
|
||||
Task<AccountBasicDto> GetAccountAsync(long accountId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات پایه لیستی از کاربران (Batch Query برای جلوگیری از N+1)
|
||||
/// </summary>
|
||||
Task<List<AccountBasicDto>> GetProgramManagerAccountListAsync(List<long> accountIds);
|
||||
}
|
||||
|
||||
10
Shared.Contracts/Shared.Contracts.csproj
Normal file
10
Shared.Contracts/Shared.Contracts.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user