diff --git a/Brizco.Api/AppSettings/appsettings.Development.json b/Brizco.Api/AppSettings/appsettings.Development.json index 79b9a74..01d19fb 100644 --- a/Brizco.Api/AppSettings/appsettings.Development.json +++ b/Brizco.Api/AppSettings/appsettings.Development.json @@ -13,7 +13,7 @@ } }, "SiteSettings": { - "BaseUrl": "http://192.168.88.12:32769", + "BaseUrl": "http://192.168.88.251:32769", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "UserSetting": { "Username": "root", diff --git a/Brizco.Api/Brizco.Api.csproj b/Brizco.Api/Brizco.Api.csproj index ad4ed84..dc03ef0 100644 --- a/Brizco.Api/Brizco.Api.csproj +++ b/Brizco.Api/Brizco.Api.csproj @@ -11,47 +11,47 @@ - + - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + - - + + - - + + - + - - - + + + - - - + + + diff --git a/Brizco.Api/Controllers/ReportController.cs b/Brizco.Api/Controllers/ReportController.cs new file mode 100644 index 0000000..bc3378f --- /dev/null +++ b/Brizco.Api/Controllers/ReportController.cs @@ -0,0 +1,35 @@ +using Brizco.Core.CoreServices.ReportServices.Commands; +using MediatR; + +namespace Brizco.Api.Controllers; + +public class ReportController : ICarterModule +{ + public void AddRoutes(IEndpointRouteBuilder app) + { + var group = app.NewVersionedApi("Report") + .MapGroup("api/report"); + + group.MapGet("task", GetTasksReportAsync) + .WithDisplayName("Get Tasks Report") + .HasApiVersion(1.0); + + group.MapGet("shit/plan/{shiftPLanId}", GetShiftPlanReportAsync) + .WithDisplayName("Get ShiftPlan Report") + .HasApiVersion(1.0); + } + + public async Task GetTasksReportAsync([FromServices]IMediator mediator,CancellationToken cancellationToken) + { + var file = await mediator.Send(new TaskReportCommand(),cancellationToken); + string fileName = $"TaskReport_{DateTime.Now:yyyy-MM-dd}.xlsx"; + return TypedResults.File(file, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName); + } + + public async Task GetShiftPlanReportAsync(Guid shiftPLanId,[FromServices] IMediator mediator, CancellationToken cancellationToken) + { + var file = await mediator.Send(new ShiftPlanReportCommand(ShiftPlanId: shiftPLanId), cancellationToken); + string fileName = $"ShiftPlanReport_{DateTime.Now:yyyy-MM-dd}.xlsx"; + return TypedResults.File(file, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName); + } +} \ No newline at end of file diff --git a/Brizco.Common/Brizco.Common.csproj b/Brizco.Common/Brizco.Common.csproj index ce92ab5..2bff86c 100644 --- a/Brizco.Common/Brizco.Common.csproj +++ b/Brizco.Common/Brizco.Common.csproj @@ -11,7 +11,7 @@ - + --> diff --git a/Brizco.Common/Models/Claims/ApplicationClaims.cs b/Brizco.Common/Models/Claims/ApplicationClaims.cs index 38fbf63..b86f6d0 100644 --- a/Brizco.Common/Models/Claims/ApplicationClaims.cs +++ b/Brizco.Common/Models/Claims/ApplicationClaims.cs @@ -245,6 +245,27 @@ public static class ApplicationClaims ViewComplexSettings.GetClaim }; + public static List ViewerOwnerClaims = new List + { + ViewStaffs.GetClaim, + + ViewActivities.GetClaim, + + ViewTasks.GetClaim, + + ViewShiftPlans.GetClaim, + + ViewShifts.GetClaim, + + ViewRoutines.GetClaim, + + ViewPositions.GetClaim, + + ViewSections.GetClaim, + + ViewDashboard.GetClaim, + ViewComplexSettings.GetClaim + }; public static List SuperVisorClaims = new List { diff --git a/Brizco.Core/Brizco.Core.csproj b/Brizco.Core/Brizco.Core.csproj index 08069b0..cf1d8fa 100644 --- a/Brizco.Core/Brizco.Core.csproj +++ b/Brizco.Core/Brizco.Core.csproj @@ -12,7 +12,8 @@ - + + @@ -32,8 +33,10 @@ + + @@ -41,12 +44,16 @@ + + + + diff --git a/Brizco.Core/CoreServices/ReportServices/Commands/IReportService.cs b/Brizco.Core/CoreServices/ReportServices/Commands/IReportService.cs new file mode 100644 index 0000000..a88f48e --- /dev/null +++ b/Brizco.Core/CoreServices/ReportServices/Commands/IReportService.cs @@ -0,0 +1,6 @@ +namespace Brizco.Core.CoreServices.ReportServices.Commands; + +public interface IReportService : IScopedDependency +{ + Task GetTaskReportAsync(); +} \ No newline at end of file diff --git a/Brizco.Core/CoreServices/ReportServices/Commands/ReportCommands.cs b/Brizco.Core/CoreServices/ReportServices/Commands/ReportCommands.cs new file mode 100644 index 0000000..9334ed9 --- /dev/null +++ b/Brizco.Core/CoreServices/ReportServices/Commands/ReportCommands.cs @@ -0,0 +1,4 @@ +namespace Brizco.Core.CoreServices.ReportServices.Commands; + +public sealed record TaskReportCommand() : IRequest; +public sealed record ShiftPlanReportCommand(Guid ShiftPlanId) : IRequest; \ No newline at end of file diff --git a/Brizco.Core/CoreServices/ReportServices/ShiftPlanReportCommandHandler.cs b/Brizco.Core/CoreServices/ReportServices/ShiftPlanReportCommandHandler.cs new file mode 100644 index 0000000..b01f036 --- /dev/null +++ b/Brizco.Core/CoreServices/ReportServices/ShiftPlanReportCommandHandler.cs @@ -0,0 +1,126 @@ +using Brizco.Domain.Entities.Shift; +using Brizco.Domain.Entities.Task; + +namespace Brizco.Core.CoreServices.ReportServices; +public class ShiftPlanReportCommandHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public ShiftPlanReportCommandHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(ShiftPlanReportCommand request, CancellationToken cancellationToken) + { + var shiftPlan = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Where(sp => sp.Id == request.ShiftPlanId) + .Select(ShiftPlanMapper.ProjectToSDto) + .FirstOrDefaultAsync(cancellationToken); + if (shiftPlan == null) + throw new AppException("ShiftPlan not found", ApiResultStatusCode.NotFound); + var activities = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Where(sp => sp.ShiftId == shiftPlan.ShiftId && sp.SetFor.Date == shiftPlan.PlanFor.Date) + .Select(ActivityMapper.ProjectToSDto) + .ToListAsync(cancellationToken); + + + var workbook = new XSSFWorkbook(); + var sheet = workbook.CreateSheet($"شیفت {shiftPlan.ShiftTitle} - {shiftPlan.PlanFor.ToPersianDateTime().ToLongDateString()}"); + sheet.IsRightToLeft = true; + int selectedRow = 1; + CreateHeader(sheet, workbook); + foreach (var activity in activities) + { + var row = sheet.GetRow(selectedRow) ?? sheet.CreateRow(selectedRow); + row.Height = 700; + + var style = workbook.CreateCellStyle(); + + style.VerticalAlignment = VerticalAlignment.Center; + style.Alignment = HorizontalAlignment.Center; + style.WrapText = true; + + var cell = row.CreateCell(0); + cell.CellStyle = style; + cell.SetCellValue(activity.Title); + + var personCell = row.CreateCell(1); + personCell.CellStyle = style; + personCell.SetCellValue(activity.UserFullName); + + var statusCell = row.CreateCell(2); + statusCell.CellStyle = style; + statusCell.SetCellValue(activity.Status.ToDisplay()); + + var doneAtCell = row.CreateCell(3); + doneAtCell.CellStyle = style; + doneAtCell.SetCellValue(activity.Title); + + var unDoneReasonCell = row.CreateCell(4); + unDoneReasonCell.CellStyle = style; + unDoneReasonCell.SetCellValue(activity.UnDoneReason); + + selectedRow++; + } + + sheet.SetColumnWidth(0, 25600); + sheet.SetColumnWidth(1, 7000); + sheet.SetColumnWidth(2, 7000); + sheet.SetColumnWidth(3, 7000); + sheet.SetColumnWidth(4, 7000); + + + var stream = new MemoryStream(); + workbook.Write(stream); + var content = stream.ToArray(); + + return content; + } + + void CreateHeader(ISheet sheet, XSSFWorkbook workbook) + { + var headerRow = sheet.GetRow(0) ?? sheet.CreateRow(0); + headerRow.Height = 700; + + var font = workbook.CreateFont(); + font.IsBold = true; + font.Color = NPOI.HSSF.Util.HSSFColor.White.Index; + + //font.FontHeight = 16; + var style = workbook.CreateCellStyle(); + style.Alignment = HorizontalAlignment.Center; + style.VerticalAlignment = VerticalAlignment.Center; + style.WrapText = true; + style.SetFont(font); + + byte[] rgb = new byte[3] { 30, 81, 123 }; + XSSFColor color = new XSSFColor(rgb); + //style.SetFillBackgroundColor(color); + //style.SetFillForegroundColor(color); + + style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.BlueGrey.Index; + style.FillPattern = FillPattern.SolidForeground; + + var shiftNameHeaderCell = headerRow.CreateCell(0); + shiftNameHeaderCell.CellStyle = style; + shiftNameHeaderCell.SetCellValue("تسکــــ"); + + var taskNameHeaderCell = headerRow.CreateCell(1); + taskNameHeaderCell.CellStyle = style; + taskNameHeaderCell.SetCellValue("شخص"); + + var positionNameHeaderCell = headerRow.CreateCell(2); + positionNameHeaderCell.CellStyle = style; + positionNameHeaderCell.SetCellValue("وضعیت"); + + var doneAtHeaderCell = headerRow.CreateCell(3); + doneAtHeaderCell.CellStyle = style; + doneAtHeaderCell.SetCellValue("انجام شده در"); + + var unDoneReasonAtHeaderCell = headerRow.CreateCell(4); + unDoneReasonAtHeaderCell.CellStyle = style; + unDoneReasonAtHeaderCell.SetCellValue("دلیل انجام نشدن"); + } +} diff --git a/Brizco.Core/CoreServices/ReportServices/TaskReportCommandHandler.cs b/Brizco.Core/CoreServices/ReportServices/TaskReportCommandHandler.cs new file mode 100644 index 0000000..72ecd66 --- /dev/null +++ b/Brizco.Core/CoreServices/ReportServices/TaskReportCommandHandler.cs @@ -0,0 +1,213 @@ +using Brizco.Domain.Entities.Task; +using Task = System.Threading.Tasks.Task; + +namespace Brizco.Core.CoreServices.ReportServices; +public class TaskReportCommandHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public TaskReportCommandHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(TaskReportCommand request, CancellationToken cancellationToken) + { + var tasks = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Select(TaskMapper.ProjectToLDto) + .ToListAsync(cancellationToken); + + var workbook = new XSSFWorkbook(); + + var sheet = workbook.CreateSheet("روزانه"); + + sheet.IsRightToLeft = true; + int selectedRow = 1; + var originalTasks = tasks.Where(t => t.ScheduleType == TaskScheduleType.Daily).ToList(); + + CreateHeader(sheet, workbook); + + var shiftsTask = originalTasks.SelectMany(dt => dt.Shifts).ToList(); + foreach (var taskShiftGrouped in shiftsTask.GroupBy(t => t.ShiftId)) + { + var count = taskShiftGrouped.ToList().Count - 1; + var shiftName = taskShiftGrouped.FirstOrDefault()?.ShiftName ?? string.Empty; + CreateShiftName(selectedRow, selectedRow + count, shiftName, sheet, workbook); + int j = selectedRow; + foreach (var taskShiftSDto in taskShiftGrouped) + { + var row = sheet.GetRow(j) ?? sheet.CreateRow(j); + row.Height = 700; + + var style = workbook.CreateCellStyle(); + + style.VerticalAlignment = VerticalAlignment.Center; + style.Alignment = HorizontalAlignment.Center; + style.WrapText = true; + + var cell = row.CreateCell(1); + cell.CellStyle = style; + cell.SetCellValue(taskShiftSDto.TaskTitle); + + + var position = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Where(t => t.TaskId == taskShiftSDto.TaskId) + .Select(TaskPositionMapper.ProjectToSDto) + .ToListAsync(cancellationToken); + + var positionCell = row.CreateCell(2); + positionCell.CellStyle = style; + positionCell.SetCellValue(string.Join(" , ", position.Select(p => p.PositionName))); + + j++; + } + + selectedRow += count + 1; + } + + sheet.SetColumnWidth(1, 25600); + sheet.SetColumnWidth(2, 7000); + await CreateSheetForWeek(tasks, 6, workbook); + for (int i = 0; i < 6; i++) + { + await CreateSheetForWeek(tasks, i, workbook); + } + + + + + + var stream = new MemoryStream(); + workbook.Write(stream); + var content = stream.ToArray(); + + return content; + } + + async Task CreateSheetForWeek(List tasks, int day, XSSFWorkbook workbook) + { + var dayOfWeek = (DayOfWeek)day; + var sheet = workbook.CreateSheet(dayOfWeek.GetPersianDayOfWeek()); + + int selectedRow = 1; + + CreateHeader(sheet, workbook); + + sheet.IsRightToLeft = true; + var dayTasks = tasks.Where(t => t.Days.Any(d => d.DayOfWeek == (DayOfWeek)day)).ToList(); + + + + var shiftsTask = dayTasks.SelectMany(dt => dt.Shifts).ToList(); + foreach (var taskShiftGrouped in shiftsTask.GroupBy(t => t.ShiftId)) + { + var count = taskShiftGrouped.ToList().Count - 1; + var shiftName = taskShiftGrouped.FirstOrDefault()?.ShiftName ?? string.Empty; + CreateShiftName(selectedRow, selectedRow + count, shiftName, sheet, workbook); + int j = selectedRow; + foreach (var taskShiftSDto in taskShiftGrouped) + { + + var row = sheet.GetRow(j) ?? sheet.CreateRow(j); + row.Height = 700; + + var style = workbook.CreateCellStyle(); + + style.VerticalAlignment = VerticalAlignment.Center; + style.Alignment = HorizontalAlignment.Center; + style.WrapText = true; + + var cell = row.CreateCell(1); + cell.CellStyle = style; + cell.SetCellValue(taskShiftSDto.TaskTitle); + + + var position = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Where(t => t.TaskId == taskShiftSDto.TaskId) + .Select(TaskPositionMapper.ProjectToSDto) + .ToListAsync(); + + var positionCell = row.CreateCell(2); + positionCell.CellStyle = style; + positionCell.SetCellValue(string.Join(" , ", position.Select(p => p.PositionName))); + + j++; + } + + selectedRow = (selectedRow) + count + 1; + } + sheet.SetColumnWidth(1, 25600); + sheet.SetColumnWidth(2, 7000); + } + + void CreateHeader(ISheet sheet, XSSFWorkbook workbook) + { + var headerRow = sheet.GetRow(0) ?? sheet.CreateRow(0); + headerRow.Height = 700; + + var font = workbook.CreateFont(); + font.IsBold = true; + font.Color = NPOI.HSSF.Util.HSSFColor.White.Index; + + //font.FontHeight = 16; + var style = workbook.CreateCellStyle(); + style.Alignment = HorizontalAlignment.Center; + style.VerticalAlignment = VerticalAlignment.Center; + style.WrapText = true; + style.SetFont(font); + + byte[] rgb = new byte[3] { 30, 81, 123 }; + XSSFColor color = new XSSFColor(rgb); + //style.SetFillBackgroundColor(color); + //style.SetFillForegroundColor(color); + + style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.BlueGrey.Index; + style.FillPattern = FillPattern.SolidForeground; + + var shiftNameHeaderCell = headerRow.CreateCell(0); + shiftNameHeaderCell.CellStyle = style; + shiftNameHeaderCell.SetCellValue("شیفتــ"); + + var taskNameHeaderCell = headerRow.CreateCell(1); + taskNameHeaderCell.CellStyle = style; + taskNameHeaderCell.SetCellValue("تسکــــ"); + + var positionNameHeaderCell = headerRow.CreateCell(2); + positionNameHeaderCell.CellStyle = style; + positionNameHeaderCell.SetCellValue("پوزیشن"); + } + + void CreateShiftName(int startRow, int lastRow, string name, ISheet sheet, XSSFWorkbook workbook) + { + var style = workbook.CreateCellStyle(); + var font = workbook.CreateFont(); + font.IsBold = true; + style.Alignment = HorizontalAlignment.Center; + style.VerticalAlignment = VerticalAlignment.Center; + style.WrapText = true; + style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Gold.Index; + style.FillPattern = FillPattern.SolidForeground; + style.SetFont(font); + if (lastRow > startRow) + { + sheet.AddMergedRegion(new CellRangeAddress(startRow, lastRow, 0, 0)); + + var rowHeader = sheet.CreateRow(startRow); + style.Rotation = 90; + var cell = rowHeader.CreateCell(0); + cell.SetCellValue(name); + cell.CellStyle = style; + + } + else + { + var rowHeader = sheet.CreateRow(startRow); + + var cell = rowHeader.CreateCell(0); + cell.SetCellValue(name); + cell.CellStyle = style; + } + } +} diff --git a/Brizco.Core/EntityServices/ComplexService.cs b/Brizco.Core/EntityServices/ComplexService.cs index 90ad79b..1941bcc 100644 --- a/Brizco.Core/EntityServices/ComplexService.cs +++ b/Brizco.Core/EntityServices/ComplexService.cs @@ -36,6 +36,23 @@ public class ComplexService : IComplexService foreach (var claim in ApplicationClaims.ManagerClaims) await _roleManager.AddClaimAsync(managerRole, claim); + + + var viewOwnerRole = new ApplicationRole + { + ComplexId = complex.Id, + EnglishName = "ViewerOwner", + PersianName = "ناظر", + Description = "ناظر مجموعه", + Name = $"ViewerOwner_{complex.Id.ToString()}" + }; + var createViewerResult = await _roleManager.CreateAsync(viewOwnerRole); + if (!createViewerResult.Succeeded) + throw new AppException(string.Join('|', createViewerResult.Errors)); + + foreach (var claim in ApplicationClaims.ManagerClaims) + await _roleManager.AddClaimAsync(viewOwnerRole, claim); + var superVisorRole = new ApplicationRole { ComplexId = complex.Id, diff --git a/Brizco.Domain/Brizco.Domain.csproj b/Brizco.Domain/Brizco.Domain.csproj index a5e938a..9176cdc 100644 --- a/Brizco.Domain/Brizco.Domain.csproj +++ b/Brizco.Domain/Brizco.Domain.csproj @@ -11,7 +11,7 @@ - + --> diff --git a/Brizco.Domain/CommandQueries/Commands/ShiftPlanCommands.cs b/Brizco.Domain/CommandQueries/Commands/ShiftPlanCommands.cs index d88a68d..69e38f0 100644 --- a/Brizco.Domain/CommandQueries/Commands/ShiftPlanCommands.cs +++ b/Brizco.Domain/CommandQueries/Commands/ShiftPlanCommands.cs @@ -1,9 +1,9 @@ namespace Brizco.Domain.CommandQueries.Commands; -public record CreateShiftPlanCommand(long PlanDate,Guid ShiftId,Guid RoutineId, List> UserAndPositionIds) +public record CreateShiftPlanCommand(long PlanDate,Guid ShiftId,Guid RoutineId,Guid SupervisionUserId, List> UserAndPositionIds) :IRequest; -public record UpdateShiftPlanCommand(Guid Id,long PlanDate, Guid ShiftId, Guid RoutineId, List> UserAndPositionIds) +public record UpdateShiftPlanCommand(Guid Id,long PlanDate, Guid ShiftId, Guid RoutineId, Guid SupervisionUserId, List> UserAndPositionIds) : IRequest; public record DeleteShiftPlanCommand(Guid Id) diff --git a/Brizco.Domain/Dtos/LargDtos/ShiftPlanLDto.cs b/Brizco.Domain/Dtos/LargDtos/ShiftPlanLDto.cs index a90d57d..46be1e6 100644 --- a/Brizco.Domain/Dtos/LargDtos/ShiftPlanLDto.cs +++ b/Brizco.Domain/Dtos/LargDtos/ShiftPlanLDto.cs @@ -6,9 +6,11 @@ public class ShiftPlanLDto : BaseDto { public DateTime PlanFor { get; set; } public Guid RoutineId { get; set; } - public bool IsCompleted { get; internal set; } - public int CompletePercent { get; internal set; } - public string CompleteDescription { get; internal set; } = string.Empty; + public bool IsCompleted { get; set; } + public int CompletePercent { get; set; } + public string CompleteDescription { get; set; } = string.Empty; public Guid ShiftId { get; set; } public List Users { get; set; } = new(); + public Guid SupervisorId { get; set; } + public string SupervisorFullName { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs b/Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs index ea6009f..c3fa89e 100644 --- a/Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs +++ b/Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs @@ -5,5 +5,6 @@ namespace Brizco.Domain.Dtos.SmallDtos; public class TaskPositionSDto : BaseDto { public Guid PositionId { get; set; } + public string PositionName { get; set; } = string.Empty; public Guid TaskId { get; set; } } \ No newline at end of file diff --git a/Brizco.Domain/Dtos/SmallDtos/TaskShiftSDto.cs b/Brizco.Domain/Dtos/SmallDtos/TaskShiftSDto.cs index 3bf410a..3c74483 100644 --- a/Brizco.Domain/Dtos/SmallDtos/TaskShiftSDto.cs +++ b/Brizco.Domain/Dtos/SmallDtos/TaskShiftSDto.cs @@ -1,7 +1,9 @@ namespace Brizco.Domain.Dtos.SmallDtos; -public class TaskShiftSDto +public class TaskShiftSDto : BaseDto { public Guid ShiftId { get; set; } + public string ShiftName { get; set; } = string.Empty; public Guid TaskId { get; set; } + public string TaskTitle { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs b/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs index da97850..b3a650b 100644 --- a/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs +++ b/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs @@ -14,9 +14,9 @@ public partial class Shift this.Days.Add(shiftDay); return shiftDay; } - public ShiftPlan AddPlan(DateTime planDate,Guid routineId) + public ShiftPlan AddPlan(DateTime planDate,Guid routineId , Guid superVisorId) { - var plan = new ShiftPlan(planDate , routineId, Id ,this.ComplexId); + var plan = new ShiftPlan(planDate , routineId, Id, superVisorId, this.ComplexId); Plans.Add(plan); return plan; } diff --git a/Brizco.Domain/Entities/Shift/ShiftPlan.cs b/Brizco.Domain/Entities/Shift/ShiftPlan.cs index a159c93..4b18e4d 100644 --- a/Brizco.Domain/Entities/Shift/ShiftPlan.cs +++ b/Brizco.Domain/Entities/Shift/ShiftPlan.cs @@ -1,4 +1,6 @@ -namespace Brizco.Domain.Entities.Shift; +using Brizco.Domain.Entities.User; + +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)] @@ -11,11 +13,12 @@ public partial class ShiftPlan : ApiEntity } - internal ShiftPlan(DateTime planFor, Guid routineId,Guid shiftId, Guid complexId) + internal ShiftPlan(DateTime planFor, Guid routineId,Guid shiftId,Guid supervisionId, Guid complexId) { PlanFor = planFor; RoutineId = routineId; ShiftId = shiftId; + SupervisorId = supervisionId; ComplexId = complexId; } public DateTime PlanFor { get; internal set; } @@ -33,5 +36,8 @@ public partial class ShiftPlan : ApiEntity public Guid ComplexId { get; internal set; } public Complex.Complex? Complex { get; internal set; } + public Guid SupervisorId { get; internal set; } + public ApplicationUser? Supervisor { get; internal set; } + public List Users { get; internal set; } = new(); } \ No newline at end of file diff --git a/Brizco.Domain/Mappers/ShiftPlanMapper.g.cs b/Brizco.Domain/Mappers/ShiftPlanMapper.g.cs index bff8cf5..d60323d 100644 --- a/Brizco.Domain/Mappers/ShiftPlanMapper.g.cs +++ b/Brizco.Domain/Mappers/ShiftPlanMapper.g.cs @@ -4,7 +4,10 @@ using System.Linq; using System.Linq.Expressions; using Brizco.Domain.Dtos.LargDtos; using Brizco.Domain.Dtos.SmallDtos; +using Brizco.Domain.Entities.Routine; using Brizco.Domain.Entities.Shift; +using Brizco.Domain.Entities.User; +using Mapster.Models; namespace Brizco.Domain.Mappers { @@ -98,7 +101,11 @@ namespace Brizco.Domain.Mappers CompletePercent = p9.CompletePercent, CompleteDescription = p9.CompleteDescription, ShiftId = p9.ShiftId, + Shift = new Shift() {Id = p9.ShiftId}, RoutineId = p9.RoutineId, + Routine = new Routine() {Id = p9.RoutineId}, + SupervisorId = p9.SupervisorId, + Supervisor = new ApplicationUser() {Id = p9.SupervisorId}, Users = funcMain1(p9.Users), Id = p9.Id }; @@ -116,61 +123,71 @@ namespace Brizco.Domain.Mappers result.CompletePercent = p11.CompletePercent; result.CompleteDescription = p11.CompleteDescription; result.ShiftId = p11.ShiftId; + result.Shift = funcMain2(new Never(), result.Shift, p11); result.RoutineId = p11.RoutineId; - result.Users = funcMain2(p11.Users, result.Users); + result.Routine = funcMain3(new Never(), result.Routine, p11); + result.SupervisorId = p11.SupervisorId; + result.Supervisor = funcMain4(new Never(), result.Supervisor, p11); + result.Users = funcMain5(p11.Users, result.Users); result.Id = p11.Id; return result; } - public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p15) + public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p21) { - return p15 == null ? null : new ShiftPlanLDto() + return p21 == null ? null : new ShiftPlanLDto() { - PlanFor = p15.PlanFor, - RoutineId = p15.RoutineId, - IsCompleted = p15.IsCompleted, - CompletePercent = p15.CompletePercent, - CompleteDescription = p15.CompleteDescription, - ShiftId = p15.ShiftId, - Users = funcMain3(p15.Users), - Id = p15.Id + PlanFor = p21.PlanFor, + RoutineId = p21.RoutineId, + IsCompleted = p21.IsCompleted, + CompletePercent = p21.CompletePercent, + CompleteDescription = p21.CompleteDescription, + ShiftId = p21.ShiftId, + Users = funcMain6(p21.Users), + SupervisorId = p21.SupervisorId, + SupervisorFullName = p21.Supervisor != null ? p21.Supervisor.FirstName + " " + p21.Supervisor.LastName : string.Empty, + Id = p21.Id }; } - public static ShiftPlanLDto AdaptTo(this ShiftPlan p17, ShiftPlanLDto p18) + public static ShiftPlanLDto AdaptTo(this ShiftPlan p23, ShiftPlanLDto p24) { - if (p17 == null) + if (p23 == null) { return null; } - ShiftPlanLDto result = p18 ?? new ShiftPlanLDto(); + ShiftPlanLDto result = p24 ?? new ShiftPlanLDto(); - result.PlanFor = p17.PlanFor; - result.RoutineId = p17.RoutineId; - result.IsCompleted = p17.IsCompleted; - result.CompletePercent = p17.CompletePercent; - result.CompleteDescription = p17.CompleteDescription; - result.ShiftId = p17.ShiftId; - result.Users = funcMain4(p17.Users, result.Users); - result.Id = p17.Id; + result.PlanFor = p23.PlanFor; + result.RoutineId = p23.RoutineId; + result.IsCompleted = p23.IsCompleted; + result.CompletePercent = p23.CompletePercent; + result.CompleteDescription = p23.CompleteDescription; + result.ShiftId = p23.ShiftId; + result.Users = funcMain7(p23.Users, result.Users); + result.SupervisorId = p23.SupervisorId; + result.SupervisorFullName = p23.Supervisor != null ? p23.Supervisor.FirstName + " " + p23.Supervisor.LastName : string.Empty; + result.Id = p23.Id; return result; } - public static Expression> ProjectToLDto => p21 => new ShiftPlanLDto() + public static Expression> ProjectToLDto => p27 => new ShiftPlanLDto() { - PlanFor = p21.PlanFor, - RoutineId = p21.RoutineId, - IsCompleted = p21.IsCompleted, - CompletePercent = p21.CompletePercent, - CompleteDescription = p21.CompleteDescription, - ShiftId = p21.ShiftId, - Users = p21.Users.Select(p22 => new ShiftPlanUserSDto() + PlanFor = p27.PlanFor, + RoutineId = p27.RoutineId, + IsCompleted = p27.IsCompleted, + CompletePercent = p27.CompletePercent, + CompleteDescription = p27.CompleteDescription, + ShiftId = p27.ShiftId, + Users = p27.Users.Select(p28 => new ShiftPlanUserSDto() { - ShiftPlanId = p22.ShiftPlanId, - UserId = p22.UserId, - PositionId = p22.PositionId, - Id = p22.Id + ShiftPlanId = p28.ShiftPlanId, + UserId = p28.UserId, + PositionId = p28.PositionId, + Id = p28.Id }).ToList(), - Id = p21.Id + SupervisorId = p27.SupervisorId, + SupervisorFullName = p27.Supervisor != null ? p27.Supervisor.FirstName + " " + p27.Supervisor.LastName : string.Empty, + Id = p27.Id }; private static List funcMain1(List p10) @@ -200,20 +217,47 @@ namespace Brizco.Domain.Mappers } - private static List funcMain2(List p13, List p14) + private static Shift funcMain2(Never p13, Shift p14, ShiftPlanLDto p11) { - if (p13 == null) + Shift result = p14 ?? new Shift(); + + result.Id = p11.ShiftId; + return result; + + } + + private static Routine funcMain3(Never p15, Routine p16, ShiftPlanLDto p11) + { + Routine result = p16 ?? new Routine(); + + result.Id = p11.RoutineId; + return result; + + } + + private static ApplicationUser funcMain4(Never p17, ApplicationUser p18, ShiftPlanLDto p11) + { + ApplicationUser result = p18 ?? new ApplicationUser(); + + result.Id = p11.SupervisorId; + return result; + + } + + private static List funcMain5(List p19, List p20) + { + if (p19 == null) { return null; } - List result = new List(p13.Count); + List result = new List(p19.Count); int i = 0; - int len = p13.Count; + int len = p19.Count; while (i < len) { - ShiftPlanUserSDto item = p13[i]; + ShiftPlanUserSDto item = p19[i]; result.Add(item == null ? null : new ShiftPlanUser() { ShiftPlanId = item.ShiftPlanId, @@ -227,20 +271,20 @@ namespace Brizco.Domain.Mappers } - private static List funcMain3(List p16) + private static List funcMain6(List p22) { - if (p16 == null) + if (p22 == null) { return null; } - List result = new List(p16.Count); + List result = new List(p22.Count); int i = 0; - int len = p16.Count; + int len = p22.Count; while (i < len) { - ShiftPlanUser item = p16[i]; + ShiftPlanUser item = p22[i]; result.Add(item == null ? null : new ShiftPlanUserSDto() { ShiftPlanId = item.ShiftPlanId, @@ -254,20 +298,20 @@ namespace Brizco.Domain.Mappers } - private static List funcMain4(List p19, List p20) + private static List funcMain7(List p25, List p26) { - if (p19 == null) + if (p25 == null) { return null; } - List result = new List(p19.Count); + List result = new List(p25.Count); int i = 0; - int len = p19.Count; + int len = p25.Count; while (i < len) { - ShiftPlanUser item = p19[i]; + ShiftPlanUser item = p25[i]; result.Add(item == null ? null : new ShiftPlanUserSDto() { ShiftPlanId = item.ShiftPlanId, diff --git a/Brizco.Domain/Mappers/TaskMapper.g.cs b/Brizco.Domain/Mappers/TaskMapper.g.cs index b51c4a8..866fa14 100644 --- a/Brizco.Domain/Mappers/TaskMapper.g.cs +++ b/Brizco.Domain/Mappers/TaskMapper.g.cs @@ -6,6 +6,7 @@ using Brizco.Common.Extensions; using Brizco.Domain.Dtos.LargDtos; using Brizco.Domain.Dtos.SmallDtos; using Brizco.Domain.Entities.Complex; +using Brizco.Domain.Entities.Shift; using Brizco.Domain.Entities.Task; using Mapster.Models; using Task = Brizco.Domain.Entities.Task.Task; @@ -245,11 +246,15 @@ namespace Brizco.Domain.Mappers Shifts = p62.Shifts.Select(p63 => new TaskShiftSDto() { ShiftId = p63.ShiftId, - TaskId = p63.TaskId + ShiftName = p63.Shift != null ? p63.Shift.Title : string.Empty, + TaskId = p63.TaskId, + TaskTitle = p63.Task != null ? p63.Task.Title : string.Empty, + Id = p63.Id }).ToList(), Positions = p62.Positions.Select(p64 => new TaskPositionSDto() { PositionId = p64.PositionId, + PositionName = p64.Position != null ? p64.Position.Name : string.Empty, TaskId = p64.TaskId, Id = p64.Id }).ToList(), @@ -549,7 +554,14 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskShift() { TaskId = item.TaskId, - ShiftId = item.ShiftId + Task = new Task() + { + Title = item.TaskTitle, + Id = item.TaskId + }, + ShiftId = item.ShiftId, + Shift = new Shift() {Id = item.ShiftId}, + Id = item.Id }); i++; } @@ -626,7 +638,13 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskPosition() { PositionId = item.PositionId, + Position = new Position() + { + Name = item.PositionName, + Id = item.PositionId + }, TaskId = item.TaskId, + Task = new Task() {Id = item.TaskId}, Id = item.Id }); i++; @@ -652,7 +670,14 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskShift() { TaskId = item.TaskId, - ShiftId = item.ShiftId + Task = new Task() + { + Title = item.TaskTitle, + Id = item.TaskId + }, + ShiftId = item.ShiftId, + Shift = new Shift() {Id = item.ShiftId}, + Id = item.Id }); i++; } @@ -729,7 +754,13 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskPosition() { PositionId = item.PositionId, + Position = new Position() + { + Name = item.PositionName, + Id = item.PositionId + }, TaskId = item.TaskId, + Task = new Task() {Id = item.TaskId}, Id = item.Id }); i++; @@ -755,7 +786,10 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskShiftSDto() { ShiftId = item.ShiftId, - TaskId = item.TaskId + ShiftName = item.Shift != null ? item.Shift.Title : string.Empty, + TaskId = item.TaskId, + TaskTitle = item.Task != null ? item.Task.Title : string.Empty, + Id = item.Id }); i++; } @@ -780,6 +814,7 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskPositionSDto() { PositionId = item.PositionId, + PositionName = item.Position != null ? item.Position.Name : string.Empty, TaskId = item.TaskId, Id = item.Id }); @@ -858,7 +893,10 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskShiftSDto() { ShiftId = item.ShiftId, - TaskId = item.TaskId + ShiftName = item.Shift != null ? item.Shift.Title : string.Empty, + TaskId = item.TaskId, + TaskTitle = item.Task != null ? item.Task.Title : string.Empty, + Id = item.Id }); i++; } @@ -883,6 +921,7 @@ namespace Brizco.Domain.Mappers result.Add(item == null ? null : new TaskPositionSDto() { PositionId = item.PositionId, + PositionName = item.Position != null ? item.Position.Name : string.Empty, TaskId = item.TaskId, Id = item.Id }); diff --git a/Brizco.Domain/Mappers/TaskPositionMapper.g.cs b/Brizco.Domain/Mappers/TaskPositionMapper.g.cs index 7f8fd68..def20a6 100644 --- a/Brizco.Domain/Mappers/TaskPositionMapper.g.cs +++ b/Brizco.Domain/Mappers/TaskPositionMapper.g.cs @@ -1,7 +1,10 @@ using System; using System.Linq.Expressions; using Brizco.Domain.Dtos.SmallDtos; +using Brizco.Domain.Entities.Complex; using Brizco.Domain.Entities.Task; +using Mapster.Models; +using Task = Brizco.Domain.Entities.Task.Task; namespace Brizco.Domain.Mappers { @@ -12,7 +15,13 @@ namespace Brizco.Domain.Mappers return p1 == null ? null : new TaskPosition() { PositionId = p1.PositionId, + Position = new Position() + { + Name = p1.PositionName, + Id = p1.PositionId + }, TaskId = p1.TaskId, + Task = new Task() {Id = p1.TaskId}, Id = p1.Id }; } @@ -25,45 +34,75 @@ namespace Brizco.Domain.Mappers TaskPosition result = p3 ?? new TaskPosition(); result.PositionId = p2.PositionId; + result.Position = funcMain1(new Never(), result.Position, p2); result.TaskId = p2.TaskId; + result.Task = funcMain2(new Never(), result.Task, p2); result.Id = p2.Id; return result; } - public static Expression> ProjectToTaskPosition => p4 => new TaskPosition() + public static Expression> ProjectToTaskPosition => p8 => new TaskPosition() { - PositionId = p4.PositionId, - TaskId = p4.TaskId, - Id = p4.Id - }; - public static TaskPositionSDto AdaptToSDto(this TaskPosition p5) - { - return p5 == null ? null : new TaskPositionSDto() + PositionId = p8.PositionId, + Position = new Position() { - PositionId = p5.PositionId, - TaskId = p5.TaskId, - Id = p5.Id + Name = p8.PositionName, + Id = p8.PositionId + }, + TaskId = p8.TaskId, + Task = new Task() {Id = p8.TaskId}, + Id = p8.Id + }; + public static TaskPositionSDto AdaptToSDto(this TaskPosition p9) + { + return p9 == null ? null : new TaskPositionSDto() + { + PositionId = p9.PositionId, + PositionName = p9.Position != null ? p9.Position.Name : string.Empty, + TaskId = p9.TaskId, + Id = p9.Id }; } - public static TaskPositionSDto AdaptTo(this TaskPosition p6, TaskPositionSDto p7) + public static TaskPositionSDto AdaptTo(this TaskPosition p10, TaskPositionSDto p11) { - if (p6 == null) + if (p10 == null) { return null; } - TaskPositionSDto result = p7 ?? new TaskPositionSDto(); + TaskPositionSDto result = p11 ?? new TaskPositionSDto(); - result.PositionId = p6.PositionId; - result.TaskId = p6.TaskId; - result.Id = p6.Id; + result.PositionId = p10.PositionId; + result.PositionName = p10.Position != null ? p10.Position.Name : string.Empty; + result.TaskId = p10.TaskId; + result.Id = p10.Id; return result; } - public static Expression> ProjectToSDto => p8 => new TaskPositionSDto() + public static Expression> ProjectToSDto => p12 => new TaskPositionSDto() { - PositionId = p8.PositionId, - TaskId = p8.TaskId, - Id = p8.Id + PositionId = p12.PositionId, + PositionName = p12.Position != null ? p12.Position.Name : string.Empty, + TaskId = p12.TaskId, + Id = p12.Id }; + + private static Position funcMain1(Never p4, Position p5, TaskPositionSDto p2) + { + Position result = p5 ?? new Position(); + + result.Name = p2.PositionName; + result.Id = p2.PositionId; + return result; + + } + + private static Task funcMain2(Never p6, Task p7, TaskPositionSDto p2) + { + Task result = p7 ?? new Task(); + + result.Id = p2.TaskId; + return result; + + } } } \ No newline at end of file diff --git a/Brizco.Domain/Mappers/TaskShiftMapper.g.cs b/Brizco.Domain/Mappers/TaskShiftMapper.g.cs index 202af45..c3d8642 100644 --- a/Brizco.Domain/Mappers/TaskShiftMapper.g.cs +++ b/Brizco.Domain/Mappers/TaskShiftMapper.g.cs @@ -1,7 +1,10 @@ using System; using System.Linq.Expressions; using Brizco.Domain.Dtos.SmallDtos; +using Brizco.Domain.Entities.Shift; using Brizco.Domain.Entities.Task; +using Mapster.Models; +using Task = Brizco.Domain.Entities.Task.Task; namespace Brizco.Domain.Mappers { @@ -12,7 +15,14 @@ namespace Brizco.Domain.Mappers return p1 == null ? null : new TaskShift() { TaskId = p1.TaskId, - ShiftId = p1.ShiftId + Task = new Task() + { + Title = p1.TaskTitle, + Id = p1.TaskId + }, + ShiftId = p1.ShiftId, + Shift = new Shift() {Id = p1.ShiftId}, + Id = p1.Id }; } public static TaskShift AdaptTo(this TaskShiftSDto p2, TaskShift p3) @@ -24,40 +34,78 @@ namespace Brizco.Domain.Mappers TaskShift result = p3 ?? new TaskShift(); result.TaskId = p2.TaskId; + result.Task = funcMain1(new Never(), result.Task, p2); result.ShiftId = p2.ShiftId; + result.Shift = funcMain2(new Never(), result.Shift, p2); + result.Id = p2.Id; return result; } - public static Expression> ProjectToTaskShift => p4 => new TaskShift() + public static Expression> ProjectToTaskShift => p8 => new TaskShift() { - TaskId = p4.TaskId, - ShiftId = p4.ShiftId - }; - public static TaskShiftSDto AdaptToSDto(this TaskShift p5) - { - return p5 == null ? null : new TaskShiftSDto() + TaskId = p8.TaskId, + Task = new Task() { - ShiftId = p5.ShiftId, - TaskId = p5.TaskId + Title = p8.TaskTitle, + Id = p8.TaskId + }, + ShiftId = p8.ShiftId, + Shift = new Shift() {Id = p8.ShiftId}, + Id = p8.Id + }; + public static TaskShiftSDto AdaptToSDto(this TaskShift p9) + { + return p9 == null ? null : new TaskShiftSDto() + { + ShiftId = p9.ShiftId, + ShiftName = p9.Shift != null ? p9.Shift.Title : string.Empty, + TaskId = p9.TaskId, + TaskTitle = p9.Task != null ? p9.Task.Title : string.Empty, + Id = p9.Id }; } - public static TaskShiftSDto AdaptTo(this TaskShift p6, TaskShiftSDto p7) + public static TaskShiftSDto AdaptTo(this TaskShift p10, TaskShiftSDto p11) { - if (p6 == null) + if (p10 == null) { return null; } - TaskShiftSDto result = p7 ?? new TaskShiftSDto(); + TaskShiftSDto result = p11 ?? new TaskShiftSDto(); - result.ShiftId = p6.ShiftId; - result.TaskId = p6.TaskId; + result.ShiftId = p10.ShiftId; + result.ShiftName = p10.Shift != null ? p10.Shift.Title : string.Empty; + result.TaskId = p10.TaskId; + result.TaskTitle = p10.Task != null ? p10.Task.Title : string.Empty; + result.Id = p10.Id; return result; } - public static Expression> ProjectToSDto => p8 => new TaskShiftSDto() + public static Expression> ProjectToSDto => p12 => new TaskShiftSDto() { - ShiftId = p8.ShiftId, - TaskId = p8.TaskId + ShiftId = p12.ShiftId, + ShiftName = p12.Shift != null ? p12.Shift.Title : string.Empty, + TaskId = p12.TaskId, + TaskTitle = p12.Task != null ? p12.Task.Title : string.Empty, + Id = p12.Id }; + + private static Task funcMain1(Never p4, Task p5, TaskShiftSDto p2) + { + Task result = p5 ?? new Task(); + + result.Title = p2.TaskTitle; + result.Id = p2.TaskId; + return result; + + } + + private static Shift funcMain2(Never p6, Shift p7, TaskShiftSDto p2) + { + Shift result = p7 ?? new Shift(); + + result.Id = p2.ShiftId; + return result; + + } } } \ No newline at end of file diff --git a/Brizco.Domain/MapsterRegister.cs b/Brizco.Domain/MapsterRegister.cs index f86a754..aa16e34 100644 --- a/Brizco.Domain/MapsterRegister.cs +++ b/Brizco.Domain/MapsterRegister.cs @@ -13,6 +13,15 @@ public class MapsterRegister : IRegister .Map("Positions", o => o.Positions.Select(d => d.Position != null ? d.Position.Name : string.Empty)) .TwoWays(); + config.NewConfig() + .Map("ShiftName", o => o.Shift != null ? o.Shift.Title : string.Empty) + .Map("TaskTitle", o => o.Task != null ? o.Task.Title : string.Empty) + .TwoWays(); + + config.NewConfig() + .Map("PositionName", o => o.Position != null ? o.Position.Name : string.Empty) + .TwoWays(); + config.NewConfig() .Map("UserFirstName", o => o.User !=null ? o.User.FirstName : string.Empty) .Map("UserLastName", o => o.User != null ? o.User.LastName : string.Empty) @@ -31,6 +40,10 @@ public class MapsterRegister : IRegister .Map("Days", o => o.Days.Select(d => d.DayOfWeek).ToList()) .TwoWays(); + config.NewConfig() + .Map("SupervisorFullName", o => o.Supervisor != null ? o.Supervisor.FirstName + " " + o.Supervisor.LastName : string.Empty) + .TwoWays(); + config.NewConfig() .Map("RoleName", org => org.Role!.PersianName) .TwoWays(); diff --git a/Brizco.Repository/Brizco.Repository.csproj b/Brizco.Repository/Brizco.Repository.csproj index 9a14425..65a1def 100644 --- a/Brizco.Repository/Brizco.Repository.csproj +++ b/Brizco.Repository/Brizco.Repository.csproj @@ -8,22 +8,22 @@ - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + diff --git a/Brizco.Repository/Extensions/ModelBuilderExtensions.cs b/Brizco.Repository/Extensions/ModelBuilderExtensions.cs index eb23de4..61c39a4 100644 --- a/Brizco.Repository/Extensions/ModelBuilderExtensions.cs +++ b/Brizco.Repository/Extensions/ModelBuilderExtensions.cs @@ -79,7 +79,10 @@ public static class ModelBuilderExtensions .SelectMany(t => t.GetForeignKeys()) .Where(fk => !fk.IsOwnership && fk.DeleteBehavior == DeleteBehavior.Cascade); foreach (var fk in cascadeFKs) + { fk.DeleteBehavior = DeleteBehavior.Restrict; + fk.IsRequired = false; + } } /// diff --git a/Brizco.Repository/Handlers/ShiftPlan/CreateShiftPlanCommandHandler.cs b/Brizco.Repository/Handlers/ShiftPlan/CreateShiftPlanCommandHandler.cs index ae05e16..4a5bdcc 100644 --- a/Brizco.Repository/Handlers/ShiftPlan/CreateShiftPlanCommandHandler.cs +++ b/Brizco.Repository/Handlers/ShiftPlan/CreateShiftPlanCommandHandler.cs @@ -29,7 +29,7 @@ public class CreateShiftPlanCommandHandler : IRequestHandler +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("20240214082856_EditShiftPlanAddSuperVisior")] + partial class EditShiftPlanAddSuperVisior + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("SupportPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Complexes", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("UserId"); + + b.ToTable("ComplexUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexUserId"); + + b.HasIndex("RoleId"); + + b.ToTable("ComplexUserRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("SectionId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("SectionId"); + + b.ToTable("Positions", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Sections", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Routines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("interval"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("StartAt") + .HasColumnType("interval"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Shifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CompleteDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("CompletePercent") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsCompleted") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PlanFor") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("SupervisorId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("RoutineId"); + + b.HasIndex("ShiftId"); + + b.HasIndex("SupervisorId"); + + b.ToTable("ShiftPlans", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftPlanId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.HasIndex("ShiftPlanId"); + + b.HasIndex("UserId"); + + b.ToTable("ShiftPlanUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoutineId"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftRoutines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("character varying(8)"); + + b.Property("HasDisposed") + .HasColumnType("boolean"); + + b.Property("IsActivity") + .HasColumnType("boolean"); + + b.Property("IsDisposable") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ScheduleType") + .HasColumnType("integer"); + + b.Property("SetFor") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Tasks", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Task"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskPositions", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoutineId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskRoutines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskShifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SelectedComplexUserRoleId") + .HasColumnType("uuid"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasBaseType("Brizco.Domain.Entities.Task.Task"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsDone") + .HasColumnType("boolean"); + + b.Property("PerformanceDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UnDoneReason") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasIndex("ShiftId"); + + b.HasIndex("UserId"); + + b.HasDiscriminator().HasValue("Activity"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Users") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser") + .WithMany("Roles") + .HasForeignKey("ComplexUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ComplexUser"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Complex.Section", "Section") + .WithMany("Positions") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("Section"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + 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") + .WithMany("Days") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany() + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Plans") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "Supervisor") + .WithMany() + .HasForeignKey("SupervisorId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("Routine"); + + b.Navigation("Shift"); + + b.Navigation("Supervisor"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") + .WithMany("Users") + .HasForeignKey("ShiftPlanId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Position"); + + b.Navigation("ShiftPlan"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b => + { + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany("Shifts") + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Routines") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Routine"); + + b.Navigation("Shift"); + }); + + 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.TaskDay", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Days") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Positions") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Position"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b => + { + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany("Tasks") + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Routines") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Routine"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Shifts") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + + b.Navigation("Task"); + }); + + 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", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + + b.Navigation("User"); + }); + + 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.Complex.ComplexUser", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.Navigation("Positions"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.Navigation("Shifts"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Navigation("Days"); + + b.Navigation("Plans"); + + b.Navigation("Routines"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Navigation("Days"); + + b.Navigation("Positions"); + + b.Navigation("Routines"); + + b.Navigation("Shifts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Brizco.Repository/Migrations/20240214082856_EditShiftPlanAddSuperVisior.cs b/Brizco.Repository/Migrations/20240214082856_EditShiftPlanAddSuperVisior.cs new file mode 100644 index 0000000..57cd883 --- /dev/null +++ b/Brizco.Repository/Migrations/20240214082856_EditShiftPlanAddSuperVisior.cs @@ -0,0 +1,1018 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + /// + public partial class EditShiftPlanAddSuperVisior : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskShifts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskShifts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskShifts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Tasks", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Tasks", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Tasks", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskRoutines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskRoutines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskRoutines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskPositions", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskPositions", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskPositions", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskDays", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskDays", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskDays", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Shifts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Shifts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Shifts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftRoutines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftRoutines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftRoutines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftPlanUsers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftPlanUsers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftPlanUsers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftPlans", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftPlans", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftPlans", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AddColumn( + name: "SupervisorId", + schema: "public", + table: "ShiftPlans", + type: "uuid", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftDays", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftDays", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftDays", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Sections", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Sections", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Sections", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Routines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Routines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Routines", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Positions", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Positions", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Positions", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ComplexUsers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ComplexUsers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ComplexUsers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ComplexUserRoles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ComplexUserRoles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ComplexUserRoles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Complexes", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Complexes", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Complexes", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.CreateIndex( + name: "IX_ShiftPlans_SupervisorId", + schema: "public", + table: "ShiftPlans", + column: "SupervisorId"); + + migrationBuilder.AddForeignKey( + name: "FK_ShiftPlans_Users_SupervisorId", + schema: "public", + table: "ShiftPlans", + column: "SupervisorId", + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ShiftPlans_Users_SupervisorId", + schema: "public", + table: "ShiftPlans"); + + migrationBuilder.DropIndex( + name: "IX_ShiftPlans_SupervisorId", + schema: "public", + table: "ShiftPlans"); + + migrationBuilder.DropColumn( + name: "SupervisorId", + schema: "public", + table: "ShiftPlans"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskShifts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskShifts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskShifts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Tasks", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Tasks", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Tasks", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskRoutines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskRoutines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskRoutines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskPositions", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskPositions", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskPositions", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "TaskDays", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "TaskDays", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "TaskDays", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Shifts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Shifts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Shifts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftRoutines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftRoutines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftRoutines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftPlanUsers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftPlanUsers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftPlanUsers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftPlans", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftPlans", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftPlans", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ShiftDays", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ShiftDays", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ShiftDays", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Sections", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Sections", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Sections", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Routines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Routines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Routines", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Positions", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Positions", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Positions", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ComplexUsers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ComplexUsers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ComplexUsers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ComplexUserRoles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ComplexUserRoles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ComplexUserRoles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Complexes", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Complexes", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Complexes", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + } + } +} diff --git a/Brizco.Repository/Migrations/20240214083408_EditShiftPlanAddSuperVisiorB.Designer.cs b/Brizco.Repository/Migrations/20240214083408_EditShiftPlanAddSuperVisiorB.Designer.cs new file mode 100644 index 0000000..4d903e6 --- /dev/null +++ b/Brizco.Repository/Migrations/20240214083408_EditShiftPlanAddSuperVisiorB.Designer.cs @@ -0,0 +1,1451 @@ +// +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("20240214083408_EditShiftPlanAddSuperVisiorB")] + partial class EditShiftPlanAddSuperVisiorB + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("SupportPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Complexes", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("UserId"); + + b.ToTable("ComplexUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexUserId"); + + b.HasIndex("RoleId"); + + b.ToTable("ComplexUserRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("SectionId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("SectionId"); + + b.ToTable("Positions", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Sections", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Routines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("interval"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("StartAt") + .HasColumnType("interval"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Shifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CompleteDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("CompletePercent") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsCompleted") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PlanFor") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("SupervisorId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("RoutineId"); + + b.HasIndex("ShiftId"); + + b.HasIndex("SupervisorId"); + + b.ToTable("ShiftPlans", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftPlanId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.HasIndex("ShiftPlanId"); + + b.HasIndex("UserId"); + + b.ToTable("ShiftPlanUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoutineId"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftRoutines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("character varying(8)"); + + b.Property("HasDisposed") + .HasColumnType("boolean"); + + b.Property("IsActivity") + .HasColumnType("boolean"); + + b.Property("IsDisposable") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ScheduleType") + .HasColumnType("integer"); + + b.Property("SetFor") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Tasks", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Task"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskPositions", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoutineId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskRoutines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskShifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SelectedComplexUserRoleId") + .HasColumnType("uuid"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasBaseType("Brizco.Domain.Entities.Task.Task"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsDone") + .HasColumnType("boolean"); + + b.Property("PerformanceDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UnDoneReason") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasIndex("ShiftId"); + + b.HasIndex("UserId"); + + b.HasDiscriminator().HasValue("Activity"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Users") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser") + .WithMany("Roles") + .HasForeignKey("ComplexUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ComplexUser"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Complex.Section", "Section") + .WithMany("Positions") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("Section"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + 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") + .WithMany("Days") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany() + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Plans") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "Supervisor") + .WithMany() + .HasForeignKey("SupervisorId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("Routine"); + + b.Navigation("Shift"); + + b.Navigation("Supervisor"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") + .WithMany("Users") + .HasForeignKey("ShiftPlanId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Position"); + + b.Navigation("ShiftPlan"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b => + { + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany("Shifts") + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Routines") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Routine"); + + b.Navigation("Shift"); + }); + + 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.TaskDay", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Days") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Positions") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Position"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b => + { + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany("Tasks") + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Routines") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Routine"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Shifts") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + + b.Navigation("Task"); + }); + + 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", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + + b.Navigation("User"); + }); + + 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.Complex.ComplexUser", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.Navigation("Positions"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.Navigation("Shifts"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Navigation("Days"); + + b.Navigation("Plans"); + + b.Navigation("Routines"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Navigation("Days"); + + b.Navigation("Positions"); + + b.Navigation("Routines"); + + b.Navigation("Shifts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Brizco.Repository/Migrations/20240214083408_EditShiftPlanAddSuperVisiorB.cs b/Brizco.Repository/Migrations/20240214083408_EditShiftPlanAddSuperVisiorB.cs new file mode 100644 index 0000000..ad43bb9 --- /dev/null +++ b/Brizco.Repository/Migrations/20240214083408_EditShiftPlanAddSuperVisiorB.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + /// + public partial class EditShiftPlanAddSuperVisiorB : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Brizco.Repository/Migrations/20240214171859_EditForeignKey.Designer.cs b/Brizco.Repository/Migrations/20240214171859_EditForeignKey.Designer.cs new file mode 100644 index 0000000..819ee94 --- /dev/null +++ b/Brizco.Repository/Migrations/20240214171859_EditForeignKey.Designer.cs @@ -0,0 +1,1416 @@ +// +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("20240214171859_EditForeignKey")] + partial class EditForeignKey + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("SupportPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Complexes", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("UserId"); + + b.ToTable("ComplexUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexUserId"); + + b.HasIndex("RoleId"); + + b.ToTable("ComplexUserRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("SectionId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("SectionId"); + + b.ToTable("Positions", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Sections", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Routines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("interval"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("StartAt") + .HasColumnType("interval"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Shifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CompleteDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("CompletePercent") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsCompleted") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PlanFor") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("SupervisorId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("RoutineId"); + + b.HasIndex("ShiftId"); + + b.HasIndex("SupervisorId"); + + b.ToTable("ShiftPlans", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftPlanId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.HasIndex("ShiftPlanId"); + + b.HasIndex("UserId"); + + b.ToTable("ShiftPlanUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoutineId"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftRoutines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("character varying(8)"); + + b.Property("HasDisposed") + .HasColumnType("boolean"); + + b.Property("IsActivity") + .HasColumnType("boolean"); + + b.Property("IsDisposable") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ScheduleType") + .HasColumnType("integer"); + + b.Property("SetFor") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Tasks", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Task"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskPositions", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("RoutineId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoutineId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskRoutines", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskShifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SelectedComplexUserRoleId") + .HasColumnType("uuid"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasBaseType("Brizco.Domain.Entities.Task.Task"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsDone") + .HasColumnType("boolean"); + + b.Property("PerformanceDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UnDoneReason") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasIndex("ShiftId"); + + b.HasIndex("UserId"); + + b.HasDiscriminator().HasValue("Activity"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Users") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser") + .WithMany("Roles") + .HasForeignKey("ComplexUserId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ComplexUser"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Complex.Section", "Section") + .WithMany("Positions") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + + b.Navigation("Section"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Shifts") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Days") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany() + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany() + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Plans") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "Supervisor") + .WithMany() + .HasForeignKey("SupervisorId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + + b.Navigation("Routine"); + + b.Navigation("Shift"); + + b.Navigation("Supervisor"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") + .WithMany("Users") + .HasForeignKey("ShiftPlanId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Position"); + + b.Navigation("ShiftPlan"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b => + { + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany("Shifts") + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Routines") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Routine"); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Tasks") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Days") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Positions") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Position"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b => + { + b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") + .WithMany("Tasks") + .HasForeignKey("RoutineId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Routines") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Routine"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Shifts") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Shift"); + + b.Navigation("Task"); + }); + + 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", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Shift"); + + b.Navigation("User"); + }); + + 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.Complex.ComplexUser", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => + { + b.Navigation("Positions"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b => + { + b.Navigation("Shifts"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Navigation("Days"); + + b.Navigation("Plans"); + + b.Navigation("Routines"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Navigation("Days"); + + b.Navigation("Positions"); + + b.Navigation("Routines"); + + b.Navigation("Shifts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Brizco.Repository/Migrations/20240214171859_EditForeignKey.cs b/Brizco.Repository/Migrations/20240214171859_EditForeignKey.cs new file mode 100644 index 0000000..f9ecedb --- /dev/null +++ b/Brizco.Repository/Migrations/20240214171859_EditForeignKey.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + /// + public partial class EditForeignKey : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs index d822c6d..09721e0 100644 --- a/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -37,7 +37,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -47,7 +46,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -58,7 +56,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("SupportPhone") @@ -83,7 +80,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -93,14 +89,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("UserId") @@ -128,7 +122,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -138,14 +131,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("RoleId") @@ -173,7 +164,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -187,7 +177,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -198,7 +187,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("SectionId") @@ -226,7 +214,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -240,7 +227,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -251,7 +237,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -274,7 +259,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -288,7 +272,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -299,7 +282,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -322,7 +304,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -339,14 +320,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("StartAt") @@ -373,7 +352,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("DayOfWeek") @@ -386,14 +364,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("ShiftId") @@ -426,7 +402,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsCompleted") @@ -439,7 +414,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("PlanFor") @@ -449,7 +423,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("RoutineId") @@ -458,6 +431,9 @@ namespace Brizco.Repository.Migrations b.Property("ShiftId") .HasColumnType("uuid"); + b.Property("SupervisorId") + .HasColumnType("uuid"); + b.HasKey("Id"); b.HasIndex("ComplexId"); @@ -466,6 +442,8 @@ namespace Brizco.Repository.Migrations b.HasIndex("ShiftId"); + b.HasIndex("SupervisorId"); + b.ToTable("ShiftPlans", "public"); }); @@ -479,7 +457,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -489,7 +466,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("PositionId") @@ -499,7 +475,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("ShiftPlanId") @@ -529,7 +504,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -539,14 +513,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("RoutineId") @@ -583,7 +555,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -611,14 +582,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("ScheduleType") @@ -655,7 +624,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("DayOfWeek") @@ -668,14 +636,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("TaskId") @@ -698,7 +664,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -708,7 +673,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("PositionId") @@ -718,7 +682,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("TaskId") @@ -743,7 +706,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -753,14 +715,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("RoutineId") @@ -788,7 +748,6 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") - .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -798,14 +757,12 @@ namespace Brizco.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") - .IsRequired() .HasColumnType("text"); b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") - .IsRequired() .HasColumnType("text"); b.Property("ShiftId") @@ -1098,14 +1055,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany("Users") .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); @@ -1117,14 +1072,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser") .WithMany("Roles") .HasForeignKey("ComplexUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("ComplexUser"); @@ -1136,14 +1089,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany() .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Complex.Section", "Section") .WithMany("Positions") .HasForeignKey("SectionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); @@ -1155,8 +1106,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany() .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); }); @@ -1166,8 +1116,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany() .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); }); @@ -1177,8 +1126,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany("Shifts") .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); }); @@ -1188,8 +1136,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") .WithMany("Days") .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Shift"); }); @@ -1199,26 +1146,30 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany() .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") .WithMany() .HasForeignKey("RoutineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") .WithMany("Plans") .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "Supervisor") + .WithMany() + .HasForeignKey("SupervisorId") + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); b.Navigation("Routine"); b.Navigation("Shift"); + + b.Navigation("Supervisor"); }); modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => @@ -1226,20 +1177,17 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") .WithMany() .HasForeignKey("PositionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") .WithMany("Users") .HasForeignKey("ShiftPlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Position"); @@ -1253,14 +1201,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") .WithMany("Shifts") .HasForeignKey("RoutineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") .WithMany("Routines") .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Routine"); @@ -1272,8 +1218,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") .WithMany("Tasks") .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Complex"); }); @@ -1283,8 +1228,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") .WithMany("Days") .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Task"); }); @@ -1294,14 +1238,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") .WithMany() .HasForeignKey("PositionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") .WithMany("Positions") .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Position"); @@ -1313,14 +1255,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine") .WithMany("Tasks") .HasForeignKey("RoutineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") .WithMany("Routines") .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Routine"); @@ -1332,14 +1272,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") .WithMany() .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") .WithMany("Shifts") .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Shift"); @@ -1360,8 +1298,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => @@ -1369,8 +1306,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => @@ -1378,8 +1314,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => @@ -1387,14 +1322,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => @@ -1402,8 +1335,7 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => @@ -1411,14 +1343,12 @@ namespace Brizco.Repository.Migrations b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") .WithMany() .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); b.Navigation("Shift");