fix getting actevities issue , feat version 0.5.9.10

master
Amir Hossein Khademi 2024-04-25 16:56:15 +03:30
parent 5b67533eee
commit 60366045bf
5 changed files with 10 additions and 9 deletions

View File

@ -1 +1 @@
0.5.8.9
0.5.9.10

View File

@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<AssemblyVersion>0.5.8.9</AssemblyVersion>
<FileVersion>0.5.8.9</FileVersion>
<AssemblyVersion>0.5.9.10</AssemblyVersion>
<FileVersion>0.5.9.10</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -52,7 +52,7 @@ public class ActivityController : ICarterModule
// GET:Get All Entity
public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery] DateQueryFilter? dateQueryFilter, [FromQuery] long? selectedDate, [FromQuery] Guid? selectedShift, ISender sender, CancellationToken cancellationToken)
=> TypedResults.Ok(await sender.Send(new GetActivitiesQuery(Page: page, SelectedDate: selectedDate ?? 0 , SelectedShift: selectedShift ?? default), cancellationToken));
=> TypedResults.Ok(await sender.Send(new GetActivitiesQuery(Page: page, SelectedDate: selectedDate ?? 0 , SelectedShift: selectedShift ?? default , DateQueryFilter: dateQueryFilter ?? null), cancellationToken));
// GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, IActivityService activityService, CancellationToken cancellationToken)

View File

@ -32,11 +32,11 @@ public class PageService : IPageService
var todayTasks = await _repositoryWrapper.SetRepository<Activity>()
.TableNoTracking
.Where(a => a.UserId == userId)
.Where(a => a.ComplexId == complexId && a.SetFor.Date == DateTime.Today.Date)
.ToListAsync(cancellationToken);
var todayShiftPlans = await _repositoryWrapper.SetRepository<ShiftPlan>()
.TableNoTracking
.Where(a => a.PlanFor.Date == DateTime.Today.Date)
.Where(a => a.PlanFor.Date == DateTime.Today.Date && a.ComplexId == complexId)
.Select(ShiftPlanMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
var names = new List<string>();

View File

@ -25,9 +25,9 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
IQueryable<Domain.Entities.Task.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking
.Where(a=>a.IsActivity);
if (_currentUserService.Permissions != null)
if (_currentUserService is { Permissions: not null, RoleName: not null })
{
if (_currentUserService.Permissions.Contains(ApplicationPermission.ViewMineActivities))
if (_currentUserService.Permissions.Contains(ApplicationPermission.ViewMineActivities) && _currentUserService.RoleName == ApplicationRoles.Staff)
activities = activities.Where(a => a.UserId == userId);
}
@ -60,9 +60,10 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
return await activities.OrderBy(s => s.ScheduleType)
var response= await activities.OrderByDescending(s => s.UserId)
.Skip(request.Page * 20).Take(20)
.Select(ActivityMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
return response;
}
}