add version 0.2.5.1
parent
f9536548f6
commit
648d4b009d
|
@ -6,8 +6,8 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||||
<AssemblyVersion>0.2.3.2</AssemblyVersion>
|
<AssemblyVersion>0.2.5.1</AssemblyVersion>
|
||||||
<FileVersion>0.2.3.2</FileVersion>
|
<FileVersion>0.2.5.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -140,8 +140,7 @@ public class ActivityService : IActivityService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> CreateActivitiesByShiftPlan(Guid shiftPlanId, CancellationToken cancellationToken)
|
public async Task<bool> CreateActivitiesByShiftPlan(Guid shiftPlanId, CancellationToken cancellationToken) {
|
||||||
{
|
|
||||||
var shiftPlan = await _mediator.Send(new GetShiftPlanQuery(shiftPlanId), cancellationToken);
|
var shiftPlan = await _mediator.Send(new GetShiftPlanQuery(shiftPlanId), cancellationToken);
|
||||||
if (shiftPlan.Id == Guid.Empty)
|
if (shiftPlan.Id == Guid.Empty)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Brizco.Domain.CommandQueries.Queries;
|
using Brizco.Domain.CommandQueries.Queries;
|
||||||
using Brizco.Domain.Entities.Complex;
|
|
||||||
using Brizco.Domain.Mappers;
|
using Brizco.Domain.Mappers;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ public class UserService : IUserService
|
||||||
userSDto.SelectedComplexName = complexUserRole!.ComplexName;
|
userSDto.SelectedComplexName = complexUserRole!.ComplexName;
|
||||||
userSDto.SelectedRoleName = complexUserRole!.RoleName;
|
userSDto.SelectedRoleName = complexUserRole!.RoleName;
|
||||||
response.User.SelectedRoleId = complexUserRole!.Id;
|
response.User.SelectedRoleId = complexUserRole!.Id;
|
||||||
var role = await _roleManager.FindByIdAsync(complexUserRole.RoleId.ToString());
|
var role = await _roleManager.FindByIdAsync(complexUserRole.RoleId.ToString());
|
||||||
if (role != null)
|
if (role != null)
|
||||||
{
|
{
|
||||||
var roleClaims = await _roleManager.GetClaimsAsync(role);
|
var roleClaims = await _roleManager.GetClaimsAsync(role);
|
||||||
|
@ -153,7 +152,7 @@ public class UserService : IUserService
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ComplexUserRoleSDto>> GetUserRolesAsync(Guid userId,CancellationToken cancellationToken)
|
public async Task<List<ComplexUserRoleSDto>> GetUserRolesAsync(Guid userId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var user = await _userManager.FindByIdAsync(userId.ToString());
|
var user = await _userManager.FindByIdAsync(userId.ToString());
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
@ -201,12 +200,32 @@ public class UserService : IUserService
|
||||||
if (user == null)
|
if (user == null)
|
||||||
throw new AppException("User not found", ApiResultStatusCode.NotFound);
|
throw new AppException("User not found", ApiResultStatusCode.NotFound);
|
||||||
var dto = user.AdaptToSDto();
|
var dto = user.AdaptToSDto();
|
||||||
var roles = await _userManager.GetRolesAsync(user);
|
if (_currentUserService.ComplexId == null || !Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||||
foreach (var roleName in roles)
|
|
||||||
{
|
{
|
||||||
var role = await _roleManager.FindByNameAsync(roleName);
|
var roles = await _userManager.GetRolesAsync(user);
|
||||||
if (role != null)
|
foreach (var roleName in roles)
|
||||||
dto.RoleIds.Add(role.Id);
|
{
|
||||||
|
var role = await _roleManager.FindByNameAsync(roleName);
|
||||||
|
if (role != null)
|
||||||
|
dto.RoleIds.Add(role.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var complexUser = await _repositoryWrapper.SetRepository<ComplexUser>().TableNoTracking
|
||||||
|
.FirstOrDefaultAsync(c => c.UserId == userId && c.ComplexId == complexId);
|
||||||
|
|
||||||
|
if (complexUser == null)
|
||||||
|
throw new AppException("ComplexUser not found", ApiResultStatusCode.NotFound);
|
||||||
|
|
||||||
|
var complexUserRoles = await _repositoryWrapper.SetRepository<ComplexUserRole>()
|
||||||
|
.TableNoTracking
|
||||||
|
.Where(cur => cur.ComplexUserId == complexUser.Id)
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var userRole in complexUserRoles)
|
||||||
|
{
|
||||||
|
dto.RoleIds.Add(userRole.RoleId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +319,7 @@ public class UserService : IUserService
|
||||||
if (!addPassResult.Succeeded)
|
if (!addPassResult.Succeeded)
|
||||||
throw new AppException(string.Join('|', addPassResult.Errors.Select(e => e.Description)));
|
throw new AppException(string.Join('|', addPassResult.Errors.Select(e => e.Description)));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _sender.Send(new UpdateComplexUserCommand(user.Id, complexId, request.RoleIds), cancellationToken);
|
await _sender.Send(new UpdateComplexUserCommand(user.Id, complexId, request.RoleIds), cancellationToken);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
|
||||||
throw new AppException("UserId is wrong", ApiResultStatusCode.NotFound);
|
throw new AppException("UserId is wrong", ApiResultStatusCode.NotFound);
|
||||||
|
|
||||||
|
|
||||||
IQueryable<Domain.Entities.Task.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking.Where(a=>a.IsActivity);
|
IQueryable<Domain.Entities.Task.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking
|
||||||
|
.Where(a=>a.IsActivity);
|
||||||
|
|
||||||
|
|
||||||
if (request.SelectedDate > 0)
|
if (request.SelectedDate > 0)
|
||||||
|
@ -40,7 +41,7 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return await activities.OrderByDescending(s => s.CreatedAt)
|
return await activities.OrderBy(s => s.ScheduleType)
|
||||||
.Skip(request.Page * 15).Take(15)
|
.Skip(request.Page * 15).Take(15)
|
||||||
.Select(ActivityMapper.ProjectToSDto)
|
.Select(ActivityMapper.ProjectToSDto)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class UpdateComplexUserCommandHandler : IRequestHandler<UpdateComplexUser
|
||||||
{
|
{
|
||||||
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
||||||
var complexUser = await _repositoryWrapper.SetRepository<ComplexUser>().TableNoTracking
|
var complexUser = await _repositoryWrapper.SetRepository<ComplexUser>().TableNoTracking
|
||||||
.FirstOrDefaultAsync(c => c.UserId == request.UserId && c.ComplexId==request.ComplexId , cancellationToken);
|
.FirstOrDefaultAsync(c => c.UserId == request.UserId && c.ComplexId == request.ComplexId , cancellationToken);
|
||||||
if (complexUser == null)
|
if (complexUser == null)
|
||||||
throw new AppException("ComplexUser not found", ApiResultStatusCode.NotFound);
|
throw new AppException("ComplexUser not found", ApiResultStatusCode.NotFound);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue