add version 0.1.3.1
parent
56ee887fab
commit
81cb0e8df3
|
@ -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.1.2.0</AssemblyVersion>
|
<AssemblyVersion>0.1.3.1</AssemblyVersion>
|
||||||
<FileVersion>0.1.2.0</FileVersion>
|
<FileVersion>0.1.3.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class ComplexController : ICarterModule
|
||||||
group.MapPut("", Put)
|
group.MapPut("", Put)
|
||||||
.HasApiVersion(1.0);
|
.HasApiVersion(1.0);
|
||||||
|
|
||||||
group.MapDelete("", Delete)
|
group.MapDelete("{id}", Delete)
|
||||||
.HasApiVersion(1.0);
|
.HasApiVersion(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@ public class RoutineController : ICarterModule
|
||||||
.WithDisplayName("GetAllRoutines")
|
.WithDisplayName("GetAllRoutines")
|
||||||
.HasApiVersion(1.0);
|
.HasApiVersion(1.0);
|
||||||
|
|
||||||
|
group.MapGet("{id}/shift", GetShiftsAsync)
|
||||||
|
.WithDisplayName("GetRoutineShifts")
|
||||||
|
.HasApiVersion(1.0);
|
||||||
|
|
||||||
group.MapGet("{id}", GetAsync)
|
group.MapGet("{id}", GetAsync)
|
||||||
.WithDisplayName("GetRoutine")
|
.WithDisplayName("GetRoutine")
|
||||||
.HasApiVersion(1.0);
|
.HasApiVersion(1.0);
|
||||||
|
@ -34,6 +38,10 @@ public class RoutineController : ICarterModule
|
||||||
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||||
=> TypedResults.Ok(await sender.Send(new GetRoutineQuery(id), cancellationToken));
|
=> TypedResults.Ok(await sender.Send(new GetRoutineQuery(id), cancellationToken));
|
||||||
|
|
||||||
|
// GET:Get Shifts By Id
|
||||||
|
public async Task<IResult> GetShiftsAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||||
|
=> TypedResults.Ok(await sender.Send(new GetRoutineShiftsQuery(id), cancellationToken));
|
||||||
|
|
||||||
// POST:Create Entity
|
// POST:Create Entity
|
||||||
public async Task<IResult> Post([FromBody] CreateRoutineCommand ent, ISender mediator, CancellationToken cancellationToken)
|
public async Task<IResult> Post([FromBody] CreateRoutineCommand ent, ISender mediator, CancellationToken cancellationToken)
|
||||||
=> TypedResults.Ok(await mediator.Send(ent, cancellationToken));
|
=> TypedResults.Ok(await mediator.Send(ent, cancellationToken));
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ShiftPlanController : ICarterModule
|
||||||
|
|
||||||
// GET:Get An Entity By Id
|
// GET:Get An Entity By Id
|
||||||
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||||
=> TypedResults.Ok(await sender.Send(new GetShiftPlanQuery(id)));
|
=> TypedResults.Ok(await sender.Send(new GetShiftPlanQuery(id),cancellationToken));
|
||||||
|
|
||||||
// POST:Create Entity
|
// POST:Create Entity
|
||||||
public async Task<IResult> Post([FromBody] CreateShiftPlanCommand ent, ISender mediator, CancellationToken cancellationToken)
|
public async Task<IResult> Post([FromBody] CreateShiftPlanCommand ent, ISender mediator, CancellationToken cancellationToken)
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class TaskController : ICarterModule
|
||||||
group.MapPut("", Put)
|
group.MapPut("", Put)
|
||||||
.HasApiVersion(1.0);
|
.HasApiVersion(1.0);
|
||||||
|
|
||||||
group.MapDelete("", Delete)
|
group.MapDelete("{id}", Delete)
|
||||||
.HasApiVersion(1.0);
|
.HasApiVersion(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class TaskController : ICarterModule
|
||||||
|
|
||||||
// GET:Get An Entity By Id
|
// GET:Get An Entity By Id
|
||||||
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||||
=> TypedResults.Ok(await sender.Send(new GetTaskQuery(id)));
|
=> TypedResults.Ok(await sender.Send(new GetTaskQuery(id),cancellationToken));
|
||||||
|
|
||||||
// POST:Create Entity
|
// POST:Create Entity
|
||||||
public async Task<IResult> Post([FromBody] CreateTaskCommand ent, ISender mediator, CancellationToken cancellationToken)
|
public async Task<IResult> Post([FromBody] CreateTaskCommand ent, ISender mediator, CancellationToken cancellationToken)
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<Using Include="Brizco.Common.Models.Entity" />
|
<Using Include="Brizco.Common.Models.Entity" />
|
||||||
<Using Include="Brizco.Common.Models.Mapper" />
|
<Using Include="Brizco.Common.Models.Mapper" />
|
||||||
<Using Include="Brizco.Domain.Dtos.LargDtos" />
|
<Using Include="Brizco.Domain.Dtos.LargDtos" />
|
||||||
|
<Using Include="Brizco.Domain.Dtos.ResponseDto" />
|
||||||
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
|
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
|
||||||
<Using Include="Brizco.Domain.Entities.Complex" />
|
<Using Include="Brizco.Domain.Entities.Complex" />
|
||||||
<Using Include="Brizco.Domain.Entities.Routine" />
|
<Using Include="Brizco.Domain.Entities.Routine" />
|
||||||
|
|
|
@ -8,12 +8,3 @@ public sealed record UpdatePositionCommand(Guid Id, string Title, string Descrip
|
||||||
|
|
||||||
public sealed record DeletePositionCommand(Guid Id)
|
public sealed record DeletePositionCommand(Guid Id)
|
||||||
: IRequest<bool>;
|
: IRequest<bool>;
|
||||||
|
|
||||||
public sealed record CreatePositionUserCommand(Guid PositionId,Guid UserId, Guid ShiftPlanId)
|
|
||||||
: IRequest<bool>;
|
|
||||||
|
|
||||||
public sealed record UpdatePositionUserCommand(Guid PositionId, Guid UserId, Guid ShiftPlanId)
|
|
||||||
: IRequest<bool>;
|
|
||||||
|
|
||||||
public sealed record DeletePositionUserCommand(Guid PositionId, Guid UserId, Guid ShiftPlanId)
|
|
||||||
: IRequest<bool>;
|
|
|
@ -1,10 +1,10 @@
|
||||||
namespace Brizco.Domain.CommandQueries.Commands;
|
namespace Brizco.Domain.CommandQueries.Commands;
|
||||||
|
|
||||||
|
|
||||||
public sealed record CreateRoutineCommand(string Title, string Description)
|
public sealed record CreateRoutineCommand(string Name, string Description)
|
||||||
: IRequest<RoutineSDto>;
|
: IRequest<RoutineSDto>;
|
||||||
|
|
||||||
public sealed record UpdateRoutineCommand(Guid Id, string Title, string Description)
|
public sealed record UpdateRoutineCommand(Guid Id, string Name, string Description)
|
||||||
: IRequest<bool>;
|
: IRequest<bool>;
|
||||||
|
|
||||||
public sealed record DeleteRoutineCommand(Guid Id)
|
public sealed record DeleteRoutineCommand(Guid Id)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
namespace Brizco.Domain.CommandQueries.Commands;
|
namespace Brizco.Domain.CommandQueries.Commands;
|
||||||
|
|
||||||
public record CreateShiftPlanCommand(DateTime PlanDate,Guid ShiftId,List<Guid> UserIds)
|
public record CreateShiftPlanCommand(DateTime PlanDate,Guid ShiftId,Guid RoutineId, List<KeyValuePair<Guid,Guid>> UserAndPositionIds)
|
||||||
:IRequest<ShiftPlanLDto>;
|
:IRequest<ShiftPlanLDto>;
|
||||||
|
|
||||||
public record UpdateShiftPlanCommand(Guid Id,DateTime PlanDate, Guid ShiftId, List<Guid> UserIds)
|
public record UpdateShiftPlanCommand(Guid Id,DateTime PlanDate, Guid ShiftId, Guid RoutineId, List<KeyValuePair<Guid, Guid>> UserAndPositionIds)
|
||||||
: IRequest<bool>;
|
: IRequest<bool>;
|
||||||
|
|
||||||
public record DeleteShiftPlanCommand(Guid Id)
|
public record DeleteShiftPlanCommand(Guid Id)
|
||||||
|
|
|
@ -4,4 +4,7 @@ public sealed record GetRoutinesQuery(int Page = 0) :
|
||||||
IRequest<List<RoutineSDto>>;
|
IRequest<List<RoutineSDto>>;
|
||||||
|
|
||||||
public sealed record GetRoutineQuery(Guid Id) :
|
public sealed record GetRoutineQuery(Guid Id) :
|
||||||
IRequest<RoutineSDto>;
|
IRequest<RoutineSDto>;
|
||||||
|
|
||||||
|
public sealed record GetRoutineShiftsQuery(Guid Id):
|
||||||
|
IRequest<List<RoutineShiftResponseDto>>;
|
|
@ -10,6 +10,4 @@ public class PositionLDto : BaseDto<PositionLDto, Position>
|
||||||
|
|
||||||
public Guid SectionId { get; set; }
|
public Guid SectionId { get; set; }
|
||||||
public string SectionName { get; set; } = string.Empty;
|
public string SectionName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<PositionUserSDto> Users { get; set; } = new();
|
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ public class TaskLDto : BaseDto<TaskLDto, Entities.Task.Task>
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public string Description { get; set; } = string.Empty;
|
public string Description { get; set; } = string.Empty;
|
||||||
public bool IsDisposable { get; set; }
|
public bool IsDisposable { get; set; }
|
||||||
public DateTime SetFor { get; set; }
|
public long SetFor { get; set; }
|
||||||
public bool HasDisposed { get; set; }
|
public bool HasDisposed { get; set; }
|
||||||
public TaskScheduleType ScheduleType { get; set; }
|
public TaskScheduleType ScheduleType { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Brizco.Domain.Dtos.ResponseDto;
|
||||||
|
|
||||||
|
public class RoutineShiftResponseDto
|
||||||
|
{
|
||||||
|
public DayOfWeek Day { get; set; }
|
||||||
|
public List<ShiftSDto> Shifts { get; set; } = new();
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
namespace Brizco.Domain.Dtos.SmallDtos;
|
|
||||||
|
|
||||||
public class PositionUserSDto : BaseDto<PositionUserSDto, PositionUser>
|
|
||||||
{
|
|
||||||
public Guid ApplicationUserId { get; set; }
|
|
||||||
public Guid PositionId { get; set; }
|
|
||||||
}
|
|
|
@ -5,5 +5,6 @@ namespace Brizco.Domain.Dtos.SmallDtos;
|
||||||
public class ShiftPlanUserSDto : BaseDto<ShiftPlanUserSDto,ShiftPlanUser>
|
public class ShiftPlanUserSDto : BaseDto<ShiftPlanUserSDto,ShiftPlanUser>
|
||||||
{
|
{
|
||||||
public Guid ShiftPlanId { get; set; }
|
public Guid ShiftPlanId { get; set; }
|
||||||
public Guid ApplicationUserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
|
public Guid PositionId { get; set; }
|
||||||
}
|
}
|
|
@ -6,11 +6,14 @@ public class TaskSDto : BaseDto<TaskSDto,Entities.Task.Task>
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public string Description { get; set; } = string.Empty;
|
public string Description { get; set; } = string.Empty;
|
||||||
public bool IsDisposable { get; set; }
|
public bool IsDisposable { get; set; }
|
||||||
public DateTime SetFor { get; set; }
|
public long SetFor { get; set; }
|
||||||
public bool HasDisposed { get; set; }
|
public bool HasDisposed { get; set; }
|
||||||
public Guid ComplexId { get; set; }
|
public Guid ComplexId { get; set; }
|
||||||
public TaskScheduleType ScheduleType { get; set; }
|
public TaskScheduleType ScheduleType { get; set; }
|
||||||
|
|
||||||
|
public List<string> Shifts { get; set; } = new();
|
||||||
|
public List<string> Routines { get; set; } = new();
|
||||||
|
public List<string> Positions { get; set; } = new();
|
||||||
|
|
||||||
public int Amount { get; set; }
|
public int Amount { get; set; }
|
||||||
public PurchaseAmountType AmountType { get; set; }
|
public PurchaseAmountType AmountType { get; set; }
|
||||||
|
|
|
@ -50,19 +50,5 @@ public partial class Position
|
||||||
{
|
{
|
||||||
return new Position(name, description, complexId, sectionId);
|
return new Position(name, description, complexId, sectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PositionUser AddUser(Guid userId , Guid shiftPlanId)
|
|
||||||
{
|
|
||||||
var positionUser = PositionUser.Create(this.Id, userId, shiftPlanId);
|
|
||||||
this.Users.Add(positionUser);
|
|
||||||
return positionUser;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class PositionUser
|
|
||||||
{
|
|
||||||
public static PositionUser Create(Guid positionId, Guid userId, Guid shiftPlanId)
|
|
||||||
{
|
|
||||||
return new PositionUser(positionId, userId, shiftPlanId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,6 +24,4 @@ public partial class Position : ApiEntity
|
||||||
|
|
||||||
public Guid SectionId { get; set; }
|
public Guid SectionId { get; set; }
|
||||||
public Section? Section { get; set; }
|
public Section? Section { get; set; }
|
||||||
|
|
||||||
public List<PositionUser> Users { get; internal set; } = new();
|
|
||||||
}
|
}
|
|
@ -1,27 +0,0 @@
|
||||||
using Brizco.Domain.Entities.User;
|
|
||||||
|
|
||||||
namespace Brizco.Domain.Entities.Complex;
|
|
||||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
|
||||||
[GenerateMapper]
|
|
||||||
public partial class PositionUser : ApiEntity
|
|
||||||
{
|
|
||||||
public PositionUser()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public PositionUser(Guid positionId,Guid applicationUserId ,Guid shiftPlanId)
|
|
||||||
{
|
|
||||||
ApplicationUserId = applicationUserId;
|
|
||||||
ShiftPlanId = shiftPlanId;
|
|
||||||
PositionId = positionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Guid ApplicationUserId { get; set; }
|
|
||||||
public ApplicationUser? ApplicationUser { get; set; }
|
|
||||||
|
|
||||||
public Guid PositionId { get; set; }
|
|
||||||
public Position? Position { get; set; }
|
|
||||||
|
|
||||||
public Guid ShiftPlanId { get; set; }
|
|
||||||
public ShiftPlan? ShiftPlan { get; set; }
|
|
||||||
}
|
|
|
@ -14,9 +14,9 @@ public partial class Shift
|
||||||
this.Days.Add(shiftDay);
|
this.Days.Add(shiftDay);
|
||||||
return shiftDay;
|
return shiftDay;
|
||||||
}
|
}
|
||||||
public ShiftPlan AddPlan(DateTime planDate)
|
public ShiftPlan AddPlan(DateTime planDate,Guid routineId)
|
||||||
{
|
{
|
||||||
var plan = new ShiftPlan(planDate , Id);
|
var plan = new ShiftPlan(planDate , routineId, Id);
|
||||||
Plans.Add(plan);
|
Plans.Add(plan);
|
||||||
return plan;
|
return plan;
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@ public partial class Shift
|
||||||
|
|
||||||
public partial class ShiftPlan
|
public partial class ShiftPlan
|
||||||
{
|
{
|
||||||
public ShiftPlanUser AddUser(Guid userId)
|
public ShiftPlanUser AddUser(Guid positionId,Guid userId)
|
||||||
{
|
{
|
||||||
var planUser = new ShiftPlanUser(Id , userId);
|
var planUser = new ShiftPlanUser(Id , positionId, userId);
|
||||||
Users.Add(planUser);
|
Users.Add(planUser);
|
||||||
return planUser;
|
return planUser;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,19 @@ public partial class ShiftPlan : ApiEntity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal ShiftPlan(DateTime planDate,Guid shiftId)
|
internal ShiftPlan(DateTime planFor, Guid routineId,Guid shiftId)
|
||||||
{
|
{
|
||||||
PlanDate = planDate;
|
PlanFor = planFor;
|
||||||
|
RoutineId = routineId;
|
||||||
ShiftId = shiftId;
|
ShiftId = shiftId;
|
||||||
}
|
}
|
||||||
public DateTime PlanDate { get; internal set; }
|
public DateTime PlanFor { get; internal set; }
|
||||||
|
|
||||||
public Guid ShiftId { get; internal set; }
|
public Guid ShiftId { get; internal set; }
|
||||||
public virtual Shift? Shift { get; internal set; }
|
public virtual Shift? Shift { get; internal set; }
|
||||||
|
|
||||||
|
public Guid RoutineId { get; internal set; }
|
||||||
|
public virtual Routine.Routine? Routine { get; internal set; }
|
||||||
|
|
||||||
public List<ShiftPlanUser> Users { get; internal set; } = new();
|
public List<ShiftPlanUser> Users { get; internal set; } = new();
|
||||||
}
|
}
|
|
@ -11,14 +11,18 @@ public class ShiftPlanUser : ApiEntity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShiftPlanUser(Guid shiftPlanId, Guid applicationUserId)
|
public ShiftPlanUser(Guid shiftPlanId,Guid positionId, Guid userId)
|
||||||
{
|
{
|
||||||
ShiftPlanId = shiftPlanId;
|
ShiftPlanId = shiftPlanId;
|
||||||
ApplicationUserId = applicationUserId;
|
PositionId = positionId;
|
||||||
|
UserId = userId;
|
||||||
}
|
}
|
||||||
public Guid ShiftPlanId { get; internal set; }
|
public Guid ShiftPlanId { get; internal set; }
|
||||||
public ShiftPlan? ShiftPlan { get; internal set; }
|
public ShiftPlan? ShiftPlan { get; internal set; }
|
||||||
|
|
||||||
public Guid ApplicationUserId { get; internal set; }
|
public Guid PositionId { get; internal set; }
|
||||||
public ApplicationUser? ApplicationUser { get; internal set; }
|
public Position? Position { get; internal set; }
|
||||||
|
|
||||||
|
public Guid UserId { get; internal set; }
|
||||||
|
public ApplicationUser? User { get; internal set; }
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@ public class TaskPosition : ApiEntity
|
||||||
TaskId = taskId;
|
TaskId = taskId;
|
||||||
}
|
}
|
||||||
public Guid PositionId { get; internal set; }
|
public Guid PositionId { get; internal set; }
|
||||||
public virtual Position? Role { get; internal set; }
|
public virtual Position? Position { get; internal set; }
|
||||||
public Guid TaskId { get; internal set; }
|
public Guid TaskId { get; internal set; }
|
||||||
public virtual Task? Task { get; internal set; }
|
public virtual Task? Task { get; internal set; }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Brizco.Domain.Dtos.LargDtos;
|
using Brizco.Domain.Dtos.LargDtos;
|
||||||
using Brizco.Domain.Dtos.SmallDtos;
|
using Brizco.Domain.Dtos.SmallDtos;
|
||||||
|
@ -95,215 +93,95 @@ namespace Brizco.Domain.Mappers
|
||||||
Name = p9.SectionName,
|
Name = p9.SectionName,
|
||||||
Id = p9.SectionId
|
Id = p9.SectionId
|
||||||
},
|
},
|
||||||
Users = funcMain1(p9.Users),
|
|
||||||
Id = p9.Id
|
Id = p9.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Position AdaptTo(this PositionLDto p11, Position p12)
|
public static Position AdaptTo(this PositionLDto p10, Position p11)
|
||||||
{
|
|
||||||
if (p11 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Position result = p12 ?? new Position();
|
|
||||||
|
|
||||||
result.Name = p11.Name;
|
|
||||||
result.Description = p11.Description;
|
|
||||||
result.ComplexId = p11.ComplexId;
|
|
||||||
result.Complex = funcMain2(new Never(), result.Complex, p11);
|
|
||||||
result.SectionId = p11.SectionId;
|
|
||||||
result.Section = funcMain3(new Never(), result.Section, p11);
|
|
||||||
result.Users = funcMain4(p11.Users, result.Users);
|
|
||||||
result.Id = p11.Id;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
public static Expression<Func<PositionLDto, Position>> ProjectLDtoToPosition => p19 => new Position()
|
|
||||||
{
|
|
||||||
Name = p19.Name,
|
|
||||||
Description = p19.Description,
|
|
||||||
ComplexId = p19.ComplexId,
|
|
||||||
Complex = new Complex() {Id = p19.ComplexId},
|
|
||||||
SectionId = p19.SectionId,
|
|
||||||
Section = new Section()
|
|
||||||
{
|
|
||||||
Name = p19.SectionName,
|
|
||||||
Id = p19.SectionId
|
|
||||||
},
|
|
||||||
Users = p19.Users.Select<PositionUserSDto, PositionUser>(p20 => new PositionUser()
|
|
||||||
{
|
|
||||||
ApplicationUserId = p20.ApplicationUserId,
|
|
||||||
PositionId = p20.PositionId,
|
|
||||||
Id = p20.Id
|
|
||||||
}).ToList<PositionUser>(),
|
|
||||||
Id = p19.Id
|
|
||||||
};
|
|
||||||
public static PositionLDto AdaptToLDto(this Position p21)
|
|
||||||
{
|
|
||||||
return p21 == null ? null : new PositionLDto()
|
|
||||||
{
|
|
||||||
Name = p21.Name,
|
|
||||||
Description = p21.Description,
|
|
||||||
ComplexId = p21.ComplexId,
|
|
||||||
SectionId = p21.SectionId,
|
|
||||||
SectionName = p21.Section != null ? p21.Section.Name : string.Empty,
|
|
||||||
Users = funcMain5(p21.Users),
|
|
||||||
Id = p21.Id
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public static PositionLDto AdaptTo(this Position p23, PositionLDto p24)
|
|
||||||
{
|
|
||||||
if (p23 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
PositionLDto result = p24 ?? new PositionLDto();
|
|
||||||
|
|
||||||
result.Name = p23.Name;
|
|
||||||
result.Description = p23.Description;
|
|
||||||
result.ComplexId = p23.ComplexId;
|
|
||||||
result.SectionId = p23.SectionId;
|
|
||||||
result.SectionName = p23.Section != null ? p23.Section.Name : string.Empty;
|
|
||||||
result.Users = funcMain6(p23.Users, result.Users);
|
|
||||||
result.Id = p23.Id;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
public static Expression<Func<Position, PositionLDto>> ProjectToLDto => p27 => new PositionLDto()
|
|
||||||
{
|
|
||||||
Name = p27.Name,
|
|
||||||
Description = p27.Description,
|
|
||||||
ComplexId = p27.ComplexId,
|
|
||||||
SectionId = p27.SectionId,
|
|
||||||
SectionName = p27.Section != null ? p27.Section.Name : string.Empty,
|
|
||||||
Users = p27.Users.Select<PositionUser, PositionUserSDto>(p28 => new PositionUserSDto()
|
|
||||||
{
|
|
||||||
ApplicationUserId = p28.ApplicationUserId,
|
|
||||||
PositionId = p28.PositionId,
|
|
||||||
Id = p28.Id
|
|
||||||
}).ToList<PositionUserSDto>(),
|
|
||||||
Id = p27.Id
|
|
||||||
};
|
|
||||||
|
|
||||||
private static List<PositionUser> funcMain1(List<PositionUserSDto> p10)
|
|
||||||
{
|
{
|
||||||
if (p10 == null)
|
if (p10 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<PositionUser> result = new List<PositionUser>(p10.Count);
|
Position result = p11 ?? new Position();
|
||||||
|
|
||||||
int i = 0;
|
result.Name = p10.Name;
|
||||||
int len = p10.Count;
|
result.Description = p10.Description;
|
||||||
|
result.ComplexId = p10.ComplexId;
|
||||||
|
result.Complex = funcMain1(new Never(), result.Complex, p10);
|
||||||
|
result.SectionId = p10.SectionId;
|
||||||
|
result.Section = funcMain2(new Never(), result.Section, p10);
|
||||||
|
result.Id = p10.Id;
|
||||||
|
return result;
|
||||||
|
|
||||||
while (i < len)
|
}
|
||||||
|
public static Expression<Func<PositionLDto, Position>> ProjectLDtoToPosition => p16 => new Position()
|
||||||
|
{
|
||||||
|
Name = p16.Name,
|
||||||
|
Description = p16.Description,
|
||||||
|
ComplexId = p16.ComplexId,
|
||||||
|
Complex = new Complex() {Id = p16.ComplexId},
|
||||||
|
SectionId = p16.SectionId,
|
||||||
|
Section = new Section()
|
||||||
{
|
{
|
||||||
PositionUserSDto item = p10[i];
|
Name = p16.SectionName,
|
||||||
result.Add(item == null ? null : new PositionUser()
|
Id = p16.SectionId
|
||||||
{
|
},
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
Id = p16.Id
|
||||||
PositionId = item.PositionId,
|
};
|
||||||
Id = item.Id
|
public static PositionLDto AdaptToLDto(this Position p17)
|
||||||
});
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Complex funcMain2(Never p13, Complex p14, PositionLDto p11)
|
|
||||||
{
|
{
|
||||||
Complex result = p14 ?? new Complex();
|
return p17 == null ? null : new PositionLDto()
|
||||||
|
{
|
||||||
result.Id = p11.ComplexId;
|
Name = p17.Name,
|
||||||
return result;
|
Description = p17.Description,
|
||||||
|
ComplexId = p17.ComplexId,
|
||||||
|
SectionId = p17.SectionId,
|
||||||
|
SectionName = p17.Section != null ? p17.Section.Name : string.Empty,
|
||||||
|
Id = p17.Id
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
public static PositionLDto AdaptTo(this Position p18, PositionLDto p19)
|
||||||
private static Section funcMain3(Never p15, Section p16, PositionLDto p11)
|
|
||||||
{
|
{
|
||||||
Section result = p16 ?? new Section();
|
if (p18 == null)
|
||||||
|
|
||||||
result.Name = p11.SectionName;
|
|
||||||
result.Id = p11.SectionId;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<PositionUser> funcMain4(List<PositionUserSDto> p17, List<PositionUser> p18)
|
|
||||||
{
|
|
||||||
if (p17 == null)
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<PositionUser> result = new List<PositionUser>(p17.Count);
|
PositionLDto result = p19 ?? new PositionLDto();
|
||||||
|
|
||||||
int i = 0;
|
result.Name = p18.Name;
|
||||||
int len = p17.Count;
|
result.Description = p18.Description;
|
||||||
|
result.ComplexId = p18.ComplexId;
|
||||||
|
result.SectionId = p18.SectionId;
|
||||||
|
result.SectionName = p18.Section != null ? p18.Section.Name : string.Empty;
|
||||||
|
result.Id = p18.Id;
|
||||||
|
return result;
|
||||||
|
|
||||||
while (i < len)
|
}
|
||||||
{
|
public static Expression<Func<Position, PositionLDto>> ProjectToLDto => p20 => new PositionLDto()
|
||||||
PositionUserSDto item = p17[i];
|
{
|
||||||
result.Add(item == null ? null : new PositionUser()
|
Name = p20.Name,
|
||||||
{
|
Description = p20.Description,
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
ComplexId = p20.ComplexId,
|
||||||
PositionId = item.PositionId,
|
SectionId = p20.SectionId,
|
||||||
Id = item.Id
|
SectionName = p20.Section != null ? p20.Section.Name : string.Empty,
|
||||||
});
|
Id = p20.Id
|
||||||
i++;
|
};
|
||||||
}
|
|
||||||
|
private static Complex funcMain1(Never p12, Complex p13, PositionLDto p10)
|
||||||
|
{
|
||||||
|
Complex result = p13 ?? new Complex();
|
||||||
|
|
||||||
|
result.Id = p10.ComplexId;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<PositionUserSDto> funcMain5(List<PositionUser> p22)
|
private static Section funcMain2(Never p14, Section p15, PositionLDto p10)
|
||||||
{
|
{
|
||||||
if (p22 == null)
|
Section result = p15 ?? new Section();
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<PositionUserSDto> result = new List<PositionUserSDto>(p22.Count);
|
|
||||||
|
|
||||||
int i = 0;
|
result.Name = p10.SectionName;
|
||||||
int len = p22.Count;
|
result.Id = p10.SectionId;
|
||||||
|
|
||||||
while (i < len)
|
|
||||||
{
|
|
||||||
PositionUser item = p22[i];
|
|
||||||
result.Add(item == null ? null : new PositionUserSDto()
|
|
||||||
{
|
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
|
||||||
PositionId = item.PositionId,
|
|
||||||
Id = item.Id
|
|
||||||
});
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<PositionUserSDto> funcMain6(List<PositionUser> p25, List<PositionUserSDto> p26)
|
|
||||||
{
|
|
||||||
if (p25 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<PositionUserSDto> result = new List<PositionUserSDto>(p25.Count);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int len = p25.Count;
|
|
||||||
|
|
||||||
while (i < len)
|
|
||||||
{
|
|
||||||
PositionUser item = p25[i];
|
|
||||||
result.Add(item == null ? null : new PositionUserSDto()
|
|
||||||
{
|
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
|
||||||
PositionId = item.PositionId,
|
|
||||||
Id = item.Id
|
|
||||||
});
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using Brizco.Domain.Dtos.SmallDtos;
|
|
||||||
using Brizco.Domain.Entities.Complex;
|
|
||||||
|
|
||||||
namespace Brizco.Domain.Mappers
|
|
||||||
{
|
|
||||||
public static partial class PositionUserMapper
|
|
||||||
{
|
|
||||||
public static PositionUser AdaptToPositionUser(this PositionUserSDto p1)
|
|
||||||
{
|
|
||||||
return p1 == null ? null : new PositionUser()
|
|
||||||
{
|
|
||||||
ApplicationUserId = p1.ApplicationUserId,
|
|
||||||
PositionId = p1.PositionId,
|
|
||||||
Id = p1.Id
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public static PositionUser AdaptTo(this PositionUserSDto p2, PositionUser p3)
|
|
||||||
{
|
|
||||||
if (p2 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
PositionUser result = p3 ?? new PositionUser();
|
|
||||||
|
|
||||||
result.ApplicationUserId = p2.ApplicationUserId;
|
|
||||||
result.PositionId = p2.PositionId;
|
|
||||||
result.Id = p2.Id;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
public static Expression<Func<PositionUserSDto, PositionUser>> ProjectToPositionUser => p4 => new PositionUser()
|
|
||||||
{
|
|
||||||
ApplicationUserId = p4.ApplicationUserId,
|
|
||||||
PositionId = p4.PositionId,
|
|
||||||
Id = p4.Id
|
|
||||||
};
|
|
||||||
public static PositionUserSDto AdaptToSDto(this PositionUser p5)
|
|
||||||
{
|
|
||||||
return p5 == null ? null : new PositionUserSDto()
|
|
||||||
{
|
|
||||||
ApplicationUserId = p5.ApplicationUserId,
|
|
||||||
PositionId = p5.PositionId,
|
|
||||||
Id = p5.Id
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public static PositionUserSDto AdaptTo(this PositionUser p6, PositionUserSDto p7)
|
|
||||||
{
|
|
||||||
if (p6 == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
PositionUserSDto result = p7 ?? new PositionUserSDto();
|
|
||||||
|
|
||||||
result.ApplicationUserId = p6.ApplicationUserId;
|
|
||||||
result.PositionId = p6.PositionId;
|
|
||||||
result.Id = p6.Id;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
public static Expression<Func<PositionUser, PositionUserSDto>> ProjectToSDto => p8 => new PositionUserSDto()
|
|
||||||
{
|
|
||||||
ApplicationUserId = p8.ApplicationUserId,
|
|
||||||
PositionId = p8.PositionId,
|
|
||||||
Id = p8.Id
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -94,7 +94,8 @@ namespace Brizco.Domain.Mappers
|
||||||
Users = p15.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p16 => new ShiftPlanUser()
|
Users = p15.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p16 => new ShiftPlanUser()
|
||||||
{
|
{
|
||||||
ShiftPlanId = p16.ShiftPlanId,
|
ShiftPlanId = p16.ShiftPlanId,
|
||||||
ApplicationUserId = p16.ApplicationUserId,
|
PositionId = p16.PositionId,
|
||||||
|
UserId = p16.UserId,
|
||||||
Id = p16.Id
|
Id = p16.Id
|
||||||
}).ToList<ShiftPlanUser>(),
|
}).ToList<ShiftPlanUser>(),
|
||||||
Id = p15.Id
|
Id = p15.Id
|
||||||
|
@ -128,7 +129,8 @@ namespace Brizco.Domain.Mappers
|
||||||
Users = p23.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p24 => new ShiftPlanUserSDto()
|
Users = p23.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p24 => new ShiftPlanUserSDto()
|
||||||
{
|
{
|
||||||
ShiftPlanId = p24.ShiftPlanId,
|
ShiftPlanId = p24.ShiftPlanId,
|
||||||
ApplicationUserId = p24.ApplicationUserId,
|
UserId = p24.UserId,
|
||||||
|
PositionId = p24.PositionId,
|
||||||
Id = p24.Id
|
Id = p24.Id
|
||||||
}).ToList<ShiftPlanUserSDto>(),
|
}).ToList<ShiftPlanUserSDto>(),
|
||||||
Id = p23.Id
|
Id = p23.Id
|
||||||
|
@ -151,7 +153,8 @@ namespace Brizco.Domain.Mappers
|
||||||
result.Add(item == null ? null : new ShiftPlanUser()
|
result.Add(item == null ? null : new ShiftPlanUser()
|
||||||
{
|
{
|
||||||
ShiftPlanId = item.ShiftPlanId,
|
ShiftPlanId = item.ShiftPlanId,
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
PositionId = item.PositionId,
|
||||||
|
UserId = item.UserId,
|
||||||
Id = item.Id
|
Id = item.Id
|
||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
|
@ -177,7 +180,8 @@ namespace Brizco.Domain.Mappers
|
||||||
result.Add(item == null ? null : new ShiftPlanUser()
|
result.Add(item == null ? null : new ShiftPlanUser()
|
||||||
{
|
{
|
||||||
ShiftPlanId = item.ShiftPlanId,
|
ShiftPlanId = item.ShiftPlanId,
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
PositionId = item.PositionId,
|
||||||
|
UserId = item.UserId,
|
||||||
Id = item.Id
|
Id = item.Id
|
||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
|
@ -203,7 +207,8 @@ namespace Brizco.Domain.Mappers
|
||||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||||
{
|
{
|
||||||
ShiftPlanId = item.ShiftPlanId,
|
ShiftPlanId = item.ShiftPlanId,
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
UserId = item.UserId,
|
||||||
|
PositionId = item.PositionId,
|
||||||
Id = item.Id
|
Id = item.Id
|
||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
|
@ -229,7 +234,8 @@ namespace Brizco.Domain.Mappers
|
||||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||||
{
|
{
|
||||||
ShiftPlanId = item.ShiftPlanId,
|
ShiftPlanId = item.ShiftPlanId,
|
||||||
ApplicationUserId = item.ApplicationUserId,
|
UserId = item.UserId,
|
||||||
|
PositionId = item.PositionId,
|
||||||
Id = item.Id
|
Id = item.Id
|
||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -12,7 +12,8 @@ namespace Brizco.Domain.Mappers
|
||||||
return p1 == null ? null : new ShiftPlanUser()
|
return p1 == null ? null : new ShiftPlanUser()
|
||||||
{
|
{
|
||||||
ShiftPlanId = p1.ShiftPlanId,
|
ShiftPlanId = p1.ShiftPlanId,
|
||||||
ApplicationUserId = p1.ApplicationUserId,
|
PositionId = p1.PositionId,
|
||||||
|
UserId = p1.UserId,
|
||||||
Id = p1.Id
|
Id = p1.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,7 +26,8 @@ namespace Brizco.Domain.Mappers
|
||||||
ShiftPlanUser result = p3 ?? new ShiftPlanUser();
|
ShiftPlanUser result = p3 ?? new ShiftPlanUser();
|
||||||
|
|
||||||
result.ShiftPlanId = p2.ShiftPlanId;
|
result.ShiftPlanId = p2.ShiftPlanId;
|
||||||
result.ApplicationUserId = p2.ApplicationUserId;
|
result.PositionId = p2.PositionId;
|
||||||
|
result.UserId = p2.UserId;
|
||||||
result.Id = p2.Id;
|
result.Id = p2.Id;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -33,7 +35,8 @@ namespace Brizco.Domain.Mappers
|
||||||
public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p4 => new ShiftPlanUser()
|
public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p4 => new ShiftPlanUser()
|
||||||
{
|
{
|
||||||
ShiftPlanId = p4.ShiftPlanId,
|
ShiftPlanId = p4.ShiftPlanId,
|
||||||
ApplicationUserId = p4.ApplicationUserId,
|
PositionId = p4.PositionId,
|
||||||
|
UserId = p4.UserId,
|
||||||
Id = p4.Id
|
Id = p4.Id
|
||||||
};
|
};
|
||||||
public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p5)
|
public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p5)
|
||||||
|
@ -41,7 +44,8 @@ namespace Brizco.Domain.Mappers
|
||||||
return p5 == null ? null : new ShiftPlanUserSDto()
|
return p5 == null ? null : new ShiftPlanUserSDto()
|
||||||
{
|
{
|
||||||
ShiftPlanId = p5.ShiftPlanId,
|
ShiftPlanId = p5.ShiftPlanId,
|
||||||
ApplicationUserId = p5.ApplicationUserId,
|
UserId = p5.UserId,
|
||||||
|
PositionId = p5.PositionId,
|
||||||
Id = p5.Id
|
Id = p5.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -54,7 +58,8 @@ namespace Brizco.Domain.Mappers
|
||||||
ShiftPlanUserSDto result = p7 ?? new ShiftPlanUserSDto();
|
ShiftPlanUserSDto result = p7 ?? new ShiftPlanUserSDto();
|
||||||
|
|
||||||
result.ShiftPlanId = p6.ShiftPlanId;
|
result.ShiftPlanId = p6.ShiftPlanId;
|
||||||
result.ApplicationUserId = p6.ApplicationUserId;
|
result.UserId = p6.UserId;
|
||||||
|
result.PositionId = p6.PositionId;
|
||||||
result.Id = p6.Id;
|
result.Id = p6.Id;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -62,7 +67,8 @@ namespace Brizco.Domain.Mappers
|
||||||
public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p8 => new ShiftPlanUserSDto()
|
public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p8 => new ShiftPlanUserSDto()
|
||||||
{
|
{
|
||||||
ShiftPlanId = p8.ShiftPlanId,
|
ShiftPlanId = p8.ShiftPlanId,
|
||||||
ApplicationUserId = p8.ApplicationUserId,
|
UserId = p8.UserId,
|
||||||
|
PositionId = p8.PositionId,
|
||||||
Id = p8.Id
|
Id = p8.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
||||||
using Brizco.Domain.Entities.Complex;
|
using Brizco.Domain.Entities.Complex;
|
||||||
using Brizco.Domain.Entities.Shift;
|
using Brizco.Domain.Entities.Shift;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
using Task = Brizco.Domain.Entities.Task.Task;
|
||||||
|
|
||||||
namespace Brizco.Domain;
|
namespace Brizco.Domain;
|
||||||
|
|
||||||
|
@ -8,6 +9,18 @@ public class MapsterRegister : IRegister
|
||||||
{
|
{
|
||||||
public void Register(TypeAdapterConfig config)
|
public void Register(TypeAdapterConfig config)
|
||||||
{
|
{
|
||||||
|
config.NewConfig<Task, TaskSDto>()
|
||||||
|
.Map("SetFor",o=>DateTimeExtensions.DateTimeToUnixTimeStamp(o.SetFor))
|
||||||
|
.Map("Shifts", o => o.Shifts.Select(d => d.Shift != null ? d.Shift.Title : string.Empty))
|
||||||
|
.Map("Routines", o => o.Routines.Select(d => d.Routine != null ? d.Routine.Name : string.Empty))
|
||||||
|
.Map("Positions", o => o.Positions.Select(d => d.Position != null ? d.Position.Name : string.Empty))
|
||||||
|
.TwoWays();
|
||||||
|
|
||||||
|
|
||||||
|
config.NewConfig<Task, TaskLDto>()
|
||||||
|
.Map("SetFor", o => DateTimeExtensions.DateTimeToUnixTimeStamp(o.SetFor))
|
||||||
|
.TwoWays();
|
||||||
|
|
||||||
config.NewConfig<Shift, ShiftSDto>()
|
config.NewConfig<Shift, ShiftSDto>()
|
||||||
.Map("Days",o=>o.Days.Select(d=>d.DayOfWeek).ToList())
|
.Map("Days",o=>o.Days.Select(d=>d.DayOfWeek).ToList())
|
||||||
.TwoWays();
|
.TwoWays();
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
<Using Include="Brizco.Domain.CommandQueries.Commands" />
|
<Using Include="Brizco.Domain.CommandQueries.Commands" />
|
||||||
<Using Include="Brizco.Domain.CommandQueries.Queries" />
|
<Using Include="Brizco.Domain.CommandQueries.Queries" />
|
||||||
<Using Include="Brizco.Domain.Dtos.LargDtos" />
|
<Using Include="Brizco.Domain.Dtos.LargDtos" />
|
||||||
|
<Using Include="Brizco.Domain.Dtos.ResponseDto" />
|
||||||
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
|
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
|
||||||
<Using Include="Brizco.Domain.Entities.Complex" />
|
<Using Include="Brizco.Domain.Entities.Complex" />
|
||||||
<Using Include="Brizco.Repository.Abstracts" />
|
<Using Include="Brizco.Repository.Abstracts" />
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
using Brizco.Repository.Abstracts;
|
|
||||||
|
|
||||||
namespace Brizco.Repository.Handlers.Position;
|
|
||||||
|
|
||||||
public class CreatePositionUserCommandHandler : IRequestHandler<CreatePositionUserCommand,bool>
|
|
||||||
{
|
|
||||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
|
||||||
|
|
||||||
public CreatePositionUserCommandHandler(IRepositoryWrapper repositoryWrapper)
|
|
||||||
{
|
|
||||||
_repositoryWrapper = repositoryWrapper;
|
|
||||||
}
|
|
||||||
public async Task<bool> Handle(CreatePositionUserCommand request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var entity = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>().TableNoTracking
|
|
||||||
.FirstOrDefaultAsync(p => p.Id == request.PositionId, cancellationToken);
|
|
||||||
if (entity == null)
|
|
||||||
throw new AppException("Position not found");
|
|
||||||
entity.AddUser(request.UserId,request.ShiftPlanId);
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>().Update(entity);
|
|
||||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
|
||||||
await _repositoryWrapper.CommitAsync(cancellationToken);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
await _repositoryWrapper.RollBackAsync(cancellationToken);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,27 +29,6 @@ public class UpdatePositionCommandHandler : IRequestHandler<UpdatePositionComman
|
||||||
request.SectionId);
|
request.SectionId);
|
||||||
newPosition.Id = request.Id;
|
newPosition.Id = request.Id;
|
||||||
|
|
||||||
var users = await _repositoryWrapper.SetRepository<PositionUser>().TableNoTracking
|
|
||||||
.Where(pu => pu.PositionId == newPosition.Id)
|
|
||||||
.ToListAsync(cancellationToken);
|
|
||||||
|
|
||||||
//foreach (var user in users)
|
|
||||||
//{
|
|
||||||
// if (!request.UserIds.Contains(user.ApplicationUserId))
|
|
||||||
// {
|
|
||||||
// _repositoryWrapper.SetRepository<PositionUser>()
|
|
||||||
// .Delete(user);
|
|
||||||
// await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//foreach (var userId in request.UserIds)
|
|
||||||
//{
|
|
||||||
// if (users.FirstOrDefault(u => u.ApplicationUserId == userId) == null)
|
|
||||||
// {
|
|
||||||
// newPosition.AddUser(userId);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>()
|
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>()
|
||||||
.Update(newPosition);
|
.Update(newPosition);
|
||||||
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
using Brizco.Repository.Abstracts;
|
|
||||||
|
|
||||||
namespace Brizco.Repository.Handlers.Position;
|
|
||||||
|
|
||||||
public class UpdatePositionUserCommandHandler : IRequestHandler<UpdatePositionUserCommand,bool>
|
|
||||||
{
|
|
||||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
|
||||||
|
|
||||||
public UpdatePositionUserCommandHandler(IRepositoryWrapper repositoryWrapper)
|
|
||||||
{
|
|
||||||
_repositoryWrapper = repositoryWrapper;
|
|
||||||
}
|
|
||||||
public async Task<bool> Handle(UpdatePositionUserCommand request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
|
||||||
|
|
||||||
var entity = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.PositionUser>().TableNoTracking
|
|
||||||
.FirstOrDefaultAsync(p => p.ApplicationUserId == request.UserId , cancellationToken);
|
|
||||||
if (entity == null)
|
|
||||||
throw new AppException("PositionUser not found");
|
|
||||||
var newEntity = PositionUser.Create(request.PositionId, request.UserId, request.ShiftPlanId);
|
|
||||||
newEntity.Id = entity.Id;
|
|
||||||
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.PositionUser>().Update(newEntity);
|
|
||||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
|
||||||
await _repositoryWrapper.CommitAsync(cancellationToken);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
await _repositoryWrapper.RollBackAsync(cancellationToken);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,7 +22,7 @@ public class CreateRoutineCommandHandler : IRequestHandler<CreateRoutineCommand,
|
||||||
{
|
{
|
||||||
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
||||||
var entity = Domain.Entities.Routine.Routine
|
var entity = Domain.Entities.Routine.Routine
|
||||||
.Create(request.Title,request.Description,complexId);
|
.Create(request.Name,request.Description,complexId);
|
||||||
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Routine.Routine>().Add(entity);
|
_repositoryWrapper.SetRepository<Domain.Entities.Routine.Routine>().Add(entity);
|
||||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
using Brizco.Domain.Entities.Shift;
|
||||||
|
|
||||||
|
namespace Brizco.Repository.Handlers.Routine;
|
||||||
|
|
||||||
|
public class GetRoutineShiftsQueryHandler : IRequestHandler<GetRoutineShiftsQuery,List<RoutineShiftResponseDto>>
|
||||||
|
{
|
||||||
|
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||||
|
|
||||||
|
public GetRoutineShiftsQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||||
|
{
|
||||||
|
_repositoryWrapper = repositoryWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<RoutineShiftResponseDto>> Handle(GetRoutineShiftsQuery request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var routineShiftResponse = new List<RoutineShiftResponseDto>();
|
||||||
|
|
||||||
|
var shiftRoutines = await _repositoryWrapper.SetRepository<ShiftRoutine>()
|
||||||
|
.TableNoTracking
|
||||||
|
.Where(s => s.RoutineId == request.Id)
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
foreach (var shiftRoutine in shiftRoutines)
|
||||||
|
{
|
||||||
|
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
|
||||||
|
.TableNoTracking
|
||||||
|
.Where(s => s.Id == shiftRoutine.ShiftId)
|
||||||
|
.Select(ShiftMapper.ProjectToSDto)
|
||||||
|
.FirstOrDefaultAsync(cancellationToken);
|
||||||
|
shift?.Days.ForEach(d =>
|
||||||
|
{
|
||||||
|
var routineShiftRes = routineShiftResponse.FirstOrDefault(s => s.Day == d);
|
||||||
|
if (routineShiftRes != null)
|
||||||
|
{
|
||||||
|
routineShiftRes.Shifts.Add(shift);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
routineShiftResponse.Add(new RoutineShiftResponseDto
|
||||||
|
{
|
||||||
|
Shifts = new List<ShiftSDto>{shift},
|
||||||
|
Day = d
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return routineShiftResponse;
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,15 +23,11 @@ public class UpdateRoutineCommandHandler : IRequestHandler<UpdateRoutineCommand,
|
||||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||||
|
|
||||||
var newEntity = Domain.Entities.Routine.Routine.Create(request.Title,
|
var newEntity = Domain.Entities.Routine.Routine.Create(request.Name,
|
||||||
request.Description,
|
request.Description,
|
||||||
complexId);
|
complexId);
|
||||||
newEntity.Id = request.Id;
|
newEntity.Id = request.Id;
|
||||||
|
|
||||||
var users = await _repositoryWrapper.SetRepository<PositionUser>().TableNoTracking
|
|
||||||
.Where(pu => pu.PositionId == newEntity.Id)
|
|
||||||
.ToListAsync(cancellationToken);
|
|
||||||
|
|
||||||
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Routine.Routine>()
|
_repositoryWrapper.SetRepository<Domain.Entities.Routine.Routine>()
|
||||||
.Update(newEntity);
|
.Update(newEntity);
|
||||||
|
|
|
@ -19,13 +19,16 @@ public class CreateShiftPlanCommandHandler : IRequestHandler<CreateShiftPlanComm
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
await _repositoryWrapper.BeginTransaction(cancellationToken);
|
||||||
var shiftPlan = shift.AddPlan(request.PlanDate);
|
var shiftPlan = shift.AddPlan(request.PlanDate,request.RoutineId);
|
||||||
|
|
||||||
if (request.UserIds.Count == 0)
|
if (request.UserAndPositionIds.Count == 0)
|
||||||
throw new AppException("شیفت بندی مورد نظر باید حداقل متشکل از یک فرد باشد",
|
throw new AppException("شیفت بندی مورد نظر باید حداقل متشکل از یک فرد باشد", ApiResultStatusCode.BadRequest);
|
||||||
ApiResultStatusCode.BadRequest);
|
|
||||||
|
|
||||||
request.UserIds.ForEach(i => shiftPlan.AddUser(i));
|
|
||||||
|
foreach (var userAndPositionId in request.UserAndPositionIds)
|
||||||
|
{
|
||||||
|
shiftPlan.AddUser(userAndPositionId.Key, userAndPositionId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>().Add(shiftPlan);
|
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>().Add(shiftPlan);
|
||||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class UpdateShiftPlanCommandHandler : IRequestHandler<UpdateShiftPlanComm
|
||||||
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
|
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
|
||||||
|
|
||||||
|
|
||||||
var newPlan = shift.AddPlan(request.PlanDate);
|
var newPlan = shift.AddPlan(request.PlanDate,request.RoutineId);
|
||||||
newPlan.Id = request.Id;
|
newPlan.Id = request.Id;
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,15 +35,15 @@ public class UpdateShiftPlanCommandHandler : IRequestHandler<UpdateShiftPlanComm
|
||||||
|
|
||||||
foreach (var shiftPlanUser in shiftPlanUsers)
|
foreach (var shiftPlanUser in shiftPlanUsers)
|
||||||
{
|
{
|
||||||
if (request.UserIds.Contains(shiftPlanUser.Id))
|
if (request.UserAndPositionIds.Contains(new KeyValuePair<Guid, Guid>(shiftPlanUser.PositionId,shiftPlanUser.UserId)))
|
||||||
request.UserIds.Remove(shiftPlanUser.Id);
|
request.UserAndPositionIds.Remove(new KeyValuePair<Guid, Guid>(shiftPlanUser.PositionId, shiftPlanUser.UserId));
|
||||||
else
|
else
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlanUser>()
|
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlanUser>()
|
||||||
.Delete(shiftPlanUser);
|
.Delete(shiftPlanUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var userId in request.UserIds)
|
foreach (var userId in request.UserAndPositionIds)
|
||||||
newPlan.AddUser(userId);
|
newPlan.AddUser(userId.Key,userId.Value);
|
||||||
|
|
||||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||||
.Update(newPlan);
|
.Update(newPlan);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,70 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Brizco.Repository.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class editShiftPlan : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "PlanDate",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans",
|
||||||
|
newName: "PlanFor");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "RoutineId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShiftPlans_RoutineId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans",
|
||||||
|
column: "RoutineId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShiftPlans_Routines_RoutineId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans",
|
||||||
|
column: "RoutineId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Routines",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShiftPlans_Routines_RoutineId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_ShiftPlans_RoutineId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "RoutineId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "PlanFor",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlans",
|
||||||
|
newName: "PlanDate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,177 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Brizco.Repository.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class editShiftPlanUser : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShiftPlanUsers_Users_ApplicationUserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PositionUsers",
|
||||||
|
schema: "public");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ApplicationUserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
newName: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShiftPlanUsers_ApplicationUserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
newName: "IX_ShiftPlanUsers_UserId");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShiftPlanUsers_PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
column: "PositionId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShiftPlanUsers_Positions_PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
column: "PositionId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Positions",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShiftPlanUsers_Users_UserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
column: "UserId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShiftPlanUsers_Positions_PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ShiftPlanUsers_Users_UserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_ShiftPlanUsers_PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "UserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
newName: "ApplicationUserId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_ShiftPlanUsers_UserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
newName: "IX_ShiftPlanUsers_ApplicationUserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PositionUsers",
|
||||||
|
schema: "public",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PositionId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ShiftPlanId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||||
|
CreatedBy = table.Column<string>(type: "text", nullable: false),
|
||||||
|
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||||
|
ModifiedBy = table.Column<string>(type: "text", nullable: false),
|
||||||
|
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||||
|
RemovedBy = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PositionUsers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PositionUsers_Positions_PositionId",
|
||||||
|
column: x => x.PositionId,
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Positions",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PositionUsers_ShiftPlans_ShiftPlanId",
|
||||||
|
column: x => x.ShiftPlanId,
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "ShiftPlans",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PositionUsers_Users_ApplicationUserId",
|
||||||
|
column: x => x.ApplicationUserId,
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PositionUsers_ApplicationUserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "PositionUsers",
|
||||||
|
column: "ApplicationUserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PositionUsers_PositionId",
|
||||||
|
schema: "public",
|
||||||
|
table: "PositionUsers",
|
||||||
|
column: "PositionId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PositionUsers_ShiftPlanId",
|
||||||
|
schema: "public",
|
||||||
|
table: "PositionUsers",
|
||||||
|
column: "ShiftPlanId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ShiftPlanUsers_Users_ApplicationUserId",
|
||||||
|
schema: "public",
|
||||||
|
table: "ShiftPlanUsers",
|
||||||
|
column: "ApplicationUserId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -213,56 +213,6 @@ namespace Brizco.Repository.Migrations
|
||||||
b.ToTable("Positions", "public");
|
b.ToTable("Positions", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.PositionUser", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("ApplicationUserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("CreatedBy")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("IsRemoved")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("ModifiedBy")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("PositionId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("RemovedAt")
|
|
||||||
.HasColumnType("timestamp without time zone");
|
|
||||||
|
|
||||||
b.Property<string>("RemovedBy")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("ShiftPlanId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ApplicationUserId");
|
|
||||||
|
|
||||||
b.HasIndex("PositionId");
|
|
||||||
|
|
||||||
b.HasIndex("ShiftPlanId");
|
|
||||||
|
|
||||||
b.ToTable("PositionUsers", "public");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
@ -479,7 +429,7 @@ namespace Brizco.Repository.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("PlanDate")
|
b.Property<DateTime>("PlanFor")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<DateTime>("RemovedAt")
|
b.Property<DateTime>("RemovedAt")
|
||||||
|
@ -489,11 +439,16 @@ namespace Brizco.Repository.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoutineId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<Guid>("ShiftId")
|
b.Property<Guid>("ShiftId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoutineId");
|
||||||
|
|
||||||
b.HasIndex("ShiftId");
|
b.HasIndex("ShiftId");
|
||||||
|
|
||||||
b.ToTable("ShiftPlans", "public");
|
b.ToTable("ShiftPlans", "public");
|
||||||
|
@ -505,9 +460,6 @@ namespace Brizco.Repository.Migrations
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<Guid>("ApplicationUserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
@ -525,6 +477,9 @@ namespace Brizco.Repository.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("PositionId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<DateTime>("RemovedAt")
|
b.Property<DateTime>("RemovedAt")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
@ -535,12 +490,17 @@ namespace Brizco.Repository.Migrations
|
||||||
b.Property<Guid>("ShiftPlanId")
|
b.Property<Guid>("ShiftPlanId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("ApplicationUserId");
|
b.HasIndex("PositionId");
|
||||||
|
|
||||||
b.HasIndex("ShiftPlanId");
|
b.HasIndex("ShiftPlanId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("ShiftPlanUsers", "public");
|
b.ToTable("ShiftPlanUsers", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1162,33 +1122,6 @@ namespace Brizco.Repository.Migrations
|
||||||
b.Navigation("Section");
|
b.Navigation("Section");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.PositionUser", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ApplicationUserId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
|
||||||
.WithMany("Users")
|
|
||||||
.HasForeignKey("PositionId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ShiftPlanId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("ApplicationUser");
|
|
||||||
|
|
||||||
b.Navigation("Position");
|
|
||||||
|
|
||||||
b.Navigation("ShiftPlan");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||||
|
@ -1235,20 +1168,28 @@ namespace Brizco.Repository.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoutineId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||||
.WithMany("Plans")
|
.WithMany("Plans")
|
||||||
.HasForeignKey("ShiftId")
|
.HasForeignKey("ShiftId")
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Routine");
|
||||||
|
|
||||||
b.Navigation("Shift");
|
b.Navigation("Shift");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser")
|
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ApplicationUserId")
|
.HasForeignKey("PositionId")
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
@ -1258,9 +1199,17 @@ namespace Brizco.Repository.Migrations
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("ApplicationUser");
|
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Position");
|
||||||
|
|
||||||
b.Navigation("ShiftPlan");
|
b.Navigation("ShiftPlan");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b =>
|
||||||
|
@ -1306,7 +1255,7 @@ namespace Brizco.Repository.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Role")
|
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("PositionId")
|
.HasForeignKey("PositionId")
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
@ -1318,7 +1267,7 @@ namespace Brizco.Repository.Migrations
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("Role");
|
b.Navigation("Position");
|
||||||
|
|
||||||
b.Navigation("Task");
|
b.Navigation("Task");
|
||||||
});
|
});
|
||||||
|
@ -1448,11 +1397,6 @@ namespace Brizco.Repository.Migrations
|
||||||
b.Navigation("Roles");
|
b.Navigation("Roles");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Positions");
|
b.Navigation("Positions");
|
||||||
|
|
Loading…
Reference in New Issue