feat : complete cqrs , change db
change db and identityt , complete cqrs , add complex controllerrelease/production
parent
24c4a23079
commit
034b5270bb
|
@ -89,6 +89,7 @@
|
|||
<Using Include="System.Text" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\" />
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
namespace Brizco.Api.Controllers;
|
||||
|
||||
public class ComplexController : ICarterModule
|
||||
{
|
||||
|
||||
public virtual void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("Complex").MapGroup($"api/complex");
|
||||
|
||||
group.MapGet("{page}", GetAllAsync)
|
||||
.WithDisplayName("GetAllComplex")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetOneComplex")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("", Put)
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("", Delete)
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
// GET:Get All Entity
|
||||
public async Task<IResult> GetAllAsync(int page,ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetComplexesQuery(page), cancellationToken));
|
||||
|
||||
// GET:Get An Entity By Id
|
||||
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetComplexQuery(id)));
|
||||
|
||||
// POST:Create Entity
|
||||
public async Task<IResult> Post([FromBody] CreateComplexCommand ent, ISender mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(ent, cancellationToken));
|
||||
|
||||
// PUT:Update Entity
|
||||
public async Task<IResult> Put([FromBody] UpdateComplexCommand ent, ISender mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(ent, cancellationToken));
|
||||
|
||||
// DELETE:Delete Entity
|
||||
public async Task<IResult> Delete(Guid id, ISender mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new DeleteComplexCommand(id), cancellationToken));
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@ public class ShiftController : ICarterModule
|
|||
{
|
||||
var group = app.NewVersionedApi("Shift").MapGroup($"api/shift");
|
||||
|
||||
group.MapGet("", GetAllAsync)
|
||||
group.MapGet("{page}", GetAllAsync)
|
||||
.WithDisplayName("GetAllShift")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
@ -24,11 +24,16 @@ public class ShiftController : ICarterModule
|
|||
|
||||
group.MapDelete("", Delete)
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
||||
group.MapPost("/plan", Post)
|
||||
.WithDisplayName("AddNewPlan")
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
// GET:Get All Entity
|
||||
public async Task<IResult> GetAllAsync(ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetShiftsQuery(), cancellationToken));
|
||||
public async Task<IResult> GetAllAsync(int page,ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetShiftsQuery(page), cancellationToken));
|
||||
|
||||
// GET:Get An Entity By Id
|
||||
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||
|
|
|
@ -9,7 +9,7 @@ public class TaskController : ICarterModule
|
|||
{
|
||||
var group = app.NewVersionedApi("Task").MapGroup($"api/task");
|
||||
|
||||
group.MapGet("", GetAllAsync)
|
||||
group.MapGet("{page}", GetAllAsync)
|
||||
.WithDisplayName("GetAllTask")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
@ -28,8 +28,8 @@ public class TaskController : ICarterModule
|
|||
}
|
||||
|
||||
// GET:Get All Entity
|
||||
public async Task<IResult> GetAllAsync(ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetTasksQuery(), cancellationToken));
|
||||
public async Task<IResult> GetAllAsync(int page,ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetTasksQuery(page), cancellationToken));
|
||||
|
||||
// GET:Get An Entity By Id
|
||||
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using Brizco.Repository.Abstracts;
|
||||
|
||||
namespace Brizco.Api.Services;
|
||||
|
||||
public class CurrentUserService : ICurrentUserService
|
||||
{
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public CurrentUserService(IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
public string? UserId => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
public string? RoleName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Role);
|
||||
public string? UserName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Name);
|
||||
public string? ComplexId => _httpContextAccessor.HttpContext?.User?.FindFirstValue("ComplexId");
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace Brizco.Repository.Abstracts;
|
||||
|
||||
public interface ICurrentUserService : IScopedDependency
|
||||
{
|
||||
string? UserId { get; }
|
||||
string? RoleName { get; }
|
||||
string? ComplexId { get; }
|
||||
string? UserName { get; }
|
||||
}
|
|
@ -44,7 +44,9 @@
|
|||
<Using Include="Brizco.Common.Models.Exception" />
|
||||
<Using Include="Brizco.Domain.CommandQueries.Commands" />
|
||||
<Using Include="Brizco.Domain.CommandQueries.Queries" />
|
||||
<Using Include="Brizco.Domain.Dtos.LargDtos" />
|
||||
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="Brizco.Repository.Abstracts" />
|
||||
<Using Include="MediatR" />
|
||||
<Using Include="Brizco.Common.Extensions" />
|
||||
<Using Include="Brizco.Common.Models" />
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
using Brizco.Domain.Dtos.LargDtos;
|
||||
|
||||
namespace Brizco.Repository.Handlers.Activity;
|
||||
namespace Brizco.Repository.Handlers.Activity;
|
||||
|
||||
public class CreateActivityCommandHandler : IRequestHandler<CreateActivityCommand, ActivityLDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
public CreateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public CreateActivityCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<ActivityLDto> Handle(CreateActivityCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var task = Domain.Entities.Task.Activity
|
||||
.Create(
|
||||
request.Status,
|
||||
|
@ -27,7 +33,8 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateActivityComman
|
|||
request.SetFor,
|
||||
request.HasDisposed,
|
||||
request.Amount,
|
||||
request.AmountType);
|
||||
request.AmountType,
|
||||
complexId);
|
||||
|
||||
if (task.IsRelatedToPerson)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DeleteActivityCommandHandler : IRequestHandler<DeleteActivityComman
|
|||
{
|
||||
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.Id == request.id, cancellationToken);
|
||||
.FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken);
|
||||
if (task == null)
|
||||
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(UpdateActivityCommand request, CancellationToken cancellationToken)
|
||||
|
@ -15,6 +17,10 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityComman
|
|||
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id,cancellationToken);
|
||||
if (task == null)
|
||||
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId,out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newTask = Domain.Entities.Task.Activity.Create(
|
||||
request.Status,
|
||||
|
@ -30,7 +36,8 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityComman
|
|||
request.SetFor,
|
||||
request.HasDisposed,
|
||||
request.Amount,
|
||||
request.AmountType);
|
||||
request.AmountType,
|
||||
complexId);
|
||||
|
||||
newTask.Id = request.Id;
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
namespace Brizco.Repository.Handlers.Complex;
|
||||
|
||||
public class CreateComplexCommandHandler : IRequestHandler<CreateComplexCommand, ComplexSDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public CreateComplexCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<ComplexSDto> Handle(CreateComplexCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var complex = Domain.Entities.Complex.Complex.Create(request.Name, request.Address, request.SupportPhone);
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Complex>().Add(complex);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return complex.AdaptToSDto();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
namespace Brizco.Repository.Handlers.Complex;
|
||||
|
||||
public class DeleteComplexCommandHandler : IRequestHandler<DeleteComplexCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public DeleteComplexCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<bool> Handle(DeleteComplexCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Complex>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken);
|
||||
if (task == null)
|
||||
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Complex>()
|
||||
.Delete(task);
|
||||
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
namespace Brizco.Repository.Handlers.Complex;
|
||||
|
||||
public class GetComplexQueryHandler : IRequestHandler<GetComplexQuery, ComplexSDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetComplexQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
||||
public async Task<ComplexSDto> Handle(GetComplexQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var complex = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Complex>()
|
||||
.TableNoTracking
|
||||
.Where(s => s.Id == request.Id)
|
||||
.Select(ComplexMapper.ProjectToLDto)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
if (complex == null)
|
||||
throw new AppException("Complex not found", ApiResultStatusCode.NotFound);
|
||||
return complex;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
namespace Brizco.Repository.Handlers.Complex;
|
||||
|
||||
public class GetComplexesQueryHandler : IRequestHandler<GetComplexesQuery, List<ComplexSDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetComplexesQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<List<ActivitySDto>> Handle(GetComplexesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var tasks = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Complex>().TableNoTracking
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Skip(request.Page * 15).Take(15)
|
||||
.Select(ComplexMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return tasks;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
namespace Brizco.Repository.Handlers.Complex;
|
||||
|
||||
public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(UpdateActivityCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
|
||||
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id,cancellationToken);
|
||||
if (task == null)
|
||||
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId,out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newTask = Domain.Entities.Task.Activity.Create(
|
||||
request.Status,
|
||||
request.DoneAt,
|
||||
request.PerformanceDescription,
|
||||
request.Title,
|
||||
request.Description,
|
||||
request.Type,
|
||||
request.IsRelatedToShift,
|
||||
request.IsRelatedToRole,
|
||||
request.IsRelatedToPerson,
|
||||
request.IsDisposable,
|
||||
request.SetFor,
|
||||
request.HasDisposed,
|
||||
request.Amount,
|
||||
request.AmountType,
|
||||
complexId);
|
||||
|
||||
newTask.Id = request.Id;
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
|
||||
.Update(newTask);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -3,17 +3,27 @@
|
|||
public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Domain.Entities.Shift.Shift>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
public CreateShiftCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public CreateShiftCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<Domain.Entities.Shift.Shift> Handle(CreateShiftCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var shift = Domain.Entities.Shift.Shift
|
||||
.Create(request.Title,
|
||||
request.Description,
|
||||
request.StartAt,
|
||||
request.EndAt);
|
||||
request.EndAt,
|
||||
complexId);
|
||||
|
||||
request.DayOfWeeks.ForEach(d => shift.SetDay(d));
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
namespace Brizco.Repository.Handlers.Shift;
|
||||
|
||||
public class GetShiftQueryHandler : IRequestHandler<GetShiftQuery, ShiftSDto>
|
||||
public class GetShiftPlanQueryHandler : IRequestHandler<GetShiftQuery, ShiftSDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetShiftQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
public GetShiftPlanQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
namespace Brizco.Repository.Handlers.Shift;
|
||||
|
||||
public class GetShiftsQueryHandler : IRequestHandler<GetShiftsQuery, List<ShiftSDto>>
|
||||
public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<ShiftSDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetShiftsQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
public GetShiftPlansQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public UpdateShiftCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
public UpdateShiftCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(UpdateShiftCommand request, CancellationToken cancellationToken)
|
||||
|
@ -16,7 +18,16 @@ public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, boo
|
|||
if (shift == null)
|
||||
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newShift = Domain.Entities.Shift.Shift.Create(request.Title, request.Description, request.StartAt, request.EndAt);
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newShift = Domain.Entities.Shift.Shift.Create(request.Title,
|
||||
request.Description,
|
||||
request.StartAt,
|
||||
request.EndAt,
|
||||
complexId);
|
||||
newShift.Id = request.id;
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
|
||||
.Update(newShift);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
namespace Brizco.Repository.Handlers.ShiftPlan;
|
||||
|
||||
public class CreateShiftPlanCommandHandler : IRequestHandler<CreateShiftPlanCommand, ShiftPlanLDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
public CreateShiftPlanCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<ShiftPlanLDto> Handle(CreateShiftPlanCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.Id == request.ShiftId, cancellationToken);
|
||||
|
||||
if (shift == null)
|
||||
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var shiftPlan = shift.AddPlan(request.StartAt, request.EndAt);
|
||||
|
||||
if (request.UserIds.Count == 0)
|
||||
throw new AppException("شیفت بندی مورد نظر باید حداقل متشکل از یک فرد باشد", ApiResultStatusCode.BadRequest);
|
||||
|
||||
request.UserIds.ForEach(i=>shiftPlan.AddUser(i));
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>().Add(shiftPlan);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return shiftPlan.AdaptToLDto();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
namespace Brizco.Repository.Handlers.ShiftPlan;
|
||||
|
||||
public class DeleteShiftPlanCommandHandler : IRequestHandler<DeleteShiftPlanCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public DeleteShiftPlanCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(DeleteShiftPlanCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var shiftPlan = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id);
|
||||
|
||||
if (shiftPlan == null)
|
||||
throw new AppException("ShiftPlan not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.Delete(shiftPlan);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
namespace Brizco.Repository.Handlers.ShiftPlan;
|
||||
|
||||
public class GetShiftPlanQueryHandler : IRequestHandler<GetShiftPlanQuery, ShiftPlanLDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetShiftPlanQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<ShiftPlanLDto> Handle(GetShiftPlanQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var shiftPlan = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.Where(s => s.Id == request.Id)
|
||||
.Select(ShiftPlanMapper.ProjectToLDto)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
if (shiftPlan == null)
|
||||
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
|
||||
return shiftPlan;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
namespace Brizco.Repository.Handlers.ShiftPlan;
|
||||
|
||||
public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftPlansQuery, List<ShiftPlanSDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public GetShiftPlansQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
public async Task<List<ShiftPlanSDto>> Handle(GetShiftPlansQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var shifts = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>().TableNoTracking
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Skip(request.Page * 15).Take(15)
|
||||
.Select(ShiftPlanMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return shifts;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
namespace Brizco.Repository.Handlers.ShiftPlan;
|
||||
|
||||
public class UpdateShiftPlanCommandHandler : IRequestHandler<UpdateShiftPlanCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public UpdateShiftPlanCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(UpdateShiftPlanCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var shiftPlan = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id,cancellationToken);
|
||||
|
||||
if (shiftPlan == null)
|
||||
throw new AppException("ShiftPlan not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
|
||||
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.ShiftId, cancellationToken);
|
||||
|
||||
if (shift == null)
|
||||
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
|
||||
var newPlan = shift.AddPlan(request.StartAt, request.EndAt);
|
||||
newPlan.Id = request.Id;
|
||||
|
||||
|
||||
var shiftPlanUsers = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
.Where(s => s.ShiftPlanId == newPlan.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var shiftPlanUser in shiftPlanUsers)
|
||||
{
|
||||
if (request.UserIds.Contains(shiftPlanUser.Id))
|
||||
request.UserIds.Remove(shiftPlanUser.Id);
|
||||
else
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlanUser>()
|
||||
.Delete(shiftPlanUser);
|
||||
}
|
||||
|
||||
foreach (var userId in request.UserIds)
|
||||
newPlan.AddUser(userId);
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.Update(newPlan);
|
||||
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,21 @@
|
|||
using Brizco.Domain.Dtos.LargDtos;
|
||||
|
||||
namespace Brizco.Repository.Handlers.Task;
|
||||
namespace Brizco.Repository.Handlers.Task;
|
||||
|
||||
public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, TaskLDto>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
public CreateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public CreateActivityCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<TaskLDto> Handle(CreateTaskCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
var task = Domain.Entities.Task.Task
|
||||
.Create(request.Title,
|
||||
request.Description,
|
||||
|
@ -22,7 +27,8 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, T
|
|||
request.SetFor,
|
||||
request.HasDisposed,
|
||||
request.Amount,
|
||||
request.AmountType);
|
||||
request.AmountType,
|
||||
complexId);
|
||||
|
||||
if (task.IsRelatedToPerson)
|
||||
{
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, bool>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(UpdateTaskCommand request, CancellationToken cancellationToken)
|
||||
|
@ -16,6 +18,11 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, b
|
|||
if (task == null)
|
||||
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var newTask = Domain.Entities.Task.Task.Create(request.Title,
|
||||
request.Description,
|
||||
request.Type,
|
||||
|
@ -26,7 +33,8 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, b
|
|||
request.SetFor,
|
||||
request.HasDisposed,
|
||||
request.Amount,
|
||||
request.AmountType);
|
||||
request.AmountType,
|
||||
complexId);
|
||||
newTask.Id = request.id;
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
|
||||
|
|
|
@ -1,871 +0,0 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Brizco.Repository.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20230912124533_init")]
|
||||
partial class init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ApplicationRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("BirthDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
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<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SupportPhone")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Complexes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ComplexUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ComplexId")
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ComplexUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("EndAt")
|
||||
.HasColumnType("interval");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("StartAt")
|
||||
.HasColumnType("interval");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shifts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftDay", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftDays");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlan", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("EndAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("StartAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftPlans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Amount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("AmountType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("HasDisposed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsDisposable")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRelatedToPerson")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRelatedToRole")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRelatedToShift")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("SetFor")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Tasks");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Task");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskShift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskShifts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TaskUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Activity", b =>
|
||||
{
|
||||
b.HasBaseType("Brizco.Domain.Entities.Task");
|
||||
|
||||
b.Property<DateTime>("DoneAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("PerformanceDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasDiscriminator().HasValue("Activity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.SubTask", b =>
|
||||
{
|
||||
b.HasBaseType("Brizco.Domain.Entities.Task");
|
||||
|
||||
b.HasDiscriminator().HasValue("SubTask");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ComplexUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex", "Complex")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Complex");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlan", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationRole", "Role")
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task", "Task")
|
||||
.WithMany("TaskRoles")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
|
||||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskShift", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task", "Task")
|
||||
.WithMany("TaskShifts")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shift");
|
||||
|
||||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Task", "Task")
|
||||
.WithMany("TaskUsers")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Task");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task", b =>
|
||||
{
|
||||
b.Navigation("TaskRoles");
|
||||
|
||||
b.Navigation("TaskShifts");
|
||||
|
||||
b.Navigation("TaskUsers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,935 +0,0 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Brizco.Repository.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20230912132807_addShiftPlanUser")]
|
||||
partial class addShiftPlanUser
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ApplicationRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("BirthDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
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<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SupportPhone")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Complexes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ComplexUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ComplexId")
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ComplexUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("EndAt")
|
||||
.HasColumnType("interval");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("StartAt")
|
||||
.HasColumnType("interval");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shifts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftDay", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftDays");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlan", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("EndAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("StartAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftPlans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlanUser", 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<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("ShiftPlanId");
|
||||
|
||||
b.ToTable("ShiftPlanUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Amount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("AmountType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("HasDisposed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsDisposable")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRelatedToPerson")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRelatedToRole")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRelatedToShift")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("SetFor")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Tasks");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Task");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskShift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskShifts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.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<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TaskUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Activity", b =>
|
||||
{
|
||||
b.HasBaseType("Brizco.Domain.Entities.Task");
|
||||
|
||||
b.Property<DateTime>("DoneAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("PerformanceDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasDiscriminator().HasValue("Activity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.SubTask", b =>
|
||||
{
|
||||
b.HasBaseType("Brizco.Domain.Entities.Task");
|
||||
|
||||
b.HasDiscriminator().HasValue("SubTask");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ComplexUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex", "Complex")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Complex");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlan", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlanUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ShiftPlan", "ShiftPlan")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftPlanId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ApplicationUser");
|
||||
|
||||
b.Navigation("ShiftPlan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationRole", "Role")
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task", "Task")
|
||||
.WithMany("TaskRoles")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
|
||||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskShift", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task", "Task")
|
||||
.WithMany("TaskShifts")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shift");
|
||||
|
||||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.TaskUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Task", "Task")
|
||||
.WithMany("TaskUsers")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Task");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task", b =>
|
||||
{
|
||||
b.Navigation("TaskRoles");
|
||||
|
||||
b.Navigation("TaskShifts");
|
||||
|
||||
b.Navigation("TaskUsers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addShiftPlanUser : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShiftPlanUsers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ShiftPlanId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", 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),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: false),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShiftPlanUsers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShiftPlanUsers_AspNetUsers_ApplicationUserId",
|
||||
column: x => x.ApplicationUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShiftPlanUsers_ShiftPlans_ShiftPlanId",
|
||||
column: x => x.ShiftPlanId,
|
||||
principalTable: "ShiftPlans",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShiftPlanUsers_ApplicationUserId",
|
||||
table: "ShiftPlanUsers",
|
||||
column: "ApplicationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShiftPlanUsers_ShiftPlanId",
|
||||
table: "ShiftPlanUsers",
|
||||
column: "ShiftPlanId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShiftPlanUsers");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,208 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class editTask : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "Tasks",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Tasks",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsDone",
|
||||
table: "Tasks",
|
||||
type: "boolean",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "Shifts",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Shifts",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SupportPhone",
|
||||
table: "Complexes",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Complexes",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Address",
|
||||
table: "Complexes",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "LastName",
|
||||
table: "AspNetUsers",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "FirstName",
|
||||
table: "AspNetUsers",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "AspNetRoles",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsDone",
|
||||
table: "Tasks");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "Tasks",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Tasks",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "Shifts",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Shifts",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SupportPhone",
|
||||
table: "Complexes",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Complexes",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Address",
|
||||
table: "Complexes",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "LastName",
|
||||
table: "AspNetUsers",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "FirstName",
|
||||
table: "AspNetUsers",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "AspNetRoles",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,14 +12,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationContext))]
|
||||
[Migration("20230917141849_editTask")]
|
||||
partial class editTask
|
||||
[Migration("20230918112118_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("public")
|
||||
.HasAnnotation("ProductVersion", "7.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
|
@ -32,6 +33,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
|
@ -52,6 +54,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
|
@ -62,11 +65,12 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SupportPhone")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Complexes");
|
||||
b.ToTable("Complexes", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
|
@ -102,9 +106,6 @@ namespace Brizco.Repository.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
|
@ -114,7 +115,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ComplexUsers");
|
||||
b.ToTable("ComplexUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
|
@ -123,6 +124,9 @@ namespace Brizco.Repository.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ComplexId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
|
@ -131,6 +135,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("EndAt")
|
||||
|
@ -157,11 +162,14 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("interval");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shifts");
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.ToTable("Shifts", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
|
||||
|
@ -204,7 +212,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftDays");
|
||||
b.ToTable("ShiftDays", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
||||
|
@ -250,7 +258,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftPlans");
|
||||
b.ToTable("ShiftPlans", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
|
||||
|
@ -295,7 +303,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("ShiftPlanId");
|
||||
|
||||
b.ToTable("ShiftPlanUsers");
|
||||
b.ToTable("ShiftPlanUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
|
@ -310,6 +318,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Property<int>("AmountType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("ComplexId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
|
@ -318,6 +329,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
|
@ -360,6 +372,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
|
@ -367,7 +380,9 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Tasks");
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.ToTable("Tasks", "public");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Task");
|
||||
|
||||
|
@ -416,7 +431,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskRoles");
|
||||
b.ToTable("TaskRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
|
||||
|
@ -461,7 +476,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskShifts");
|
||||
b.ToTable("TaskShifts", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
|
||||
|
@ -506,7 +521,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TaskUsers");
|
||||
b.ToTable("TaskUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
|
||||
|
@ -515,11 +530,15 @@ namespace Brizco.Repository.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ComplexId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -532,11 +551,13 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
b.ToTable("Roles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b =>
|
||||
|
@ -563,12 +584,14 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
|
@ -613,7 +636,7 @@ namespace Brizco.Repository.Migrations
|
|||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
b.ToTable("Users", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
|
@ -637,7 +660,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
b.ToTable("RoleClaims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
|
@ -661,7 +684,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
b.ToTable("Claims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
|
@ -682,7 +705,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
b.ToTable("Logins", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
|
@ -697,7 +720,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
b.ToTable("UserRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
|
@ -716,7 +739,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
b.ToTable("Tokens", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
|
||||
|
@ -730,6 +753,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("PerformanceDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
@ -741,7 +765,7 @@ namespace Brizco.Repository.Migrations
|
|||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany()
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
@ -757,6 +781,17 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Shifts")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||
|
@ -798,6 +833,17 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("ShiftPlan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Tasks")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role")
|
||||
|
@ -855,6 +901,15 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("ComplexId");
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
|
||||
|
@ -906,6 +961,17 @@ namespace Brizco.Repository.Migrations
|
|||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
|
||||
{
|
||||
b.Navigation("Roles");
|
||||
|
||||
b.Navigation("Shifts");
|
||||
|
||||
b.Navigation("Tasks");
|
||||
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
{
|
||||
b.Navigation("Days");
|
|
@ -7,28 +7,39 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class init : Migration
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "public");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoles",
|
||||
name: "Complexes",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Address = table.Column<string>(type: "text", nullable: false),
|
||||
SupportPhone = table.Column<string>(type: "text", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", 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),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: false),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
||||
table.PrimaryKey("PK_Complexes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUsers",
|
||||
name: "Users",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -53,32 +64,35 @@ namespace Brizco.Repository.Migrations
|
|||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Complexes",
|
||||
name: "Roles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Address = table.Column<string>(type: "text", nullable: false),
|
||||
SupportPhone = table.Column<string>(type: "text", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", 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),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: false),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: false)
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
ComplexId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Complexes", x => x.Id);
|
||||
table.PrimaryKey("PK_Roles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Roles_Complexes_ComplexId",
|
||||
column: x => x.ComplexId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Complexes",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shifts",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -86,6 +100,7 @@ namespace Brizco.Repository.Migrations
|
|||
StartAt = table.Column<TimeSpan>(type: "interval", nullable: false),
|
||||
EndAt = table.Column<TimeSpan>(type: "interval", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: false),
|
||||
|
@ -97,10 +112,18 @@ namespace Brizco.Repository.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shifts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Shifts_Complexes_ComplexId",
|
||||
column: x => x.ComplexId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Complexes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tasks",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -113,11 +136,13 @@ namespace Brizco.Repository.Migrations
|
|||
IsDisposable = table.Column<bool>(type: "boolean", nullable: false),
|
||||
SetFor = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
HasDisposed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Amount = table.Column<int>(type: "integer", nullable: false),
|
||||
AmountType = table.Column<int>(type: "integer", nullable: false),
|
||||
Discriminator = table.Column<string>(type: "text", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: true),
|
||||
DoneAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
|
||||
IsDone = table.Column<bool>(type: "boolean", nullable: true),
|
||||
PerformanceDescription = table.Column<string>(type: "text", nullable: true),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
|
@ -130,31 +155,18 @@ namespace Brizco.Repository.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tasks", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
name: "FK_Tasks_Complexes_ComplexId",
|
||||
column: x => x.ComplexId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Complexes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserClaims",
|
||||
name: "Claims",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
|
@ -165,87 +177,24 @@ namespace Brizco.Repository.Migrations
|
|||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
table.PrimaryKey("PK_Claims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
||||
name: "FK_Claims_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserLogins",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderKey = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserRoles",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetUserTokens",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ComplexUsers",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: false),
|
||||
|
@ -258,21 +207,118 @@ namespace Brizco.Repository.Migrations
|
|||
{
|
||||
table.PrimaryKey("PK_ComplexUsers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ComplexUsers_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
name: "FK_ComplexUsers_Complexes_ComplexId",
|
||||
column: x => x.ComplexId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Complexes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ComplexUsers_Complexes_ComplexId",
|
||||
column: x => x.ComplexId,
|
||||
principalTable: "Complexes",
|
||||
name: "FK_ComplexUsers_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Logins",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderKey = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Logins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
table.ForeignKey(
|
||||
name: "FK_Logins_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tokens",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_Tokens_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RoleClaims",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RoleClaims_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserRoles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserRoles_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserRoles_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShiftDays",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -292,6 +338,7 @@ namespace Brizco.Repository.Migrations
|
|||
table.ForeignKey(
|
||||
name: "FK_ShiftDays_Shifts_ShiftId",
|
||||
column: x => x.ShiftId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Shifts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
@ -299,6 +346,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShiftPlans",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -319,6 +367,7 @@ namespace Brizco.Repository.Migrations
|
|||
table.ForeignKey(
|
||||
name: "FK_ShiftPlans_Shifts_ShiftId",
|
||||
column: x => x.ShiftId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Shifts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
@ -326,6 +375,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TaskRoles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -343,14 +393,16 @@ namespace Brizco.Repository.Migrations
|
|||
{
|
||||
table.PrimaryKey("PK_TaskRoles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskRoles_AspNetRoles_RoleId",
|
||||
name: "FK_TaskRoles_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskRoles_Tasks_TaskId",
|
||||
column: x => x.TaskId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Tasks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
@ -358,6 +410,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TaskShifts",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -377,12 +430,14 @@ namespace Brizco.Repository.Migrations
|
|||
table.ForeignKey(
|
||||
name: "FK_TaskShifts_Shifts_ShiftId",
|
||||
column: x => x.ShiftId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Shifts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskShifts_Tasks_TaskId",
|
||||
column: x => x.TaskId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Tasks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
@ -390,6 +445,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TaskUsers",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
|
@ -407,157 +463,261 @@ namespace Brizco.Repository.Migrations
|
|||
{
|
||||
table.PrimaryKey("PK_TaskUsers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskUsers_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
name: "FK_TaskUsers_Tasks_TaskId",
|
||||
column: x => x.TaskId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Tasks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskUsers_Tasks_TaskId",
|
||||
column: x => x.TaskId,
|
||||
principalTable: "Tasks",
|
||||
name: "FK_TaskUsers_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShiftPlanUsers",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ShiftPlanId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", 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),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: false),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShiftPlanUsers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShiftPlanUsers_ShiftPlans_ShiftPlanId",
|
||||
column: x => x.ShiftPlanId,
|
||||
principalSchema: "public",
|
||||
principalTable: "ShiftPlans",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShiftPlanUsers_Users_ApplicationUserId",
|
||||
column: x => x.ApplicationUserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetRoleClaims_RoleId",
|
||||
table: "AspNetRoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "RoleNameIndex",
|
||||
table: "AspNetRoles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserClaims_UserId",
|
||||
table: "AspNetUserClaims",
|
||||
name: "IX_Claims_UserId",
|
||||
schema: "public",
|
||||
table: "Claims",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserLogins_UserId",
|
||||
table: "AspNetUserLogins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUserRoles_RoleId",
|
||||
table: "AspNetUserRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "EmailIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ComplexUsers_ComplexId",
|
||||
schema: "public",
|
||||
table: "ComplexUsers",
|
||||
column: "ComplexId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ComplexUsers_UserId",
|
||||
schema: "public",
|
||||
table: "ComplexUsers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Logins_UserId",
|
||||
schema: "public",
|
||||
table: "Logins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RoleClaims_RoleId",
|
||||
schema: "public",
|
||||
table: "RoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Roles_ComplexId",
|
||||
schema: "public",
|
||||
table: "Roles",
|
||||
column: "ComplexId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "RoleNameIndex",
|
||||
schema: "public",
|
||||
table: "Roles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShiftDays_ShiftId",
|
||||
schema: "public",
|
||||
table: "ShiftDays",
|
||||
column: "ShiftId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShiftPlans_ShiftId",
|
||||
schema: "public",
|
||||
table: "ShiftPlans",
|
||||
column: "ShiftId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShiftPlanUsers_ApplicationUserId",
|
||||
schema: "public",
|
||||
table: "ShiftPlanUsers",
|
||||
column: "ApplicationUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShiftPlanUsers_ShiftPlanId",
|
||||
schema: "public",
|
||||
table: "ShiftPlanUsers",
|
||||
column: "ShiftPlanId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Shifts_ComplexId",
|
||||
schema: "public",
|
||||
table: "Shifts",
|
||||
column: "ComplexId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskRoles_RoleId",
|
||||
schema: "public",
|
||||
table: "TaskRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskRoles_TaskId",
|
||||
schema: "public",
|
||||
table: "TaskRoles",
|
||||
column: "TaskId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Tasks_ComplexId",
|
||||
schema: "public",
|
||||
table: "Tasks",
|
||||
column: "ComplexId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskShifts_ShiftId",
|
||||
schema: "public",
|
||||
table: "TaskShifts",
|
||||
column: "ShiftId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskShifts_TaskId",
|
||||
schema: "public",
|
||||
table: "TaskShifts",
|
||||
column: "TaskId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskUsers_TaskId",
|
||||
schema: "public",
|
||||
table: "TaskUsers",
|
||||
column: "TaskId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskUsers_UserId",
|
||||
schema: "public",
|
||||
table: "TaskUsers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserRoles_RoleId",
|
||||
schema: "public",
|
||||
table: "UserRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "EmailIndex",
|
||||
schema: "public",
|
||||
table: "Users",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
schema: "public",
|
||||
table: "Users",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoleClaims");
|
||||
name: "Claims",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserClaims");
|
||||
name: "ComplexUsers",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserLogins");
|
||||
name: "Logins",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserRoles");
|
||||
name: "RoleClaims",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserTokens");
|
||||
name: "ShiftDays",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ComplexUsers");
|
||||
name: "ShiftPlanUsers",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShiftDays");
|
||||
name: "TaskRoles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShiftPlans");
|
||||
name: "TaskShifts",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskRoles");
|
||||
name: "TaskUsers",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskShifts");
|
||||
name: "Tokens",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskUsers");
|
||||
name: "UserRoles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Complexes");
|
||||
name: "ShiftPlans",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoles");
|
||||
name: "Tasks",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shifts");
|
||||
name: "Roles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUsers");
|
||||
name: "Users",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tasks");
|
||||
name: "Shifts",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Complexes",
|
||||
schema: "public");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ namespace Brizco.Repository.Migrations
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("public")
|
||||
.HasAnnotation("ProductVersion", "7.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
|
@ -29,6 +30,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
|
@ -49,6 +51,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
|
@ -59,11 +62,12 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SupportPhone")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Complexes");
|
||||
b.ToTable("Complexes", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
|
@ -99,9 +103,6 @@ namespace Brizco.Repository.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
|
@ -111,7 +112,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ComplexUsers");
|
||||
b.ToTable("ComplexUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
|
@ -120,6 +121,9 @@ namespace Brizco.Repository.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ComplexId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
|
@ -128,6 +132,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("EndAt")
|
||||
|
@ -154,11 +159,14 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("interval");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shifts");
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.ToTable("Shifts", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
|
||||
|
@ -201,7 +209,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftDays");
|
||||
b.ToTable("ShiftDays", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
||||
|
@ -247,7 +255,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.ToTable("ShiftPlans");
|
||||
b.ToTable("ShiftPlans", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
|
||||
|
@ -292,7 +300,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("ShiftPlanId");
|
||||
|
||||
b.ToTable("ShiftPlanUsers");
|
||||
b.ToTable("ShiftPlanUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
|
@ -307,6 +315,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Property<int>("AmountType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("ComplexId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
|
@ -315,6 +326,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
|
@ -357,6 +369,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
|
@ -364,7 +377,9 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Tasks");
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.ToTable("Tasks", "public");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Task");
|
||||
|
||||
|
@ -413,7 +428,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskRoles");
|
||||
b.ToTable("TaskRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
|
||||
|
@ -458,7 +473,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskShifts");
|
||||
b.ToTable("TaskShifts", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
|
||||
|
@ -503,7 +518,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TaskUsers");
|
||||
b.ToTable("TaskUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
|
||||
|
@ -512,11 +527,15 @@ namespace Brizco.Repository.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ComplexId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -529,11 +548,13 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
b.ToTable("Roles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b =>
|
||||
|
@ -560,12 +581,14 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
|
@ -610,7 +633,7 @@ namespace Brizco.Repository.Migrations
|
|||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
b.ToTable("Users", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
|
@ -634,7 +657,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
b.ToTable("RoleClaims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
|
@ -658,7 +681,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
b.ToTable("Claims", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
|
@ -679,7 +702,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
b.ToTable("Logins", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
|
@ -694,7 +717,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
b.ToTable("UserRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
|
@ -713,7 +736,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
b.ToTable("Tokens", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
|
||||
|
@ -727,6 +750,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("PerformanceDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
@ -738,7 +762,7 @@ namespace Brizco.Repository.Migrations
|
|||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany()
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
@ -754,6 +778,17 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Shifts")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||
|
@ -795,6 +830,17 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("ShiftPlan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Tasks")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role")
|
||||
|
@ -852,6 +898,15 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("ComplexId");
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
|
||||
|
@ -903,6 +958,17 @@ namespace Brizco.Repository.Migrations
|
|||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
|
||||
{
|
||||
b.Navigation("Roles");
|
||||
|
||||
b.Navigation("Shifts");
|
||||
|
||||
b.Navigation("Tasks");
|
||||
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
{
|
||||
b.Navigation("Days");
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using Brizco.Domain.Entities.User;
|
||||
using Brizco.Repository.Extensions;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Brizco.Repository.Models;
|
||||
|
||||
|
@ -26,9 +28,24 @@ public class ApplicationContext : IdentityDbContext<ApplicationUser,ApplicationR
|
|||
_logger.LogInformation($"!!!!!!! RegisterAllEntities : {stopwatch.ElapsedMilliseconds}ms !!!!!!!");
|
||||
|
||||
|
||||
RenameIdentityTables(builder);
|
||||
builder.RegisterEntityTypeConfiguration(entitiesAssembly);
|
||||
builder.AddPluralizingTableNameConvention();
|
||||
builder.AddRestrictDeleteBehaviorConvention();
|
||||
//builder.AddSequentialGuidForIdConvention();
|
||||
}
|
||||
|
||||
protected void RenameIdentityTables(ModelBuilder builder)
|
||||
{
|
||||
builder.HasDefaultSchema("public");
|
||||
|
||||
builder.Entity<ApplicationUser>().ToTable("Users");
|
||||
builder.Entity<ApplicationRole>().ToTable("Roles");
|
||||
builder.Entity<IdentityRoleClaim<Guid>>().ToTable("RoleClaims");
|
||||
builder.Entity<IdentityUserRole<Guid>>().ToTable("UserRoles");
|
||||
builder.Entity<IdentityUserClaim<Guid>>().ToTable("Claims");
|
||||
builder.Entity<IdentityUserLogin<Guid>>().ToTable("Logins");
|
||||
builder.Entity<IdentityUserToken<Guid>>().ToTable("Tokens");
|
||||
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
@ -28,6 +29,7 @@
|
|||
<PackageReference Include="Mapster.Core" Version="1.2.0" />
|
||||
<PackageReference Include="MediatR" Version="12.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -39,5 +39,5 @@ public sealed record UpdateActivityCommand(Guid Id,
|
|||
List<Guid> Roles) : IRequest<bool>;
|
||||
|
||||
|
||||
public sealed record DeleteActivityCommand(Guid id)
|
||||
public sealed record DeleteActivityCommand(Guid Id)
|
||||
: IRequest<bool>;
|
|
@ -0,0 +1,13 @@
|
|||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.CommandQueries.Commands;
|
||||
|
||||
public sealed record CreateComplexCommand(string Name, string Address, string SupportPhone)
|
||||
: IRequest<ComplexSDto>;
|
||||
|
||||
public sealed record UpdateComplexCommand(Guid Id, string Name, string Address, string SupportPhone)
|
||||
: IRequest<bool>;
|
||||
|
||||
|
||||
public sealed record DeleteComplexCommand(Guid Id)
|
||||
: IRequest<bool>;
|
|
@ -5,8 +5,8 @@ namespace Brizco.Domain.CommandQueries.Commands;
|
|||
public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description , List<DayOfWeek> DayOfWeeks)
|
||||
: IRequest<Shift>;
|
||||
|
||||
public sealed record UpdateShiftCommand(Guid id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks)
|
||||
public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks)
|
||||
: IRequest<bool>;
|
||||
|
||||
public sealed record DeleteShiftCommand(Guid id)
|
||||
public sealed record DeleteShiftCommand(Guid Id)
|
||||
: IRequest<bool>;
|
|
@ -0,0 +1,10 @@
|
|||
namespace Brizco.Domain.CommandQueries.Commands;
|
||||
|
||||
public record CreateShiftPlanCommand(DateTime StartAt, DateTime EndAt,Guid ShiftId,List<Guid> UserIds)
|
||||
:IRequest<ShiftPlanLDto>;
|
||||
|
||||
public record UpdateShiftPlanCommand(Guid Id,DateTime StartAt, DateTime EndAt, Guid ShiftId, List<Guid> UserIds)
|
||||
: IRequest<bool>;
|
||||
|
||||
public record DeleteShiftPlanCommand(Guid Id, DateTime StartAt, DateTime EndAt, Guid ShiftId, List<Guid> UserIds)
|
||||
: IRequest<bool>;
|
|
@ -17,7 +17,7 @@ List<Guid> Users,
|
|||
List<Guid> Shifts,
|
||||
List<Guid> Roles) : IRequest<TaskLDto>;
|
||||
|
||||
public sealed record UpdateTaskCommand(Guid id,
|
||||
public sealed record UpdateTaskCommand(Guid Id,
|
||||
TaskType Type,
|
||||
string Title,
|
||||
string Description,
|
||||
|
@ -34,5 +34,5 @@ public sealed record UpdateTaskCommand(Guid id,
|
|||
List<Guid> Roles) : IRequest<bool>;
|
||||
|
||||
|
||||
public sealed record DeleteTaskCommand(Guid id)
|
||||
public sealed record DeleteTaskCommand(Guid Id)
|
||||
: IRequest<bool>;
|
|
@ -1,7 +1,7 @@
|
|||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public sealed record GetActivitiesQuery(int page = 0) :
|
||||
public sealed record GetActivitiesQuery(int Page = 0) :
|
||||
IRequest<List<ActivitySDto>>;
|
||||
|
||||
public sealed record GetActivityQuery(Guid id) :
|
||||
public sealed record GetActivityQuery(Guid Id) :
|
||||
IRequest<ActivityLDto>;
|
|
@ -0,0 +1,7 @@
|
|||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public sealed record GetComplexesQuery(int Page = 0) :
|
||||
IRequest<List<ComplexSDto>>;
|
||||
|
||||
public sealed record GetComplexQuery(Guid Id) :
|
||||
IRequest<ComplexSDto>;
|
|
@ -0,0 +1,7 @@
|
|||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public sealed record GetShiftPlansQuery(int Page = 0) :
|
||||
IRequest<List<ShiftPlanSDto>>;
|
||||
|
||||
public sealed record GetShiftPlanQuery(Guid Id) :
|
||||
IRequest<ShiftPlanLDto>;
|
|
@ -1,7 +1,7 @@
|
|||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public sealed record GetTasksQuery(int page = 0) :
|
||||
public sealed record GetTasksQuery(int Page = 0) :
|
||||
IRequest<List<TaskSDto>>;
|
||||
|
||||
public sealed record GetTaskQuery(Guid id) :
|
||||
public sealed record GetTaskQuery(Guid Id) :
|
||||
IRequest<TaskLDto>;
|
|
@ -0,0 +1,11 @@
|
|||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.Dtos.LargDtos;
|
||||
|
||||
public class ShiftPlanLDto : BaseDto<ShiftPlanLDto , ShiftPlan>
|
||||
{
|
||||
public DateTime StartAt { get; set; }
|
||||
public DateTime EndAt { get; set; }
|
||||
public Guid ShiftId { get; set; }
|
||||
public List<ShiftPlanUserSDto> Users { get; internal set; } = new();
|
||||
}
|
|
@ -6,6 +6,4 @@ public class ComplexUserSDto : BaseDto<ComplexUserSDto,ComplexUser>
|
|||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid ComplexId { get; set; }
|
||||
|
||||
public Guid RoleId { get; set; }
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.Dtos.SmallDtos;
|
||||
|
||||
public class ShiftPlanSDto : BaseDto<ShiftPlanSDto,ShiftPlan>
|
||||
{
|
||||
public DateTime StartAt { get; set; }
|
||||
public DateTime EndAt { get; set; }
|
||||
public Guid ShiftId { get; set; }
|
||||
public string ShiftTitle { get; internal set; } = string.Empty;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.Dtos.SmallDtos;
|
||||
|
||||
public class ShiftPlanUserSDto : BaseDto<ShiftPlanUserSDto,ShiftPlanUser>
|
||||
{
|
||||
public Guid ShiftPlanId { get; set; }
|
||||
public Guid ApplicationUserId { get; set; }
|
||||
}
|
|
@ -8,4 +8,5 @@ public class ShiftSDto : BaseDto<ShiftSDto,Shift>
|
|||
public TimeSpan StartAt { get; set; }
|
||||
public TimeSpan EndAt { get; set; }
|
||||
public List<DayOfWeek> Days { get; set; } = new();
|
||||
public Guid ComplexId { get; set; }
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ public class TaskSDto : BaseDto<TaskSDto,Entities.Task.Task>
|
|||
public bool IsDisposable { get; set; }
|
||||
public DateTime SetFor { get; set; }
|
||||
public bool HasDisposed { get; set; }
|
||||
public Guid ComplexId { get; set; }
|
||||
|
||||
|
||||
public int Amount { get; set; }
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
namespace Brizco.Domain.Entities.Complex;
|
||||
|
||||
public partial class Complex
|
||||
{
|
||||
public static Complex Create(string name, string address, string supportPhone)
|
||||
{
|
||||
return new Complex(name,address,supportPhone);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,30 @@
|
|||
namespace Brizco.Domain.Entities.Complex;
|
||||
using Brizco.Domain.Entities.User;
|
||||
|
||||
namespace Brizco.Domain.Entities.Complex;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public class Complex : ApiEntity
|
||||
public partial class Complex : ApiEntity
|
||||
{
|
||||
public Complex()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Complex(string name , string address,string supportPhone)
|
||||
{
|
||||
Name = name;
|
||||
Address = address;
|
||||
SupportPhone = supportPhone;
|
||||
}
|
||||
public string Name { get; internal set; } = string.Empty;
|
||||
public string Address { get; internal set; } = string.Empty;
|
||||
public string SupportPhone { get; internal set; } = string.Empty;
|
||||
}
|
||||
|
||||
public List<ApplicationRole> Roles { get; set; } = new();
|
||||
public List<Task.Task> Tasks { get; set; } = new();
|
||||
public List<Shift.Shift> Shifts { get; set; } = new();
|
||||
public List<ComplexUser> Users { get; set; } = new();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ public class ComplexUser : ApiEntity
|
|||
{
|
||||
public Guid UserId { get; internal set; }
|
||||
public Guid ComplexId { get; internal set; }
|
||||
public Guid RoleId { get; internal set; }
|
||||
|
||||
public ApplicationUser? User { get; internal set; }
|
||||
public Complex? Complex { get; internal set; }
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
namespace Brizco.Domain.Entities.Shift;
|
||||
public partial class Shift
|
||||
{
|
||||
public static Shift Create(string title, string description, TimeSpan startAt, TimeSpan endAt)
|
||||
public static Shift Create(string title, string description, TimeSpan startAt, TimeSpan endAt,Guid complexId)
|
||||
{
|
||||
return new Shift(title, description, startAt, endAt);
|
||||
return new Shift(title, description, startAt, endAt,complexId);
|
||||
}
|
||||
|
||||
public ShiftDay SetDay(DayOfWeek dayOfWeek)
|
||||
|
@ -28,7 +28,7 @@ public partial class ShiftPlan
|
|||
public ShiftPlanUser AddUser(Guid userId)
|
||||
{
|
||||
var planUser = new ShiftPlanUser(Id , userId);
|
||||
ShiftPlanUsers.Add(planUser);
|
||||
Users.Add(planUser);
|
||||
return planUser;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Mapster;
|
||||
|
||||
namespace Brizco.Domain.Entities.Shift;
|
||||
namespace Brizco.Domain.Entities.Shift;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
@ -10,12 +6,13 @@ public partial class Shift : ApiEntity
|
|||
{
|
||||
public Shift() { }
|
||||
|
||||
internal Shift(string title, string description, TimeSpan startAt, TimeSpan endAt)
|
||||
internal Shift(string title, string description, TimeSpan startAt, TimeSpan endAt,Guid complexId)
|
||||
{
|
||||
Title = title;
|
||||
Description = description;
|
||||
StartAt = startAt;
|
||||
EndAt = endAt;
|
||||
ComplexId = complexId;
|
||||
}
|
||||
|
||||
public string Title { get; internal set; } = string.Empty;
|
||||
|
@ -23,6 +20,9 @@ public partial class Shift : ApiEntity
|
|||
public TimeSpan EndAt { get; internal set; }
|
||||
public string Description { get; internal set; } = string.Empty;
|
||||
|
||||
public Guid ComplexId { get; set; }
|
||||
public Complex.Complex? Complex { get; set; }
|
||||
|
||||
public List<ShiftDay> Days { get; internal set; } = new();
|
||||
|
||||
public List<ShiftPlan> Plans { get; internal set; } = new();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
namespace Brizco.Domain.Entities.Shift;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class ShiftPlan : ApiEntity
|
||||
{
|
||||
public ShiftPlan()
|
||||
|
@ -12,12 +15,11 @@ public partial class ShiftPlan : ApiEntity
|
|||
StartAt = startAt;
|
||||
EndAt = endAt;
|
||||
}
|
||||
public DateTime StartAt { get; private set; }
|
||||
public DateTime EndAt { get; private set; }
|
||||
public DateTime StartAt { get; internal set; }
|
||||
public DateTime EndAt { get; internal set; }
|
||||
|
||||
public Guid ShiftId { get; private set; }
|
||||
public virtual Shift? Shift { get; private set; }
|
||||
public Guid ShiftId { get; internal set; }
|
||||
public virtual Shift? Shift { get; internal set; }
|
||||
|
||||
public IReadOnlyCollection<ShiftPlanUser>? Users => ShiftPlanUsers;
|
||||
internal List<ShiftPlanUser>? ShiftPlanUsers { get; private set; } = new();
|
||||
public List<ShiftPlanUser> Users { get; internal set; } = new();
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Brizco.Domain.Entities.Shift;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public class ShiftPlanUser : ApiEntity
|
||||
{
|
||||
public ShiftPlanUser()
|
||||
|
@ -14,9 +16,9 @@ public class ShiftPlanUser : ApiEntity
|
|||
ShiftPlanId = shiftPlanId;
|
||||
ApplicationUserId = applicationUserId;
|
||||
}
|
||||
public Guid ShiftPlanId { get; private set; }
|
||||
public ShiftPlan? ShiftPlan { get; private set; }
|
||||
public Guid ShiftPlanId { get; internal set; }
|
||||
public ShiftPlan? ShiftPlan { get; internal set; }
|
||||
|
||||
public Guid ApplicationUserId { get; private set; }
|
||||
public ApplicationUser? ApplicationUser { get; private set; }
|
||||
public Guid ApplicationUserId { get; internal set; }
|
||||
public ApplicationUser? ApplicationUser { get; internal set; }
|
||||
}
|
|
@ -24,7 +24,8 @@ public partial class Activity : Task
|
|||
int amount,
|
||||
PurchaseAmountType amountType,
|
||||
string title,
|
||||
string description) : base(type,
|
||||
string description,
|
||||
Guid complexId) : base(type,
|
||||
isRelatedToShift,
|
||||
isRelatedToRole,
|
||||
isRelatedToPerson,
|
||||
|
@ -34,7 +35,8 @@ public partial class Activity : Task
|
|||
amount,
|
||||
amountType,
|
||||
title,
|
||||
description)
|
||||
description,
|
||||
complexId)
|
||||
{
|
||||
Status = status;
|
||||
DoneAt = doneAt;
|
||||
|
|
|
@ -15,7 +15,8 @@ public partial class Task
|
|||
DateTime setFor,
|
||||
bool hasDisposed,
|
||||
int amount,
|
||||
PurchaseAmountType amountType)
|
||||
PurchaseAmountType amountType,
|
||||
Guid complexId)
|
||||
{
|
||||
return new Task(type,
|
||||
isRelatedToShift,
|
||||
|
@ -27,7 +28,8 @@ public partial class Task
|
|||
amount,
|
||||
amountType,
|
||||
title,
|
||||
description);
|
||||
description,
|
||||
complexId);
|
||||
}
|
||||
|
||||
public void AddShift(params Guid[] shiftIds)
|
||||
|
@ -93,7 +95,8 @@ public partial class Activity
|
|||
DateTime setFor,
|
||||
bool hasDisposed,
|
||||
int amount,
|
||||
PurchaseAmountType amountType)
|
||||
PurchaseAmountType amountType,
|
||||
Guid complexId)
|
||||
{
|
||||
return new Activity(
|
||||
status,
|
||||
|
@ -109,7 +112,8 @@ public partial class Activity
|
|||
amount,
|
||||
amountType,
|
||||
title,
|
||||
description);
|
||||
description,
|
||||
complexId);
|
||||
}
|
||||
|
||||
public void DoneActivity()
|
||||
|
|
|
@ -21,7 +21,8 @@ public partial class Task : ApiEntity
|
|||
int amount,
|
||||
PurchaseAmountType amountType,
|
||||
string title,
|
||||
string description)
|
||||
string description,
|
||||
Guid complexId)
|
||||
{
|
||||
Type = type;
|
||||
IsRelatedToShift = isRelatedToShift;
|
||||
|
@ -34,6 +35,7 @@ public partial class Task : ApiEntity
|
|||
AmountType = amountType;
|
||||
Title = title;
|
||||
Description = description;
|
||||
ComplexId = complexId;
|
||||
}
|
||||
|
||||
public TaskType Type { get; internal set; }
|
||||
|
@ -46,6 +48,9 @@ public partial class Task : ApiEntity
|
|||
public DateTime SetFor { get; internal set; }
|
||||
public bool HasDisposed { get; internal set; }
|
||||
|
||||
public Guid ComplexId { get; set; }
|
||||
public Complex.Complex? Complex { get; set; }
|
||||
|
||||
|
||||
public int Amount { get; internal set; }
|
||||
public PurchaseAmountType AmountType { get; internal set; }
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
public class ApplicationRole : IdentityRole<Guid>
|
||||
{
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public Guid? ComplexId { get; set; }
|
||||
public Complex.Complex? Complex { get; set; }
|
||||
}
|
|
@ -16,6 +16,17 @@ namespace Brizco.Domain.Mappers
|
|||
DoneAt = p1.DoneAt,
|
||||
IsDone = p1.IsDone,
|
||||
PerformanceDescription = p1.PerformanceDescription,
|
||||
Type = p1.Type,
|
||||
Title = p1.Title,
|
||||
Description = p1.Description,
|
||||
IsRelatedToShift = p1.IsRelatedToShift,
|
||||
IsRelatedToRole = p1.IsRelatedToRole,
|
||||
IsRelatedToPerson = p1.IsRelatedToPerson,
|
||||
IsDisposable = p1.IsDisposable,
|
||||
SetFor = p1.SetFor,
|
||||
HasDisposed = p1.HasDisposed,
|
||||
Amount = p1.Amount,
|
||||
AmountType = p1.AmountType,
|
||||
Id = p1.Id
|
||||
};
|
||||
}
|
||||
|
@ -31,6 +42,17 @@ namespace Brizco.Domain.Mappers
|
|||
result.DoneAt = p2.DoneAt;
|
||||
result.IsDone = p2.IsDone;
|
||||
result.PerformanceDescription = p2.PerformanceDescription;
|
||||
result.Type = p2.Type;
|
||||
result.Title = p2.Title;
|
||||
result.Description = p2.Description;
|
||||
result.IsRelatedToShift = p2.IsRelatedToShift;
|
||||
result.IsRelatedToRole = p2.IsRelatedToRole;
|
||||
result.IsRelatedToPerson = p2.IsRelatedToPerson;
|
||||
result.IsDisposable = p2.IsDisposable;
|
||||
result.SetFor = p2.SetFor;
|
||||
result.HasDisposed = p2.HasDisposed;
|
||||
result.Amount = p2.Amount;
|
||||
result.AmountType = p2.AmountType;
|
||||
result.Id = p2.Id;
|
||||
return result;
|
||||
|
||||
|
@ -41,6 +63,17 @@ namespace Brizco.Domain.Mappers
|
|||
DoneAt = p4.DoneAt,
|
||||
IsDone = p4.IsDone,
|
||||
PerformanceDescription = p4.PerformanceDescription,
|
||||
Type = p4.Type,
|
||||
Title = p4.Title,
|
||||
Description = p4.Description,
|
||||
IsRelatedToShift = p4.IsRelatedToShift,
|
||||
IsRelatedToRole = p4.IsRelatedToRole,
|
||||
IsRelatedToPerson = p4.IsRelatedToPerson,
|
||||
IsDisposable = p4.IsDisposable,
|
||||
SetFor = p4.SetFor,
|
||||
HasDisposed = p4.HasDisposed,
|
||||
Amount = p4.Amount,
|
||||
AmountType = p4.AmountType,
|
||||
Id = p4.Id
|
||||
};
|
||||
public static ActivitySDto AdaptToSDto(this Activity p5)
|
||||
|
@ -119,6 +152,17 @@ namespace Brizco.Domain.Mappers
|
|||
DoneAt = p9.DoneAt,
|
||||
IsDone = p9.IsDone,
|
||||
PerformanceDescription = p9.PerformanceDescription,
|
||||
Type = p9.Type,
|
||||
Title = p9.Title,
|
||||
Description = p9.Description,
|
||||
IsRelatedToShift = p9.IsRelatedToShift,
|
||||
IsRelatedToRole = p9.IsRelatedToRole,
|
||||
IsRelatedToPerson = p9.IsRelatedToPerson,
|
||||
IsDisposable = p9.IsDisposable,
|
||||
SetFor = p9.SetFor,
|
||||
HasDisposed = p9.HasDisposed,
|
||||
Amount = p9.Amount,
|
||||
AmountType = p9.AmountType,
|
||||
Id = p9.Id
|
||||
};
|
||||
}
|
||||
|
@ -134,6 +178,17 @@ namespace Brizco.Domain.Mappers
|
|||
result.DoneAt = p10.DoneAt;
|
||||
result.IsDone = p10.IsDone;
|
||||
result.PerformanceDescription = p10.PerformanceDescription;
|
||||
result.Type = p10.Type;
|
||||
result.Title = p10.Title;
|
||||
result.Description = p10.Description;
|
||||
result.IsRelatedToShift = p10.IsRelatedToShift;
|
||||
result.IsRelatedToRole = p10.IsRelatedToRole;
|
||||
result.IsRelatedToPerson = p10.IsRelatedToPerson;
|
||||
result.IsDisposable = p10.IsDisposable;
|
||||
result.SetFor = p10.SetFor;
|
||||
result.HasDisposed = p10.HasDisposed;
|
||||
result.Amount = p10.Amount;
|
||||
result.AmountType = p10.AmountType;
|
||||
result.Id = p10.Id;
|
||||
return result;
|
||||
|
||||
|
@ -144,6 +199,17 @@ namespace Brizco.Domain.Mappers
|
|||
DoneAt = p12.DoneAt,
|
||||
IsDone = p12.IsDone,
|
||||
PerformanceDescription = p12.PerformanceDescription,
|
||||
Type = p12.Type,
|
||||
Title = p12.Title,
|
||||
Description = p12.Description,
|
||||
IsRelatedToShift = p12.IsRelatedToShift,
|
||||
IsRelatedToRole = p12.IsRelatedToRole,
|
||||
IsRelatedToPerson = p12.IsRelatedToPerson,
|
||||
IsDisposable = p12.IsDisposable,
|
||||
SetFor = p12.SetFor,
|
||||
HasDisposed = p12.HasDisposed,
|
||||
Amount = p12.Amount,
|
||||
AmountType = p12.AmountType,
|
||||
Id = p12.Id
|
||||
};
|
||||
public static ActivityLDto AdaptToLDto(this Activity p13)
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Brizco.Domain.Mappers
|
|||
{
|
||||
UserId = p1.UserId,
|
||||
ComplexId = p1.ComplexId,
|
||||
RoleId = p1.RoleId,
|
||||
Id = p1.Id
|
||||
};
|
||||
}
|
||||
|
@ -27,7 +26,6 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
result.UserId = p2.UserId;
|
||||
result.ComplexId = p2.ComplexId;
|
||||
result.RoleId = p2.RoleId;
|
||||
result.Id = p2.Id;
|
||||
return result;
|
||||
|
||||
|
@ -36,7 +34,6 @@ namespace Brizco.Domain.Mappers
|
|||
{
|
||||
UserId = p4.UserId,
|
||||
ComplexId = p4.ComplexId,
|
||||
RoleId = p4.RoleId,
|
||||
Id = p4.Id
|
||||
};
|
||||
public static ComplexUserSDto AdaptToSDto(this ComplexUser p5)
|
||||
|
@ -45,7 +42,6 @@ namespace Brizco.Domain.Mappers
|
|||
{
|
||||
UserId = p5.UserId,
|
||||
ComplexId = p5.ComplexId,
|
||||
RoleId = p5.RoleId,
|
||||
Id = p5.Id
|
||||
};
|
||||
}
|
||||
|
@ -59,7 +55,6 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
result.UserId = p6.UserId;
|
||||
result.ComplexId = p6.ComplexId;
|
||||
result.RoleId = p6.RoleId;
|
||||
result.Id = p6.Id;
|
||||
return result;
|
||||
|
||||
|
@ -68,7 +63,6 @@ namespace Brizco.Domain.Mappers
|
|||
{
|
||||
UserId = p8.UserId,
|
||||
ComplexId = p8.ComplexId,
|
||||
RoleId = p8.RoleId,
|
||||
Id = p8.Id
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Brizco.Domain.Dtos.SmallDtos;
|
||||
using Brizco.Domain.Entities.Complex;
|
||||
using Brizco.Domain.Entities.Shift;
|
||||
using Mapster.Models;
|
||||
|
||||
namespace Brizco.Domain.Mappers
|
||||
{
|
||||
|
@ -17,6 +19,8 @@ namespace Brizco.Domain.Mappers
|
|||
StartAt = p1.StartAt,
|
||||
EndAt = p1.EndAt,
|
||||
Description = p1.Description,
|
||||
ComplexId = p1.ComplexId,
|
||||
Complex = new Complex() {Id = p1.ComplexId},
|
||||
Days = funcMain1(p1.Days),
|
||||
Id = p1.Id
|
||||
};
|
||||
|
@ -33,57 +37,64 @@ namespace Brizco.Domain.Mappers
|
|||
result.StartAt = p3.StartAt;
|
||||
result.EndAt = p3.EndAt;
|
||||
result.Description = p3.Description;
|
||||
result.Days = funcMain2(p3.Days, result.Days);
|
||||
result.ComplexId = p3.ComplexId;
|
||||
result.Complex = funcMain2(new Never(), result.Complex, p3);
|
||||
result.Days = funcMain3(p3.Days, result.Days);
|
||||
result.Id = p3.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftSDto, Shift>> ProjectToShift => p7 => new Shift()
|
||||
public static Expression<Func<ShiftSDto, Shift>> ProjectToShift => p9 => new Shift()
|
||||
{
|
||||
Title = p7.Title,
|
||||
StartAt = p7.StartAt,
|
||||
EndAt = p7.EndAt,
|
||||
Description = p7.Description,
|
||||
Days = p7.Days.Select<DayOfWeek, ShiftDay>(p8 => new ShiftDay() {}).ToList<ShiftDay>(),
|
||||
Id = p7.Id
|
||||
Title = p9.Title,
|
||||
StartAt = p9.StartAt,
|
||||
EndAt = p9.EndAt,
|
||||
Description = p9.Description,
|
||||
ComplexId = p9.ComplexId,
|
||||
Complex = new Complex() {Id = p9.ComplexId},
|
||||
Days = p9.Days.Select<DayOfWeek, ShiftDay>(p10 => new ShiftDay() {}).ToList<ShiftDay>(),
|
||||
Id = p9.Id
|
||||
};
|
||||
public static ShiftSDto AdaptToSDto(this Shift p9)
|
||||
public static ShiftSDto AdaptToSDto(this Shift p11)
|
||||
{
|
||||
return p9 == null ? null : new ShiftSDto()
|
||||
return p11 == null ? null : new ShiftSDto()
|
||||
{
|
||||
Title = p9.Title,
|
||||
Description = p9.Description,
|
||||
StartAt = p9.StartAt,
|
||||
EndAt = p9.EndAt,
|
||||
Days = funcMain3(p9.Days != null ? p9.Days.Select<ShiftDay, DayOfWeek>(funcMain4).ToList<DayOfWeek>() : new List<DayOfWeek>()),
|
||||
Id = p9.Id
|
||||
Title = p11.Title,
|
||||
Description = p11.Description,
|
||||
StartAt = p11.StartAt,
|
||||
EndAt = p11.EndAt,
|
||||
Days = funcMain4(p11.Days != null ? p11.Days.Select<ShiftDay, DayOfWeek>(funcMain5).ToList<DayOfWeek>() : new List<DayOfWeek>()),
|
||||
ComplexId = p11.ComplexId,
|
||||
Id = p11.Id
|
||||
};
|
||||
}
|
||||
public static ShiftSDto AdaptTo(this Shift p11, ShiftSDto p12)
|
||||
public static ShiftSDto AdaptTo(this Shift p13, ShiftSDto p14)
|
||||
{
|
||||
if (p11 == null)
|
||||
if (p13 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftSDto result = p12 ?? new ShiftSDto();
|
||||
ShiftSDto result = p14 ?? new ShiftSDto();
|
||||
|
||||
result.Title = p11.Title;
|
||||
result.Description = p11.Description;
|
||||
result.StartAt = p11.StartAt;
|
||||
result.EndAt = p11.EndAt;
|
||||
result.Days = funcMain5(p11.Days != null ? p11.Days.Select<ShiftDay, DayOfWeek>(funcMain4).ToList<DayOfWeek>() : new List<DayOfWeek>(), result.Days);
|
||||
result.Id = p11.Id;
|
||||
result.Title = p13.Title;
|
||||
result.Description = p13.Description;
|
||||
result.StartAt = p13.StartAt;
|
||||
result.EndAt = p13.EndAt;
|
||||
result.Days = funcMain6(p13.Days != null ? p13.Days.Select<ShiftDay, DayOfWeek>(funcMain5).ToList<DayOfWeek>() : new List<DayOfWeek>(), result.Days);
|
||||
result.ComplexId = p13.ComplexId;
|
||||
result.Id = p13.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Shift, ShiftSDto>> ProjectToSDto => p15 => new ShiftSDto()
|
||||
public static Expression<Func<Shift, ShiftSDto>> ProjectToSDto => p17 => new ShiftSDto()
|
||||
{
|
||||
Title = p15.Title,
|
||||
Description = p15.Description,
|
||||
StartAt = p15.StartAt,
|
||||
EndAt = p15.EndAt,
|
||||
Days = p15.Days != null ? p15.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>() : new List<DayOfWeek>(),
|
||||
Id = p15.Id
|
||||
Title = p17.Title,
|
||||
Description = p17.Description,
|
||||
StartAt = p17.StartAt,
|
||||
EndAt = p17.EndAt,
|
||||
Days = p17.Days != null ? p17.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>() : new List<DayOfWeek>(),
|
||||
ComplexId = p17.ComplexId,
|
||||
Id = p17.Id
|
||||
};
|
||||
|
||||
private static List<ShiftDay> funcMain1(List<DayOfWeek> p2)
|
||||
|
@ -107,20 +118,29 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftDay> funcMain2(List<DayOfWeek> p5, List<ShiftDay> p6)
|
||||
private static Complex funcMain2(Never p5, Complex p6, ShiftSDto p3)
|
||||
{
|
||||
if (p5 == null)
|
||||
Complex result = p6 ?? new Complex();
|
||||
|
||||
result.Id = p3.ComplexId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftDay> funcMain3(List<DayOfWeek> p7, List<ShiftDay> p8)
|
||||
{
|
||||
if (p7 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftDay> result = new List<ShiftDay>(p5.Count);
|
||||
List<ShiftDay> result = new List<ShiftDay>(p7.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p5.Count;
|
||||
int len = p7.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
DayOfWeek item = p5[i];
|
||||
DayOfWeek item = p7[i];
|
||||
result.Add(new ShiftDay() {});
|
||||
i++;
|
||||
}
|
||||
|
@ -128,20 +148,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<DayOfWeek> funcMain3(List<DayOfWeek> p10)
|
||||
private static List<DayOfWeek> funcMain4(List<DayOfWeek> p12)
|
||||
{
|
||||
if (p10 == null)
|
||||
if (p12 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<DayOfWeek> result = new List<DayOfWeek>(p10.Count);
|
||||
List<DayOfWeek> result = new List<DayOfWeek>(p12.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
int len = p12.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
DayOfWeek item = p10[i];
|
||||
DayOfWeek item = p12[i];
|
||||
result.Add(item);
|
||||
i++;
|
||||
}
|
||||
|
@ -149,25 +169,25 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static DayOfWeek funcMain4(ShiftDay d)
|
||||
private static DayOfWeek funcMain5(ShiftDay d)
|
||||
{
|
||||
return d.DayOfWeek;
|
||||
}
|
||||
|
||||
private static List<DayOfWeek> funcMain5(List<DayOfWeek> p13, List<DayOfWeek> p14)
|
||||
private static List<DayOfWeek> funcMain6(List<DayOfWeek> p15, List<DayOfWeek> p16)
|
||||
{
|
||||
if (p13 == null)
|
||||
if (p15 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<DayOfWeek> result = new List<DayOfWeek>(p13.Count);
|
||||
List<DayOfWeek> result = new List<DayOfWeek>(p15.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p13.Count;
|
||||
int len = p15.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
DayOfWeek item = p13[i];
|
||||
DayOfWeek item = p15[i];
|
||||
result.Add(item);
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,265 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Brizco.Domain.Dtos.LargDtos;
|
||||
using Brizco.Domain.Dtos.SmallDtos;
|
||||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.Mappers
|
||||
{
|
||||
public static partial class ShiftPlanMapper
|
||||
{
|
||||
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanSDto p1)
|
||||
{
|
||||
return p1 == null ? null : new ShiftPlan()
|
||||
{
|
||||
StartAt = p1.StartAt,
|
||||
EndAt = p1.EndAt,
|
||||
ShiftId = p1.ShiftId,
|
||||
Id = p1.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlan AdaptTo(this ShiftPlanSDto p2, ShiftPlan p3)
|
||||
{
|
||||
if (p2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlan result = p3 ?? new ShiftPlan();
|
||||
|
||||
result.StartAt = p2.StartAt;
|
||||
result.EndAt = p2.EndAt;
|
||||
result.ShiftId = p2.ShiftId;
|
||||
result.Id = p2.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p4 => new ShiftPlan()
|
||||
{
|
||||
StartAt = p4.StartAt,
|
||||
EndAt = p4.EndAt,
|
||||
ShiftId = p4.ShiftId,
|
||||
Id = p4.Id
|
||||
};
|
||||
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p5)
|
||||
{
|
||||
return p5 == null ? null : new ShiftPlanSDto()
|
||||
{
|
||||
StartAt = p5.StartAt,
|
||||
EndAt = p5.EndAt,
|
||||
ShiftId = p5.ShiftId,
|
||||
ShiftTitle = p5.Shift == null ? null : p5.Shift.Title,
|
||||
Id = p5.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanSDto AdaptTo(this ShiftPlan p6, ShiftPlanSDto p7)
|
||||
{
|
||||
if (p6 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanSDto result = p7 ?? new ShiftPlanSDto();
|
||||
|
||||
result.StartAt = p6.StartAt;
|
||||
result.EndAt = p6.EndAt;
|
||||
result.ShiftId = p6.ShiftId;
|
||||
result.ShiftTitle = p6.Shift == null ? null : p6.Shift.Title;
|
||||
result.Id = p6.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p8 => new ShiftPlanSDto()
|
||||
{
|
||||
StartAt = p8.StartAt,
|
||||
EndAt = p8.EndAt,
|
||||
ShiftId = p8.ShiftId,
|
||||
ShiftTitle = p8.Shift.Title,
|
||||
Id = p8.Id
|
||||
};
|
||||
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p9)
|
||||
{
|
||||
return p9 == null ? null : new ShiftPlan()
|
||||
{
|
||||
StartAt = p9.StartAt,
|
||||
EndAt = p9.EndAt,
|
||||
ShiftId = p9.ShiftId,
|
||||
Users = funcMain1(p9.Users),
|
||||
Id = p9.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlan AdaptTo(this ShiftPlanLDto p11, ShiftPlan p12)
|
||||
{
|
||||
if (p11 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlan result = p12 ?? new ShiftPlan();
|
||||
|
||||
result.StartAt = p11.StartAt;
|
||||
result.EndAt = p11.EndAt;
|
||||
result.ShiftId = p11.ShiftId;
|
||||
result.Users = funcMain2(p11.Users, result.Users);
|
||||
result.Id = p11.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlanLDto, ShiftPlan>> ProjectLDtoToShiftPlan => p15 => new ShiftPlan()
|
||||
{
|
||||
StartAt = p15.StartAt,
|
||||
EndAt = p15.EndAt,
|
||||
ShiftId = p15.ShiftId,
|
||||
Users = p15.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p16 => new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = p16.ShiftPlanId,
|
||||
ApplicationUserId = p16.ApplicationUserId,
|
||||
Id = p16.Id
|
||||
}).ToList<ShiftPlanUser>(),
|
||||
Id = p15.Id
|
||||
};
|
||||
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p17)
|
||||
{
|
||||
return p17 == null ? null : new ShiftPlanLDto()
|
||||
{
|
||||
StartAt = p17.StartAt,
|
||||
EndAt = p17.EndAt,
|
||||
ShiftId = p17.ShiftId,
|
||||
Users = funcMain3(p17.Users),
|
||||
Id = p17.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanLDto AdaptTo(this ShiftPlan p19, ShiftPlanLDto p20)
|
||||
{
|
||||
if (p19 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanLDto result = p20 ?? new ShiftPlanLDto();
|
||||
|
||||
result.StartAt = p19.StartAt;
|
||||
result.EndAt = p19.EndAt;
|
||||
result.ShiftId = p19.ShiftId;
|
||||
result.Users = funcMain4(p19.Users, result.Users);
|
||||
result.Id = p19.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p23 => new ShiftPlanLDto()
|
||||
{
|
||||
StartAt = p23.StartAt,
|
||||
EndAt = p23.EndAt,
|
||||
ShiftId = p23.ShiftId,
|
||||
Users = p23.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p24 => new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = p24.ShiftPlanId,
|
||||
ApplicationUserId = p24.ApplicationUserId,
|
||||
Id = p24.Id
|
||||
}).ToList<ShiftPlanUserSDto>(),
|
||||
Id = p23.Id
|
||||
};
|
||||
|
||||
private static List<ShiftPlanUser> funcMain1(List<ShiftPlanUserSDto> p10)
|
||||
{
|
||||
if (p10 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p10.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p10[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
ApplicationUserId = item.ApplicationUserId,
|
||||
Id = item.Id
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain2(List<ShiftPlanUserSDto> p13, List<ShiftPlanUser> p14)
|
||||
{
|
||||
if (p13 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p13.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p13.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p13[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
ApplicationUserId = item.ApplicationUserId,
|
||||
Id = item.Id
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain3(List<ShiftPlanUser> p18)
|
||||
{
|
||||
if (p18 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p18.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p18.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p18[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
ApplicationUserId = item.ApplicationUserId,
|
||||
Id = item.Id
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain4(List<ShiftPlanUser> p21, List<ShiftPlanUserSDto> p22)
|
||||
{
|
||||
if (p21 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p21.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p21.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p21[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
ApplicationUserId = item.ApplicationUserId,
|
||||
Id = item.Id
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Brizco.Domain.Dtos.SmallDtos;
|
||||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.Mappers
|
||||
{
|
||||
public static partial class ShiftPlanUserMapper
|
||||
{
|
||||
public static ShiftPlanUser AdaptToShiftPlanUser(this ShiftPlanUserSDto p1)
|
||||
{
|
||||
return p1 == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = p1.ShiftPlanId,
|
||||
ApplicationUserId = p1.ApplicationUserId,
|
||||
Id = p1.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanUser AdaptTo(this ShiftPlanUserSDto p2, ShiftPlanUser p3)
|
||||
{
|
||||
if (p2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanUser result = p3 ?? new ShiftPlanUser();
|
||||
|
||||
result.ShiftPlanId = p2.ShiftPlanId;
|
||||
result.ApplicationUserId = p2.ApplicationUserId;
|
||||
result.Id = p2.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p4 => new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = p4.ShiftPlanId,
|
||||
ApplicationUserId = p4.ApplicationUserId,
|
||||
Id = p4.Id
|
||||
};
|
||||
public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p5)
|
||||
{
|
||||
return p5 == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = p5.ShiftPlanId,
|
||||
ApplicationUserId = p5.ApplicationUserId,
|
||||
Id = p5.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanUserSDto AdaptTo(this ShiftPlanUser p6, ShiftPlanUserSDto p7)
|
||||
{
|
||||
if (p6 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanUserSDto result = p7 ?? new ShiftPlanUserSDto();
|
||||
|
||||
result.ShiftPlanId = p6.ShiftPlanId;
|
||||
result.ApplicationUserId = p6.ApplicationUserId;
|
||||
result.Id = p6.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p8 => new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = p8.ShiftPlanId,
|
||||
ApplicationUserId = p8.ApplicationUserId,
|
||||
Id = p8.Id
|
||||
};
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ namespace Brizco.Domain.Mappers
|
|||
IsDisposable = p1.IsDisposable,
|
||||
SetFor = p1.SetFor,
|
||||
HasDisposed = p1.HasDisposed,
|
||||
ComplexId = p1.ComplexId,
|
||||
Amount = p1.Amount,
|
||||
AmountType = p1.AmountType,
|
||||
Id = p1.Id
|
||||
|
@ -46,6 +47,7 @@ namespace Brizco.Domain.Mappers
|
|||
result.IsDisposable = p2.IsDisposable;
|
||||
result.SetFor = p2.SetFor;
|
||||
result.HasDisposed = p2.HasDisposed;
|
||||
result.ComplexId = p2.ComplexId;
|
||||
result.Amount = p2.Amount;
|
||||
result.AmountType = p2.AmountType;
|
||||
result.Id = p2.Id;
|
||||
|
@ -63,6 +65,7 @@ namespace Brizco.Domain.Mappers
|
|||
IsDisposable = p4.IsDisposable,
|
||||
SetFor = p4.SetFor,
|
||||
HasDisposed = p4.HasDisposed,
|
||||
ComplexId = p4.ComplexId,
|
||||
Amount = p4.Amount,
|
||||
AmountType = p4.AmountType,
|
||||
Id = p4.Id
|
||||
|
@ -80,6 +83,7 @@ namespace Brizco.Domain.Mappers
|
|||
IsDisposable = p5.IsDisposable,
|
||||
SetFor = p5.SetFor,
|
||||
HasDisposed = p5.HasDisposed,
|
||||
ComplexId = p5.ComplexId,
|
||||
Amount = p5.Amount,
|
||||
AmountType = p5.AmountType,
|
||||
Id = p5.Id
|
||||
|
@ -102,6 +106,7 @@ namespace Brizco.Domain.Mappers
|
|||
result.IsDisposable = p6.IsDisposable;
|
||||
result.SetFor = p6.SetFor;
|
||||
result.HasDisposed = p6.HasDisposed;
|
||||
result.ComplexId = p6.ComplexId;
|
||||
result.Amount = p6.Amount;
|
||||
result.AmountType = p6.AmountType;
|
||||
result.Id = p6.Id;
|
||||
|
@ -119,6 +124,7 @@ namespace Brizco.Domain.Mappers
|
|||
IsDisposable = p8.IsDisposable,
|
||||
SetFor = p8.SetFor,
|
||||
HasDisposed = p8.HasDisposed,
|
||||
ComplexId = p8.ComplexId,
|
||||
Amount = p8.Amount,
|
||||
AmountType = p8.AmountType,
|
||||
Id = p8.Id
|
||||
|
|
Loading…
Reference in New Issue