parent
e067a5fe73
commit
b0f6d6543c
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<AssemblyVersion>0.2.3.1</AssemblyVersion>
|
||||
<FileVersion>0.2.3.1</FileVersion>
|
||||
<AssemblyVersion>0.2.3.2</AssemblyVersion>
|
||||
<FileVersion>0.2.3.2</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,6 +3,7 @@ using Brizco.Domain.Entities.Shift;
|
|||
using Brizco.Domain.Entities.Task;
|
||||
using System.Threading.Tasks;
|
||||
using Brizco.Domain.Mappers;
|
||||
using Task = Brizco.Domain.Entities.Task.Task;
|
||||
|
||||
namespace Brizco.Core.EntityServices;
|
||||
|
||||
|
@ -70,20 +71,35 @@ public class ActivityService : IActivityService
|
|||
if (shiftPlan.Id == Guid.Empty)
|
||||
return false;
|
||||
|
||||
var tasks = await _repositoryWrapper.SetRepository<Brizco.Domain.Entities.Task.Task>()
|
||||
.ExecuteCommand(
|
||||
$@"SELECT t.""Id"", t.""Amount"", t.""AmountType"", t.""ComplexId"",
|
||||
t.""CreatedAt"", t.""CreatedBy"", t.""Description"", t.""Discriminator"", t.""HasDisposed"", t.""IsDisposable"", t.""IsRemoved"", t.""ModifiedAt"",
|
||||
t.""ModifiedBy"", t.""RemovedAt"", t.""RemovedBy"", t.""ScheduleType"", t.""SetFor"", t.""Title"", t.""Type"", t.""DoneAt"", t.""IsDone"",
|
||||
t.""PerformanceDescription"", t.""ShiftId"", t.""Status"", t.""UserId"" , t.""IsActivity"" , t.""UnDoneReason""
|
||||
FROM public.""Tasks"" t
|
||||
INNER JOIN public.""TaskShifts"" t1 ON t.""Id"" = t1.""TaskId""
|
||||
INNER JOIN public.""TaskDays"" t2 ON t.""Id"" = t1.""TaskId""
|
||||
INNER JOIN public.""TaskRoutines"" t3 ON t.""Id"" = t1.""TaskId""
|
||||
AND {shiftPlan.ShiftId} = t1.""ShiftId""
|
||||
AND {shiftPlan.RoutineId} = t3.""RoutineId""
|
||||
AND {shiftPlan.PlanFor.DayOfWeek} = t2.""DayOfWeek""
|
||||
GROUP BY t.""Id""").AsNoTracking().ToListAsync(cancellationToken);
|
||||
var dailyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId && task.ScheduleType == TaskScheduleType.Daily
|
||||
select task).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var weeklyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskDay in _repositoryWrapper.SetRepository<TaskDay>().Entities on task.Id equals taskDay.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
taskDay.DayOfWeek == shiftPlan.PlanFor.DayOfWeek && task.ScheduleType == TaskScheduleType.Weekly
|
||||
group task by task.Id into groupedTask
|
||||
select groupedTask.FirstOrDefault()).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var customTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
task.ScheduleType == TaskScheduleType.Custom && task.SetFor.Date == shiftPlan.PlanFor.Date
|
||||
select task).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var tasks = new List<Task>();
|
||||
tasks.AddRange(weeklyTasks);
|
||||
tasks.AddRange(dailyTasks);
|
||||
tasks.AddRange(customTasks);
|
||||
|
||||
var shiftPlanPositions = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
|
@ -130,20 +146,36 @@ GROUP BY t.""Id""").AsNoTracking().ToListAsync(cancellationToken);
|
|||
if (shiftPlan.Id == Guid.Empty)
|
||||
return false;
|
||||
|
||||
var tasks = await _repositoryWrapper.SetRepository<Brizco.Domain.Entities.Task.Task>()
|
||||
.ExecuteCommand(
|
||||
$@"SELECT t.""Id"", t.""Amount"", t.""AmountType"", t.""ComplexId"",
|
||||
t.""CreatedAt"", t.""CreatedBy"", t.""Description"", t.""Discriminator"", t.""HasDisposed"", t.""IsDisposable"", t.""IsRemoved"", t.""ModifiedAt"",
|
||||
t.""ModifiedBy"", t.""RemovedAt"", t.""RemovedBy"", t.""ScheduleType"", t.""SetFor"", t.""Title"", t.""Type"", t.""DoneAt"", t.""IsDone"",
|
||||
t.""PerformanceDescription"", t.""ShiftId"", t.""Status"", t.""UserId"" , t.""IsActivity"" , t.""UnDoneReason""
|
||||
FROM public.""Tasks"" t
|
||||
INNER JOIN public.""TaskShifts"" t1 ON t.""Id"" = t1.""TaskId""
|
||||
INNER JOIN public.""TaskDays"" t2 ON t.""Id"" = t1.""TaskId""
|
||||
INNER JOIN public.""TaskRoutines"" t3 ON t.""Id"" = t1.""TaskId""
|
||||
AND {shiftPlan.ShiftId} = t1.""ShiftId""
|
||||
AND {shiftPlan.RoutineId} = t3.""RoutineId""
|
||||
AND {shiftPlan.PlanFor.DayOfWeek} = t2.""DayOfWeek""
|
||||
GROUP BY t.""Id""").AsNoTracking().ToListAsync(cancellationToken);
|
||||
var dailyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId && task.ScheduleType == TaskScheduleType.Daily
|
||||
select task).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var weeklyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskDay in _repositoryWrapper.SetRepository<TaskDay>().Entities on task.Id equals taskDay.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
taskDay.DayOfWeek == shiftPlan.PlanFor.DayOfWeek && task.ScheduleType == TaskScheduleType.Weekly
|
||||
group task by task.Id into groupedTask
|
||||
select groupedTask.FirstOrDefault()).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var customTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
task.ScheduleType == TaskScheduleType.Custom && task.SetFor.Date == shiftPlan.PlanFor.Date
|
||||
select task).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var tasks = new List<Task>();
|
||||
tasks.AddRange(weeklyTasks);
|
||||
tasks.AddRange(dailyTasks);
|
||||
tasks.AddRange(customTasks);
|
||||
|
||||
|
||||
var shiftPlanPositions = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using Brizco.Domain.CommandQueries.Queries;
|
||||
using Brizco.Domain.Entities.Complex;
|
||||
using Brizco.Domain.Mappers;
|
||||
using Mapster;
|
||||
|
||||
|
@ -58,6 +59,25 @@ public class UserService : IUserService
|
|||
response.Permissions = roleClaims.Where(c => c.Type == "Permission").Select(c => c.Value).ToList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var complexUserRole = complexUsers.FirstOrDefault();
|
||||
if (complexUserRole != null)
|
||||
{
|
||||
user.SelectedComplexUserRoleId = complexUserRole.Id;
|
||||
await _userManager.UpdateAsync(user);
|
||||
userSDto.SelectedComplexName = complexUserRole!.ComplexName;
|
||||
userSDto.SelectedRoleName = complexUserRole!.RoleName;
|
||||
response.User.SelectedRoleId = complexUserRole!.Id;
|
||||
var role = await _roleManager.FindByIdAsync(complexUserRole.RoleId.ToString());
|
||||
if (role != null)
|
||||
{
|
||||
var roleClaims = await _roleManager.GetClaimsAsync(role);
|
||||
response.Permissions = roleClaims.Where(c => c.Type == "Permission").Select(c => c.Value).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
response.Roles = complexUsers;
|
||||
return response;
|
||||
|
|
Loading…
Reference in New Issue