From 574e3eae621747d4d401c74afd1840d09fbb17b5 Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Mon, 13 Nov 2023 14:42:49 +0330 Subject: [PATCH] feat : edit infra --- Brizco.Api/Controllers/PositionController.cs | 6 + Brizco.Api/Controllers/SectionController.cs | 6 + .../Models/Claims/ApplicationClaims.cs | 39 + .../Models/Claims/ApplicationPermission.cs | 4 + Brizco.Core/EntityServices/ComplexService.cs | 32 + Brizco.Domain/Brizco.Domain.csproj | 3 + .../Commands/ActivityCommands.cs | 10 +- .../Commands/PositionCommands.cs | 6 + .../CommandQueries/Commands/SectionCommand.cs | 6 + .../CommandQueries/Commands/ShiftCommands.cs | 4 +- .../CommandQueries/Commands/TaskCommands.cs | 12 +- Brizco.Domain/Dtos/LargDtos/ActivityLDto.cs | 3 - Brizco.Domain/Dtos/LargDtos/TaskLDto.cs | 6 +- Brizco.Domain/Dtos/SmallDtos/ActivitySDto.cs | 3 - .../{TaskRoleSDto.cs => TaskPositionSDto.cs} | 4 +- Brizco.Domain/Dtos/SmallDtos/TaskSDto.cs | 3 - Brizco.Domain/Dtos/SmallDtos/TaskUserSDto.cs | 7 - .../Entities/Complex/Aggregate.Complex.cs | 30 + Brizco.Domain/Entities/Complex/Position.cs | 28 + .../Entities/Complex/PositionUser.cs | 23 + Brizco.Domain/Entities/Complex/Section.cs | 24 + .../Entities/Routine/Aggregate.Routine.cs | 16 + Brizco.Domain/Entities/Routine/Routine.cs | 27 + .../Entities/Shift/Aggregate.Shift.cs | 6 + Brizco.Domain/Entities/Shift/Shift.cs | 2 + Brizco.Domain/Entities/Shift/ShiftDay.cs | 20 + Brizco.Domain/Entities/Shift/ShiftRoutine.cs | 21 + Brizco.Domain/Entities/Task/Activity.cs | 4 +- Brizco.Domain/Entities/Task/Aggregate.Task.cs | 55 +- Brizco.Domain/Entities/Task/Task.cs | 11 +- .../Task/{TaskRole.cs => TaskPosition.cs} | 14 +- Brizco.Domain/Entities/Task/TaskRoutine.cs | 24 + Brizco.Domain/Entities/Task/TaskUser.cs | 23 - Brizco.Domain/Mappers/ActivityMapper.g.cs | 24 - Brizco.Domain/Mappers/PositionMapper.g.cs | 6 + Brizco.Domain/Mappers/PositionUserMapper.g.cs | 6 + Brizco.Domain/Mappers/RoutineMapper.g.cs | 6 + Brizco.Domain/Mappers/SectionMapper.g.cs | 6 + Brizco.Domain/Mappers/ShiftRoutineMapper.g.cs | 6 + Brizco.Domain/Mappers/TaskMapper.g.cs | 424 +++--- Brizco.Domain/Mappers/TaskPositionMapper.g.cs | 69 + Brizco.Domain/Mappers/TaskRoleMapper.g.cs | 69 - Brizco.Domain/Mappers/TaskRoutineMapper.g.cs | 6 + Brizco.Domain/Mappers/TaskUserMapper.g.cs | 63 - .../Activity/CreateActivityCommandHandler.cs | 25 +- .../Activity/UpdateActivityCommandHandler.cs | 2 - .../Shift/CreateShiftCommandHandler.cs | 2 + .../Handlers/Shift/GetShiftQueryHandler.cs | 1 + .../Shift/UpdateShiftCommandHandler.cs | 24 +- .../Handlers/Task/CreateTaskCommandHandler.cs | 23 +- .../Handlers/Task/UpdateTaskCommandHandler.cs | 3 - .../20230920133908_Init.Designer.cs | 1082 ---------------- .../20231015082502_editTask.Designer.cs | 1138 ----------------- .../Migrations/20231015082502_editTask.cs | 57 - ...31018090720_editUserNationalId.Designer.cs | 1138 ----------------- .../20231018090720_editUserNationalId.cs | 30 - .../Migrations/20231025193834_editUser.cs | 32 - .../20231104072034_editShift.Designer.cs | 1079 ---------------- .../Migrations/20231104072034_editShift.cs | 95 -- ...ner.cs => 20231113110204_init.Designer.cs} | 509 ++++++-- ...0133908_Init.cs => 20231113110204_init.cs} | 410 +++++- .../ApplicationContextModelSnapshot.cs | 549 ++++++-- 62 files changed, 1884 insertions(+), 5482 deletions(-) create mode 100644 Brizco.Api/Controllers/PositionController.cs create mode 100644 Brizco.Api/Controllers/SectionController.cs create mode 100644 Brizco.Domain/CommandQueries/Commands/PositionCommands.cs create mode 100644 Brizco.Domain/CommandQueries/Commands/SectionCommand.cs rename Brizco.Domain/Dtos/SmallDtos/{TaskRoleSDto.cs => TaskPositionSDto.cs} (50%) delete mode 100644 Brizco.Domain/Dtos/SmallDtos/TaskUserSDto.cs create mode 100644 Brizco.Domain/Entities/Complex/Position.cs create mode 100644 Brizco.Domain/Entities/Complex/PositionUser.cs create mode 100644 Brizco.Domain/Entities/Complex/Section.cs create mode 100644 Brizco.Domain/Entities/Routine/Aggregate.Routine.cs create mode 100644 Brizco.Domain/Entities/Routine/Routine.cs create mode 100644 Brizco.Domain/Entities/Shift/ShiftDay.cs create mode 100644 Brizco.Domain/Entities/Shift/ShiftRoutine.cs rename Brizco.Domain/Entities/Task/{TaskRole.cs => TaskPosition.cs} (55%) create mode 100644 Brizco.Domain/Entities/Task/TaskRoutine.cs delete mode 100644 Brizco.Domain/Entities/Task/TaskUser.cs create mode 100644 Brizco.Domain/Mappers/PositionMapper.g.cs create mode 100644 Brizco.Domain/Mappers/PositionUserMapper.g.cs create mode 100644 Brizco.Domain/Mappers/RoutineMapper.g.cs create mode 100644 Brizco.Domain/Mappers/SectionMapper.g.cs create mode 100644 Brizco.Domain/Mappers/ShiftRoutineMapper.g.cs create mode 100644 Brizco.Domain/Mappers/TaskPositionMapper.g.cs delete mode 100644 Brizco.Domain/Mappers/TaskRoleMapper.g.cs create mode 100644 Brizco.Domain/Mappers/TaskRoutineMapper.g.cs delete mode 100644 Brizco.Domain/Mappers/TaskUserMapper.g.cs delete mode 100644 Brizco.Repository/Migrations/20230920133908_Init.Designer.cs delete mode 100644 Brizco.Repository/Migrations/20231015082502_editTask.Designer.cs delete mode 100644 Brizco.Repository/Migrations/20231015082502_editTask.cs delete mode 100644 Brizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs delete mode 100644 Brizco.Repository/Migrations/20231018090720_editUserNationalId.cs delete mode 100644 Brizco.Repository/Migrations/20231025193834_editUser.cs delete mode 100644 Brizco.Repository/Migrations/20231104072034_editShift.Designer.cs delete mode 100644 Brizco.Repository/Migrations/20231104072034_editShift.cs rename Brizco.Repository/Migrations/{20231025193834_editUser.Designer.cs => 20231113110204_init.Designer.cs} (75%) rename Brizco.Repository/Migrations/{20230920133908_Init.cs => 20231113110204_init.cs} (70%) diff --git a/Brizco.Api/Controllers/PositionController.cs b/Brizco.Api/Controllers/PositionController.cs new file mode 100644 index 0000000..990ae53 --- /dev/null +++ b/Brizco.Api/Controllers/PositionController.cs @@ -0,0 +1,6 @@ +namespace Brizco.Api.Controllers; + +public class PositionController +{ + +} \ No newline at end of file diff --git a/Brizco.Api/Controllers/SectionController.cs b/Brizco.Api/Controllers/SectionController.cs new file mode 100644 index 0000000..d21f7ec --- /dev/null +++ b/Brizco.Api/Controllers/SectionController.cs @@ -0,0 +1,6 @@ +namespace Brizco.Api.Controllers; + +public class SectionController +{ + +} \ No newline at end of file diff --git a/Brizco.Common/Models/Claims/ApplicationClaims.cs b/Brizco.Common/Models/Claims/ApplicationClaims.cs index 50ca9c0..77f8241 100644 --- a/Brizco.Common/Models/Claims/ApplicationClaims.cs +++ b/Brizco.Common/Models/Claims/ApplicationClaims.cs @@ -18,6 +18,21 @@ public static class ApplicationClaims Detail = "دسترسی به مشاهده مجموعه ها" }; + public static ClaimDto ManageStaffs { get; } = new ClaimDto + { + Type = CustomClaimType.Permission, + Value = ApplicationPermission.ManageStaffs, + Title = "دسترسی کامل به کارکنان", + Detail = "دسترسی به افزودن و مدیریت کارکنان مجموعه" + }; + public static ClaimDto ViewStaffs { get; } = new ClaimDto + { + Type = CustomClaimType.Permission, + Value = ApplicationPermission.ViewStaffs, + Title = "مشاهده کارکنان", + Detail = "دسترسی به مشاهده کارکنان مجموعه" + }; + public static ClaimDto ManageShifts { get; } = new ClaimDto { Type = CustomClaimType.Permission, @@ -78,6 +93,9 @@ public static class ApplicationClaims public static List AllClaims = new List { + ManageStaffs.GetClaim, + ViewStaffs.GetClaim, + ManageActivities.GetClaim, ViewTasks.GetClaim, ManageTasks.GetClaim, @@ -92,6 +110,9 @@ public static class ApplicationClaims public static List ManagerClaims = new List { + ManageStaffs.GetClaim, + ViewStaffs.GetClaim, + ManageActivities.GetClaim, ViewTasks.GetClaim, ManageTasks.GetClaim, @@ -100,4 +121,22 @@ public static class ApplicationClaims ViewShifts.GetClaim, ManageShifts.GetClaim, }; + + + public static List SuperVisorClaims = new List + { + ManageActivities.GetClaim, + ViewTasks.GetClaim, + ManageTasks.GetClaim, + + ManageShiftPlans.GetClaim, + ViewShifts.GetClaim, + ManageShifts.GetClaim, + }; + + public static List StaffClaims = new List + { + ManageActivities.GetClaim, + ViewTasks.GetClaim, + }; } diff --git a/Brizco.Common/Models/Claims/ApplicationPermission.cs b/Brizco.Common/Models/Claims/ApplicationPermission.cs index 5c140ba..e32910e 100644 --- a/Brizco.Common/Models/Claims/ApplicationPermission.cs +++ b/Brizco.Common/Models/Claims/ApplicationPermission.cs @@ -4,6 +4,10 @@ public static class ApplicationPermission public const string ManageComplexes = nameof(ManageComplexes); public const string ViewComplexes = nameof(ViewComplexes); + + public const string ManageStaffs = nameof(ManageStaffs); + public const string ViewStaffs = nameof(ViewStaffs); + public const string ManageShifts = nameof(ManageShifts); public const string ViewShifts = nameof(ViewShifts); public const string ManageShiftPlans = nameof(ManageShiftPlans); diff --git a/Brizco.Core/EntityServices/ComplexService.cs b/Brizco.Core/EntityServices/ComplexService.cs index 7a1e1e6..90ad79b 100644 --- a/Brizco.Core/EntityServices/ComplexService.cs +++ b/Brizco.Core/EntityServices/ComplexService.cs @@ -36,6 +36,38 @@ public class ComplexService : IComplexService foreach (var claim in ApplicationClaims.ManagerClaims) await _roleManager.AddClaimAsync(managerRole, claim); + var superVisorRole = new ApplicationRole + { + ComplexId = complex.Id, + EnglishName = "SuperVisor", + PersianName = "سوپروایزر", + Description = "انجام فعالیت مدیریت کارکنان و وظیفه ها", + Name = $"SuperVisor_{complex.Id.ToString()}" + }; + var superVisorRoleResult = await _roleManager.CreateAsync(superVisorRole); + if (!superVisorRoleResult.Succeeded) + throw new AppException(string.Join('|', superVisorRoleResult.Errors)); + + foreach (var claim in ApplicationClaims.SuperVisorClaims) + await _roleManager.AddClaimAsync(superVisorRole, claim); + + + var staffRole = new ApplicationRole + { + ComplexId = complex.Id, + EnglishName = "Staff", + PersianName = "کارمند", + Description = "انجام فعالیت ها و وظیفه ها", + Name = $"Staff_{complex.Id.ToString()}" + }; + var staffRoleResult = await _roleManager.CreateAsync(staffRole); + if (!staffRoleResult.Succeeded) + throw new AppException(string.Join('|', staffRoleResult.Errors)); + + foreach (var claim in ApplicationClaims.StaffClaims) + await _roleManager.AddClaimAsync(staffRole, claim); + + var complexUser = await _sender.Send(new CreateComplexUserCommand(complex.Id, managerUserId, new List{ managerRole.Id }), cancellationToken); return complex; diff --git a/Brizco.Domain/Brizco.Domain.csproj b/Brizco.Domain/Brizco.Domain.csproj index 0e21ee4..b306b1d 100644 --- a/Brizco.Domain/Brizco.Domain.csproj +++ b/Brizco.Domain/Brizco.Domain.csproj @@ -53,6 +53,9 @@ + + + diff --git a/Brizco.Domain/CommandQueries/Commands/ActivityCommands.cs b/Brizco.Domain/CommandQueries/Commands/ActivityCommands.cs index 61c727c..d05cb4f 100644 --- a/Brizco.Domain/CommandQueries/Commands/ActivityCommands.cs +++ b/Brizco.Domain/CommandQueries/Commands/ActivityCommands.cs @@ -7,16 +7,13 @@ public sealed record CreateActivityCommand( TaskType Type, string Title, string Description, - bool IsRelatedToRole, - bool IsRelatedToPerson, bool IsDisposable, DateTime SetFor, bool HasDisposed, int Amount, PurchaseAmountType AmountType, - List Users, List Shifts, - List Roles) : IRequest; + List Positions) : IRequest; public sealed record UpdateActivityCommand(Guid Id, ActivityStatus Status, @@ -25,16 +22,13 @@ public sealed record UpdateActivityCommand(Guid Id, TaskType Type, string Title, string Description, - bool IsRelatedToRole, - bool IsRelatedToPerson, bool IsDisposable, DateTime SetFor, bool HasDisposed, int Amount, PurchaseAmountType AmountType, - List Users, List Shifts, - List Roles) : IRequest; + List Positions) : IRequest; public sealed record DeleteActivityCommand(Guid Id) diff --git a/Brizco.Domain/CommandQueries/Commands/PositionCommands.cs b/Brizco.Domain/CommandQueries/Commands/PositionCommands.cs new file mode 100644 index 0000000..72975d2 --- /dev/null +++ b/Brizco.Domain/CommandQueries/Commands/PositionCommands.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.CommandQueries.Commands; + +public class PositionCommands +{ + +} \ No newline at end of file diff --git a/Brizco.Domain/CommandQueries/Commands/SectionCommand.cs b/Brizco.Domain/CommandQueries/Commands/SectionCommand.cs new file mode 100644 index 0000000..bc98557 --- /dev/null +++ b/Brizco.Domain/CommandQueries/Commands/SectionCommand.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.CommandQueries.Commands; + +public class SectionCommand +{ + +} \ No newline at end of file diff --git a/Brizco.Domain/CommandQueries/Commands/ShiftCommands.cs b/Brizco.Domain/CommandQueries/Commands/ShiftCommands.cs index ff3a09e..fc5a610 100644 --- a/Brizco.Domain/CommandQueries/Commands/ShiftCommands.cs +++ b/Brizco.Domain/CommandQueries/Commands/ShiftCommands.cs @@ -2,10 +2,10 @@ namespace Brizco.Domain.CommandQueries.Commands; -public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description ) +public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List DayOfWeeks) : IRequest; -public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description) +public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List DayOfWeeks) : IRequest; public sealed record DeleteShiftCommand(Guid Id) diff --git a/Brizco.Domain/CommandQueries/Commands/TaskCommands.cs b/Brizco.Domain/CommandQueries/Commands/TaskCommands.cs index b59d790..ac63dfb 100644 --- a/Brizco.Domain/CommandQueries/Commands/TaskCommands.cs +++ b/Brizco.Domain/CommandQueries/Commands/TaskCommands.cs @@ -3,34 +3,26 @@ public sealed record CreateTaskCommand(TaskType Type, string Title, string Description, -bool IsRelatedToShift, -bool IsRelatedToRole, -bool IsRelatedToPerson, bool IsDisposable, DateTime SetFor, bool HasDisposed, int Amount, PurchaseAmountType AmountType, -List Users, List Shifts, -List Roles, +List Positions, List Days) : IRequest; public sealed record UpdateTaskCommand(Guid Id, TaskType Type, string Title, string Description, - bool IsRelatedToShift, - bool IsRelatedToRole, - bool IsRelatedToPerson, bool IsDisposable, DateTime SetFor, bool HasDisposed, int Amount, PurchaseAmountType AmountType, - List Users, List Shifts, - List Roles, + List Positions, List Days) : IRequest; diff --git a/Brizco.Domain/Dtos/LargDtos/ActivityLDto.cs b/Brizco.Domain/Dtos/LargDtos/ActivityLDto.cs index 079d6f3..e74f096 100644 --- a/Brizco.Domain/Dtos/LargDtos/ActivityLDto.cs +++ b/Brizco.Domain/Dtos/LargDtos/ActivityLDto.cs @@ -7,9 +7,6 @@ public class ActivityLDto : BaseDto public TaskType Type { get; set; } public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; - public bool IsRelatedToShift { get; set; } - public bool IsRelatedToRole { get; set; } - public bool IsRelatedToPerson { get; set; } public bool IsDisposable { get; set; } public DateTime SetFor { get; set; } public bool HasDisposed { get; set; } diff --git a/Brizco.Domain/Dtos/LargDtos/TaskLDto.cs b/Brizco.Domain/Dtos/LargDtos/TaskLDto.cs index aa42e0f..b70c5a1 100644 --- a/Brizco.Domain/Dtos/LargDtos/TaskLDto.cs +++ b/Brizco.Domain/Dtos/LargDtos/TaskLDto.cs @@ -7,9 +7,6 @@ public class TaskLDto : BaseDto public TaskType Type { get; set; } public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; - public bool IsRelatedToShift { get; set; } - public bool IsRelatedToRole { get; set; } - public bool IsRelatedToPerson { get; set; } public bool IsDisposable { get; set; } public DateTime SetFor { get; set; } public bool HasDisposed { get; set; } @@ -19,9 +16,8 @@ public class TaskLDto : BaseDto public PurchaseAmountType AmountType { get; set; } - public List Users { get; set; } = new(); public List Shifts { get; set; } = new(); - public List Roles { get; set; } = new(); + public List Positions { get; set; } = new(); } \ No newline at end of file diff --git a/Brizco.Domain/Dtos/SmallDtos/ActivitySDto.cs b/Brizco.Domain/Dtos/SmallDtos/ActivitySDto.cs index 7ff5438..47d9f8a 100644 --- a/Brizco.Domain/Dtos/SmallDtos/ActivitySDto.cs +++ b/Brizco.Domain/Dtos/SmallDtos/ActivitySDto.cs @@ -7,9 +7,6 @@ public class ActivitySDto : BaseDto public TaskType Type { get; internal set; } public string Title { get; internal set; } = string.Empty; public string Description { get; internal set; } = string.Empty; - public bool IsRelatedToShift { get; internal set; } - public bool IsRelatedToRole { get; internal set; } - public bool IsRelatedToPerson { get; internal set; } public bool IsDisposable { get; internal set; } public DateTime SetFor { get; internal set; } public bool HasDisposed { get; internal set; } diff --git a/Brizco.Domain/Dtos/SmallDtos/TaskRoleSDto.cs b/Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs similarity index 50% rename from Brizco.Domain/Dtos/SmallDtos/TaskRoleSDto.cs rename to Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs index 5013ade..ea6009f 100644 --- a/Brizco.Domain/Dtos/SmallDtos/TaskRoleSDto.cs +++ b/Brizco.Domain/Dtos/SmallDtos/TaskPositionSDto.cs @@ -2,8 +2,8 @@ namespace Brizco.Domain.Dtos.SmallDtos; -public class TaskRoleSDto : BaseDto +public class TaskPositionSDto : BaseDto { - public Guid RoleId { get; set; } + public Guid PositionId { get; set; } public Guid TaskId { get; set; } } \ No newline at end of file diff --git a/Brizco.Domain/Dtos/SmallDtos/TaskSDto.cs b/Brizco.Domain/Dtos/SmallDtos/TaskSDto.cs index dc7980c..fe95cfa 100644 --- a/Brizco.Domain/Dtos/SmallDtos/TaskSDto.cs +++ b/Brizco.Domain/Dtos/SmallDtos/TaskSDto.cs @@ -5,9 +5,6 @@ public class TaskSDto : BaseDto public TaskType Type { get; set; } public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; - public bool IsRelatedToShift { get; set; } - public bool IsRelatedToRole { get; set; } - public bool IsRelatedToPerson { get; set; } public bool IsDisposable { get; set; } public DateTime SetFor { get; set; } public bool HasDisposed { get; set; } diff --git a/Brizco.Domain/Dtos/SmallDtos/TaskUserSDto.cs b/Brizco.Domain/Dtos/SmallDtos/TaskUserSDto.cs deleted file mode 100644 index d528f99..0000000 --- a/Brizco.Domain/Dtos/SmallDtos/TaskUserSDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Brizco.Domain.Dtos.SmallDtos; - -public class TaskUserSDto -{ - public Guid UserId { get; set; } - public Guid TaskId { get; set; } -} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Complex/Aggregate.Complex.cs b/Brizco.Domain/Entities/Complex/Aggregate.Complex.cs index 7ca04e3..726387b 100644 --- a/Brizco.Domain/Entities/Complex/Aggregate.Complex.cs +++ b/Brizco.Domain/Entities/Complex/Aggregate.Complex.cs @@ -28,3 +28,33 @@ public partial class ComplexUser return role; } } + +public partial class Section +{ + public static Section Create(string name, string description, Guid complexId) + { + return new Section(name, description, complexId); + } + + public Position AddPosition(string name, string description, Guid complexId) + { + var position = Position.Create(name, description, complexId, this.Id); + this.Positions.Add(position); + return position; + } +} + +public partial class Position +{ + public static Position Create(string name, string description, Guid complexId, Guid sectionId) + { + return new Position(name, description, complexId, sectionId); + } + + public PositionUser AddUser(Guid userId) + { + var positionUser = new PositionUser(this.Id, userId); + this.Users.Add(positionUser); + return positionUser; + } +} diff --git a/Brizco.Domain/Entities/Complex/Position.cs b/Brizco.Domain/Entities/Complex/Position.cs new file mode 100644 index 0000000..9be9250 --- /dev/null +++ b/Brizco.Domain/Entities/Complex/Position.cs @@ -0,0 +1,28 @@ +namespace Brizco.Domain.Entities.Complex; + +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public partial class Position : ApiEntity +{ + public Position() + { + + } + public Position(string name, string description, Guid complexId, Guid sectionId) + { + Name = name; + Description = description; + ComplexId = complexId; + SectionId = sectionId; + } + public string Name { get; internal set; } = string.Empty; + public string Description { get; internal set; } = string.Empty; + + public Guid ComplexId { get; set; } + public Complex? Complex { get; set; } + + public Guid SectionId { get; set; } + public Section? Section { get; set; } + + public List Users { get; internal set; } = new(); +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Complex/PositionUser.cs b/Brizco.Domain/Entities/Complex/PositionUser.cs new file mode 100644 index 0000000..fa23878 --- /dev/null +++ b/Brizco.Domain/Entities/Complex/PositionUser.cs @@ -0,0 +1,23 @@ +using Brizco.Domain.Entities.User; + +namespace Brizco.Domain.Entities.Complex; +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public class PositionUser : ApiEntity +{ + public PositionUser() + { + + } + public PositionUser(Guid positionId,Guid applicationUserId) + { + ApplicationUserId = applicationUserId; + PositionId = positionId; + } + + public Guid ApplicationUserId { get; set; } + public ApplicationUser? ApplicationUser { get; set; } + + public Guid PositionId { get; set; } + public Position? Position { get; set; } +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Complex/Section.cs b/Brizco.Domain/Entities/Complex/Section.cs new file mode 100644 index 0000000..6fa03ce --- /dev/null +++ b/Brizco.Domain/Entities/Complex/Section.cs @@ -0,0 +1,24 @@ +namespace Brizco.Domain.Entities.Complex; + +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public partial class Section : ApiEntity +{ + public Section() + { + + } + public Section(string name, string description, Guid complexId) + { + Name = name; + Description = description; + ComplexId = complexId; + } + public string Name { get; internal set; } = string.Empty; + public string Description { get; internal set; } = string.Empty; + + public Guid ComplexId { get; set; } + public Complex? Complex { get; set; } + + public List Positions { get; internal set; } = new(); +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Routine/Aggregate.Routine.cs b/Brizco.Domain/Entities/Routine/Aggregate.Routine.cs new file mode 100644 index 0000000..06d24a6 --- /dev/null +++ b/Brizco.Domain/Entities/Routine/Aggregate.Routine.cs @@ -0,0 +1,16 @@ +namespace Brizco.Domain.Entities.Routine; + +public partial class Routine +{ + public static Routine Create(string name, string description, Guid complexId) + { + return new Routine(name, description, complexId); + } + + public ShiftRoutine AddShift(Guid shiftId) + { + var shift = new ShiftRoutine(this.Id, shiftId); + this.Shifts.Add(shift); + return shift; + } +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Routine/Routine.cs b/Brizco.Domain/Entities/Routine/Routine.cs new file mode 100644 index 0000000..6f31cb1 --- /dev/null +++ b/Brizco.Domain/Entities/Routine/Routine.cs @@ -0,0 +1,27 @@ +namespace Brizco.Domain.Entities.Routine; + +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public partial class Routine : ApiEntity +{ + public Routine() + { + + } + public Routine(string name,string description,Guid complexId) + { + Name = name; + Description = description; + ComplexId = complexId; + } + public string Name { get; internal set; } = string.Empty; + public string Description { get; internal set; } = string.Empty; + + public Guid ComplexId { get; internal set; } + public Complex.Complex? Complex { get; internal set; } + + + public List Tasks { get; internal set; } = new(); + public List Shifts { get; internal set; } = new(); +} \ 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 5f01f30..8a8379b 100644 --- a/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs +++ b/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs @@ -8,6 +8,12 @@ public partial class Shift return new Shift(title, description, startAt, endAt,complexId); } + public ShiftDay SetDay(DayOfWeek dayOfWeek) + { + var shiftDay = new ShiftDay(dayOfWeek, this.Id); + this.Days.Add(shiftDay); + return shiftDay; + } public ShiftPlan AddPlan(DateTime planDate) { var plan = new ShiftPlan(planDate , Id); diff --git a/Brizco.Domain/Entities/Shift/Shift.cs b/Brizco.Domain/Entities/Shift/Shift.cs index 793aefd..e1dd0ce 100644 --- a/Brizco.Domain/Entities/Shift/Shift.cs +++ b/Brizco.Domain/Entities/Shift/Shift.cs @@ -23,5 +23,7 @@ public partial class Shift : ApiEntity public Guid ComplexId { get; set; } public Complex.Complex? Complex { get; set; } + public List Days { get; internal set; } = new(); public List Plans { get; internal set; } = new(); + public List Routines { get; internal set; } = new(); } \ No newline at end of file diff --git a/Brizco.Domain/Entities/Shift/ShiftDay.cs b/Brizco.Domain/Entities/Shift/ShiftDay.cs new file mode 100644 index 0000000..4da281c --- /dev/null +++ b/Brizco.Domain/Entities/Shift/ShiftDay.cs @@ -0,0 +1,20 @@ +namespace Brizco.Domain.Entities.Shift; + +public class ShiftDay : ApiEntity +{ + public ShiftDay() + { + + } + + internal ShiftDay(DayOfWeek dayOfWeek, Guid shiftId) + { + DayOfWeek = dayOfWeek; + ShiftId = shiftId; + } + + public DayOfWeek DayOfWeek { get; internal set; } + + public Guid ShiftId { get; internal set; } + public Shift? Shift { get; internal set; } +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Shift/ShiftRoutine.cs b/Brizco.Domain/Entities/Shift/ShiftRoutine.cs new file mode 100644 index 0000000..0ed79b0 --- /dev/null +++ b/Brizco.Domain/Entities/Shift/ShiftRoutine.cs @@ -0,0 +1,21 @@ +namespace Brizco.Domain.Entities.Shift; + +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public class ShiftRoutine : ApiEntity +{ + public ShiftRoutine() + { + + } + public ShiftRoutine(Guid routineId, Guid shiftId) + { + RoutineId = routineId; + ShiftId = shiftId; + } + public Guid RoutineId { get; set; } + public Routine.Routine? Routine { get; set; } + + public Guid ShiftId { get; set; } + public Shift? Shift { get; set; } +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Task/Activity.cs b/Brizco.Domain/Entities/Task/Activity.cs index ed304dc..3b1067c 100644 --- a/Brizco.Domain/Entities/Task/Activity.cs +++ b/Brizco.Domain/Entities/Task/Activity.cs @@ -15,8 +15,6 @@ public partial class Activity : Task DateTime doneAt, string performanceDescription, TaskType type, - bool isRelatedToRole, - bool isRelatedToPerson, bool isDisposable, DateTime setFor, bool hasDisposed, @@ -25,7 +23,7 @@ public partial class Activity : Task string title, string description, Guid complexId) : base( - type,isRelatedToRole, isRelatedToPerson, isDisposable, setFor, hasDisposed, amount, amountType, title, description, complexId) + type, isDisposable, setFor, hasDisposed, amount, amountType, title, description, complexId) { Status = status; DoneAt = doneAt; diff --git a/Brizco.Domain/Entities/Task/Aggregate.Task.cs b/Brizco.Domain/Entities/Task/Aggregate.Task.cs index 9fce992..db1c6bc 100644 --- a/Brizco.Domain/Entities/Task/Aggregate.Task.cs +++ b/Brizco.Domain/Entities/Task/Aggregate.Task.cs @@ -1,4 +1,6 @@ -namespace Brizco.Domain.Entities.Task; +using Brizco.Domain.Entities.Routine; + +namespace Brizco.Domain.Entities.Task; public partial class Task @@ -8,9 +10,6 @@ public partial class Task string title, string description, TaskType type, - bool isRelatedToShift, - bool isRelatedToRole, - bool isRelatedToPerson, bool isDisposable, DateTime setFor, bool hasDisposed, @@ -18,9 +17,8 @@ public partial class Task PurchaseAmountType amountType, Guid complexId) { - return new Task(type, - isRelatedToRole, - isRelatedToPerson, + return new Task( + type, isDisposable, setFor, hasDisposed, @@ -48,6 +46,7 @@ public partial class Task Shifts.Add(plan); } } + public TaskShift AddShift(Guid shiftId) { var plan = new TaskShift(Id, shiftId); @@ -55,35 +54,37 @@ public partial class Task return plan; } - public void AddUser(params Guid[] userIds) + public void AddPosition(params Guid[] positionIds) { - foreach (var userId in userIds) + foreach (var positionId in positionIds) { - var plan = new TaskUser(Id, userId); - Users.Add(plan); + var position = new TaskPosition(Id, positionId); + Positions.Add(position); } } - public TaskUser AddUser(Guid userId) + public TaskPosition AddPosition(Guid positionId) { - var plan = new TaskUser(Id, userId); - Users.Add(plan); - return plan; + var position = new TaskPosition(Id, positionId); + Positions.Add(position); + return position; } - public TaskRole AddRole(Guid roleId) + + + public void AddRoutine(params Guid[] routineIds) { - var plan = new TaskRole(Id, roleId); - Roles.Add(plan); - return plan; - } - public void AddRole(params Guid[] roleIds) - { - foreach (var roleId in roleIds) + foreach (var routineId in routineIds) { - var plan = new TaskRole(Id, roleId); - Roles.Add(plan); + var routine = new TaskRoutine(Id, routineId); + Routines.Add(routine); } } + public TaskRoutine AddRoutine(Guid routineId) + { + var routine = new TaskRoutine(Id, routineId); + Routines.Add(routine); + return routine; + } } public partial class Activity @@ -96,8 +97,6 @@ public partial class Activity string title, string description, TaskType type, - bool isRelatedToRole, - bool isRelatedToPerson, bool isDisposable, DateTime setFor, bool hasDisposed, @@ -110,8 +109,6 @@ public partial class Activity doneAt, performanceDescription, type, - isRelatedToRole, - isRelatedToPerson, isDisposable, setFor, hasDisposed, diff --git a/Brizco.Domain/Entities/Task/Task.cs b/Brizco.Domain/Entities/Task/Task.cs index ad9f6c1..f501a29 100644 --- a/Brizco.Domain/Entities/Task/Task.cs +++ b/Brizco.Domain/Entities/Task/Task.cs @@ -12,8 +12,6 @@ public partial class Task : ApiEntity } internal Task( TaskType type, - bool isRelatedToRole, - bool isRelatedToPerson, bool isDisposable, DateTime setFor, bool hasDisposed, @@ -24,8 +22,6 @@ public partial class Task : ApiEntity Guid complexId) { Type = type; - IsRelatedToRole = isRelatedToRole; - IsRelatedToPerson = isRelatedToPerson; IsDisposable = isDisposable; SetFor = setFor; HasDisposed = hasDisposed; @@ -39,8 +35,6 @@ public partial class Task : ApiEntity public TaskType Type { get; internal set; } public string Title { get; internal set; } = string.Empty; public string Description { get; internal set; } = string.Empty; - public bool IsRelatedToRole { get; internal set; } - public bool IsRelatedToPerson { get; internal set; } public bool IsDisposable { get; internal set; } public DateTime SetFor { get; internal set; } public bool HasDisposed { get; internal set; } @@ -53,11 +47,12 @@ public partial class Task : ApiEntity public PurchaseAmountType AmountType { get; internal set; } - public List Users { get; internal set; } = new(); public List Shifts { get; internal set; } = new(); public List Days { get; internal set; } = new(); - public List Roles { get; internal set; } = new(); + public List Positions { get; internal set; } = new(); + + public List Routines { get; internal set; } = new(); } diff --git a/Brizco.Domain/Entities/Task/TaskRole.cs b/Brizco.Domain/Entities/Task/TaskPosition.cs similarity index 55% rename from Brizco.Domain/Entities/Task/TaskRole.cs rename to Brizco.Domain/Entities/Task/TaskPosition.cs index 50a10cd..73edae2 100644 --- a/Brizco.Domain/Entities/Task/TaskRole.cs +++ b/Brizco.Domain/Entities/Task/TaskPosition.cs @@ -1,23 +1,23 @@ -using Brizco.Domain.Entities.User; +using Brizco.Domain.Entities.Complex; namespace Brizco.Domain.Entities.Task; [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [GenerateMapper] -public class TaskRole : ApiEntity +public class TaskPosition : ApiEntity { - public TaskRole() + public TaskPosition() { } - public TaskRole(Guid roleId, Guid taskId) + public TaskPosition(Guid positionId, Guid taskId) { - RoleId = roleId; + PositionId = positionId; TaskId = taskId; } - public Guid RoleId { get; internal set; } - public virtual ApplicationRole? Role { get; internal set; } + public Guid PositionId { get; internal set; } + public virtual Position? Role { get; internal set; } public Guid TaskId { get; internal set; } public virtual Task? Task { get; internal set; } diff --git a/Brizco.Domain/Entities/Task/TaskRoutine.cs b/Brizco.Domain/Entities/Task/TaskRoutine.cs new file mode 100644 index 0000000..2149bb6 --- /dev/null +++ b/Brizco.Domain/Entities/Task/TaskRoutine.cs @@ -0,0 +1,24 @@ +namespace Brizco.Domain.Entities.Task; + +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public class TaskRoutine : ApiEntity +{ + + public TaskRoutine() + { + + } + + internal TaskRoutine(Guid routineId,Guid taskId) + { + RoutineId = routineId; + TaskId = taskId; + } + + public Guid TaskId { get; internal set; } + public Task? Task { get; internal set; } + + public Guid RoutineId { get; internal set; } + public Routine.Routine? Routine { get; internal set; } +} \ No newline at end of file diff --git a/Brizco.Domain/Entities/Task/TaskUser.cs b/Brizco.Domain/Entities/Task/TaskUser.cs deleted file mode 100644 index 17643f9..0000000 --- a/Brizco.Domain/Entities/Task/TaskUser.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Brizco.Domain.Entities.User; - -namespace Brizco.Domain.Entities.Task; - -[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] -[GenerateMapper] -public class TaskUser : ApiEntity -{ - public TaskUser() - { - - } - - public TaskUser(Guid userId,Guid taskId) - { - UserId = userId; - TaskId = taskId; - } - public Guid UserId { get; internal set; } - public virtual ApplicationUser? User { get; internal set; } - public Guid TaskId { get; internal set; } - public virtual Task? Task { get; internal set; } -} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/ActivityMapper.g.cs b/Brizco.Domain/Mappers/ActivityMapper.g.cs index f93c86a..b8640f6 100644 --- a/Brizco.Domain/Mappers/ActivityMapper.g.cs +++ b/Brizco.Domain/Mappers/ActivityMapper.g.cs @@ -19,8 +19,6 @@ namespace Brizco.Domain.Mappers Type = p1.Type, Title = p1.Title, Description = p1.Description, - IsRelatedToRole = p1.IsRelatedToRole, - IsRelatedToPerson = p1.IsRelatedToPerson, IsDisposable = p1.IsDisposable, SetFor = p1.SetFor, HasDisposed = p1.HasDisposed, @@ -44,8 +42,6 @@ namespace Brizco.Domain.Mappers result.Type = p2.Type; result.Title = p2.Title; result.Description = p2.Description; - result.IsRelatedToRole = p2.IsRelatedToRole; - result.IsRelatedToPerson = p2.IsRelatedToPerson; result.IsDisposable = p2.IsDisposable; result.SetFor = p2.SetFor; result.HasDisposed = p2.HasDisposed; @@ -64,8 +60,6 @@ namespace Brizco.Domain.Mappers Type = p4.Type, Title = p4.Title, Description = p4.Description, - IsRelatedToRole = p4.IsRelatedToRole, - IsRelatedToPerson = p4.IsRelatedToPerson, IsDisposable = p4.IsDisposable, SetFor = p4.SetFor, HasDisposed = p4.HasDisposed, @@ -80,8 +74,6 @@ namespace Brizco.Domain.Mappers Type = p5.Type, Title = p5.Title, Description = p5.Description, - IsRelatedToRole = p5.IsRelatedToRole, - IsRelatedToPerson = p5.IsRelatedToPerson, IsDisposable = p5.IsDisposable, SetFor = p5.SetFor, HasDisposed = p5.HasDisposed, @@ -105,8 +97,6 @@ namespace Brizco.Domain.Mappers result.Type = p6.Type; result.Title = p6.Title; result.Description = p6.Description; - result.IsRelatedToRole = p6.IsRelatedToRole; - result.IsRelatedToPerson = p6.IsRelatedToPerson; result.IsDisposable = p6.IsDisposable; result.SetFor = p6.SetFor; result.HasDisposed = p6.HasDisposed; @@ -125,8 +115,6 @@ namespace Brizco.Domain.Mappers Type = p8.Type, Title = p8.Title, Description = p8.Description, - IsRelatedToRole = p8.IsRelatedToRole, - IsRelatedToPerson = p8.IsRelatedToPerson, IsDisposable = p8.IsDisposable, SetFor = p8.SetFor, HasDisposed = p8.HasDisposed, @@ -149,8 +137,6 @@ namespace Brizco.Domain.Mappers Type = p9.Type, Title = p9.Title, Description = p9.Description, - IsRelatedToRole = p9.IsRelatedToRole, - IsRelatedToPerson = p9.IsRelatedToPerson, IsDisposable = p9.IsDisposable, SetFor = p9.SetFor, HasDisposed = p9.HasDisposed, @@ -174,8 +160,6 @@ namespace Brizco.Domain.Mappers result.Type = p10.Type; result.Title = p10.Title; result.Description = p10.Description; - result.IsRelatedToRole = p10.IsRelatedToRole; - result.IsRelatedToPerson = p10.IsRelatedToPerson; result.IsDisposable = p10.IsDisposable; result.SetFor = p10.SetFor; result.HasDisposed = p10.HasDisposed; @@ -194,8 +178,6 @@ namespace Brizco.Domain.Mappers Type = p12.Type, Title = p12.Title, Description = p12.Description, - IsRelatedToRole = p12.IsRelatedToRole, - IsRelatedToPerson = p12.IsRelatedToPerson, IsDisposable = p12.IsDisposable, SetFor = p12.SetFor, HasDisposed = p12.HasDisposed, @@ -210,8 +192,6 @@ namespace Brizco.Domain.Mappers Type = p13.Type, Title = p13.Title, Description = p13.Description, - IsRelatedToRole = p13.IsRelatedToRole, - IsRelatedToPerson = p13.IsRelatedToPerson, IsDisposable = p13.IsDisposable, SetFor = p13.SetFor, HasDisposed = p13.HasDisposed, @@ -235,8 +215,6 @@ namespace Brizco.Domain.Mappers result.Type = p14.Type; result.Title = p14.Title; result.Description = p14.Description; - result.IsRelatedToRole = p14.IsRelatedToRole; - result.IsRelatedToPerson = p14.IsRelatedToPerson; result.IsDisposable = p14.IsDisposable; result.SetFor = p14.SetFor; result.HasDisposed = p14.HasDisposed; @@ -255,8 +233,6 @@ namespace Brizco.Domain.Mappers Type = p16.Type, Title = p16.Title, Description = p16.Description, - IsRelatedToRole = p16.IsRelatedToRole, - IsRelatedToPerson = p16.IsRelatedToPerson, IsDisposable = p16.IsDisposable, SetFor = p16.SetFor, HasDisposed = p16.HasDisposed, diff --git a/Brizco.Domain/Mappers/PositionMapper.g.cs b/Brizco.Domain/Mappers/PositionMapper.g.cs new file mode 100644 index 0000000..571fca8 --- /dev/null +++ b/Brizco.Domain/Mappers/PositionMapper.g.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Mappers +{ + public static partial class PositionMapper + { + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/PositionUserMapper.g.cs b/Brizco.Domain/Mappers/PositionUserMapper.g.cs new file mode 100644 index 0000000..073b042 --- /dev/null +++ b/Brizco.Domain/Mappers/PositionUserMapper.g.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Mappers +{ + public static partial class PositionUserMapper + { + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/RoutineMapper.g.cs b/Brizco.Domain/Mappers/RoutineMapper.g.cs new file mode 100644 index 0000000..dda5115 --- /dev/null +++ b/Brizco.Domain/Mappers/RoutineMapper.g.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Mappers +{ + public static partial class RoutineMapper + { + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/SectionMapper.g.cs b/Brizco.Domain/Mappers/SectionMapper.g.cs new file mode 100644 index 0000000..72484f3 --- /dev/null +++ b/Brizco.Domain/Mappers/SectionMapper.g.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Mappers +{ + public static partial class SectionMapper + { + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/ShiftRoutineMapper.g.cs b/Brizco.Domain/Mappers/ShiftRoutineMapper.g.cs new file mode 100644 index 0000000..913f999 --- /dev/null +++ b/Brizco.Domain/Mappers/ShiftRoutineMapper.g.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Mappers +{ + public static partial class ShiftRoutineMapper + { + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/TaskMapper.g.cs b/Brizco.Domain/Mappers/TaskMapper.g.cs index 05555b8..fb56d77 100644 --- a/Brizco.Domain/Mappers/TaskMapper.g.cs +++ b/Brizco.Domain/Mappers/TaskMapper.g.cs @@ -18,8 +18,6 @@ namespace Brizco.Domain.Mappers Type = p1.Type, Title = p1.Title, Description = p1.Description, - IsRelatedToRole = p1.IsRelatedToRole, - IsRelatedToPerson = p1.IsRelatedToPerson, IsDisposable = p1.IsDisposable, SetFor = p1.SetFor, HasDisposed = p1.HasDisposed, @@ -40,8 +38,6 @@ namespace Brizco.Domain.Mappers result.Type = p2.Type; result.Title = p2.Title; result.Description = p2.Description; - result.IsRelatedToRole = p2.IsRelatedToRole; - result.IsRelatedToPerson = p2.IsRelatedToPerson; result.IsDisposable = p2.IsDisposable; result.SetFor = p2.SetFor; result.HasDisposed = p2.HasDisposed; @@ -57,8 +53,6 @@ namespace Brizco.Domain.Mappers Type = p4.Type, Title = p4.Title, Description = p4.Description, - IsRelatedToRole = p4.IsRelatedToRole, - IsRelatedToPerson = p4.IsRelatedToPerson, IsDisposable = p4.IsDisposable, SetFor = p4.SetFor, HasDisposed = p4.HasDisposed, @@ -74,8 +68,6 @@ namespace Brizco.Domain.Mappers Type = p5.Type, Title = p5.Title, Description = p5.Description, - IsRelatedToRole = p5.IsRelatedToRole, - IsRelatedToPerson = p5.IsRelatedToPerson, IsDisposable = p5.IsDisposable, SetFor = p5.SetFor, HasDisposed = p5.HasDisposed, @@ -96,8 +88,6 @@ namespace Brizco.Domain.Mappers result.Type = p6.Type; result.Title = p6.Title; result.Description = p6.Description; - result.IsRelatedToRole = p6.IsRelatedToRole; - result.IsRelatedToPerson = p6.IsRelatedToPerson; result.IsDisposable = p6.IsDisposable; result.SetFor = p6.SetFor; result.HasDisposed = p6.HasDisposed; @@ -113,8 +103,6 @@ namespace Brizco.Domain.Mappers Type = p8.Type, Title = p8.Title, Description = p8.Description, - IsRelatedToRole = p8.IsRelatedToRole, - IsRelatedToPerson = p8.IsRelatedToPerson, IsDisposable = p8.IsDisposable, SetFor = p8.SetFor, HasDisposed = p8.HasDisposed, @@ -130,168 +118,142 @@ namespace Brizco.Domain.Mappers Type = p9.Type, Title = p9.Title, Description = p9.Description, - IsRelatedToRole = p9.IsRelatedToRole, - IsRelatedToPerson = p9.IsRelatedToPerson, IsDisposable = p9.IsDisposable, SetFor = p9.SetFor, HasDisposed = p9.HasDisposed, Amount = p9.Amount, AmountType = p9.AmountType, - Users = funcMain1(p9.Users), - Shifts = funcMain2(p9.Shifts), - Roles = funcMain3(p9.Roles), + Shifts = funcMain1(p9.Shifts), + Positions = funcMain2(p9.Positions), Id = p9.Id }; } - public static Task AdaptTo(this TaskLDto p13, Task p14) + public static Task AdaptTo(this TaskLDto p12, Task p13) { - if (p13 == null) + if (p12 == null) { return null; } - Task result = p14 ?? new Task(); + Task result = p13 ?? new Task(); - result.Type = p13.Type; - result.Title = p13.Title; - result.Description = p13.Description; - result.IsRelatedToRole = p13.IsRelatedToRole; - result.IsRelatedToPerson = p13.IsRelatedToPerson; - result.IsDisposable = p13.IsDisposable; - result.SetFor = p13.SetFor; - result.HasDisposed = p13.HasDisposed; - result.Amount = p13.Amount; - result.AmountType = p13.AmountType; - result.Users = funcMain4(p13.Users, result.Users); - result.Shifts = funcMain5(p13.Shifts, result.Shifts); - result.Roles = funcMain6(p13.Roles, result.Roles); - result.Id = p13.Id; + result.Type = p12.Type; + result.Title = p12.Title; + result.Description = p12.Description; + result.IsDisposable = p12.IsDisposable; + result.SetFor = p12.SetFor; + result.HasDisposed = p12.HasDisposed; + result.Amount = p12.Amount; + result.AmountType = p12.AmountType; + result.Shifts = funcMain3(p12.Shifts, result.Shifts); + result.Positions = funcMain4(p12.Positions, result.Positions); + result.Id = p12.Id; return result; } - public static Expression> ProjectLDtoToTask => p21 => new Task() + public static Expression> ProjectLDtoToTask => p18 => new Task() { - Type = p21.Type, - Title = p21.Title, - Description = p21.Description, - IsRelatedToRole = p21.IsRelatedToRole, - IsRelatedToPerson = p21.IsRelatedToPerson, - IsDisposable = p21.IsDisposable, - SetFor = p21.SetFor, - HasDisposed = p21.HasDisposed, - Amount = p21.Amount, - AmountType = p21.AmountType, - Users = p21.Users.Select(p22 => new TaskUser() + Type = p18.Type, + Title = p18.Title, + Description = p18.Description, + IsDisposable = p18.IsDisposable, + SetFor = p18.SetFor, + HasDisposed = p18.HasDisposed, + Amount = p18.Amount, + AmountType = p18.AmountType, + Shifts = p18.Shifts.Select(p19 => new TaskShift() { - UserId = p22.UserId, - TaskId = p22.TaskId - }).ToList(), - Shifts = p21.Shifts.Select(p23 => new TaskShift() - { - TaskId = p23.TaskId, - ShiftId = p23.ShiftId + TaskId = p19.TaskId, + ShiftId = p19.ShiftId }).ToList(), - Roles = p21.Roles.Select(p24 => new TaskRole() + Positions = p18.Positions.Select(p20 => new TaskPosition() { - RoleId = p24.RoleId, - TaskId = p24.TaskId, - Id = p24.Id - }).ToList(), - Id = p21.Id + PositionId = p20.PositionId, + TaskId = p20.TaskId, + Id = p20.Id + }).ToList(), + Id = p18.Id }; - public static TaskLDto AdaptToLDto(this Task p25) + public static TaskLDto AdaptToLDto(this Task p21) { - return p25 == null ? null : new TaskLDto() + return p21 == null ? null : new TaskLDto() { - Type = p25.Type, - Title = p25.Title, - Description = p25.Description, - IsRelatedToRole = p25.IsRelatedToRole, - IsRelatedToPerson = p25.IsRelatedToPerson, - IsDisposable = p25.IsDisposable, - SetFor = p25.SetFor, - HasDisposed = p25.HasDisposed, - Amount = p25.Amount, - AmountType = p25.AmountType, - Users = funcMain7(p25.Users), - Shifts = funcMain8(p25.Shifts), - Roles = funcMain9(p25.Roles), - Id = p25.Id + Type = p21.Type, + Title = p21.Title, + Description = p21.Description, + IsDisposable = p21.IsDisposable, + SetFor = p21.SetFor, + HasDisposed = p21.HasDisposed, + Amount = p21.Amount, + AmountType = p21.AmountType, + Shifts = funcMain5(p21.Shifts), + Positions = funcMain6(p21.Positions), + Id = p21.Id }; } - public static TaskLDto AdaptTo(this Task p29, TaskLDto p30) + public static TaskLDto AdaptTo(this Task p24, TaskLDto p25) { - if (p29 == null) + if (p24 == null) { return null; } - TaskLDto result = p30 ?? new TaskLDto(); + TaskLDto result = p25 ?? new TaskLDto(); - result.Type = p29.Type; - result.Title = p29.Title; - result.Description = p29.Description; - result.IsRelatedToRole = p29.IsRelatedToRole; - result.IsRelatedToPerson = p29.IsRelatedToPerson; - result.IsDisposable = p29.IsDisposable; - result.SetFor = p29.SetFor; - result.HasDisposed = p29.HasDisposed; - result.Amount = p29.Amount; - result.AmountType = p29.AmountType; - result.Users = funcMain10(p29.Users, result.Users); - result.Shifts = funcMain11(p29.Shifts, result.Shifts); - result.Roles = funcMain12(p29.Roles, result.Roles); - result.Id = p29.Id; + result.Type = p24.Type; + result.Title = p24.Title; + result.Description = p24.Description; + result.IsDisposable = p24.IsDisposable; + result.SetFor = p24.SetFor; + result.HasDisposed = p24.HasDisposed; + result.Amount = p24.Amount; + result.AmountType = p24.AmountType; + result.Shifts = funcMain7(p24.Shifts, result.Shifts); + result.Positions = funcMain8(p24.Positions, result.Positions); + result.Id = p24.Id; return result; } - public static Expression> ProjectToLDto => p37 => new TaskLDto() + public static Expression> ProjectToLDto => p30 => new TaskLDto() { - Type = p37.Type, - Title = p37.Title, - Description = p37.Description, - IsRelatedToRole = p37.IsRelatedToRole, - IsRelatedToPerson = p37.IsRelatedToPerson, - IsDisposable = p37.IsDisposable, - SetFor = p37.SetFor, - HasDisposed = p37.HasDisposed, - Amount = p37.Amount, - AmountType = p37.AmountType, - Users = p37.Users.Select(p38 => new TaskUserSDto() + Type = p30.Type, + Title = p30.Title, + Description = p30.Description, + IsDisposable = p30.IsDisposable, + SetFor = p30.SetFor, + HasDisposed = p30.HasDisposed, + Amount = p30.Amount, + AmountType = p30.AmountType, + Shifts = p30.Shifts.Select(p31 => new TaskShiftSDto() { - UserId = p38.UserId, - TaskId = p38.TaskId - }).ToList(), - Shifts = p37.Shifts.Select(p39 => new TaskShiftSDto() - { - ShiftId = p39.ShiftId, - TaskId = p39.TaskId + ShiftId = p31.ShiftId, + TaskId = p31.TaskId }).ToList(), - Roles = p37.Roles.Select(p40 => new TaskRoleSDto() + Positions = p30.Positions.Select(p32 => new TaskPositionSDto() { - RoleId = p40.RoleId, - TaskId = p40.TaskId, - Id = p40.Id - }).ToList(), - Id = p37.Id + PositionId = p32.PositionId, + TaskId = p32.TaskId, + Id = p32.Id + }).ToList(), + Id = p30.Id }; - private static List funcMain1(List p10) + private static List funcMain1(List p10) { if (p10 == null) { return null; } - List result = new List(p10.Count); + List result = new List(p10.Count); int i = 0; int len = p10.Count; while (i < len) { - TaskUserSDto item = p10[i]; - result.Add(item == null ? null : new TaskUser() + TaskShiftSDto item = p10[i]; + result.Add(item == null ? null : new TaskShift() { - UserId = item.UserId, - TaskId = item.TaskId + TaskId = item.TaskId, + ShiftId = item.ShiftId }); i++; } @@ -299,20 +261,46 @@ namespace Brizco.Domain.Mappers } - private static List funcMain2(List p11) + private static List funcMain2(List p11) { if (p11 == null) { return null; } - List result = new List(p11.Count); + List result = new List(p11.Count); int i = 0; int len = p11.Count; while (i < len) { - TaskShiftSDto item = p11[i]; + TaskPositionSDto item = p11[i]; + result.Add(item == null ? null : new TaskPosition() + { + PositionId = item.PositionId, + TaskId = item.TaskId, + Id = item.Id + }); + i++; + } + return result; + + } + + private static List funcMain3(List p14, List p15) + { + if (p14 == null) + { + return null; + } + List result = new List(p14.Count); + + int i = 0; + int len = p14.Count; + + while (i < len) + { + TaskShiftSDto item = p14[i]; result.Add(item == null ? null : new TaskShift() { TaskId = item.TaskId, @@ -324,23 +312,23 @@ namespace Brizco.Domain.Mappers } - private static List funcMain3(List p12) + private static List funcMain4(List p16, List p17) { - if (p12 == null) + if (p16 == null) { return null; } - List result = new List(p12.Count); + List result = new List(p16.Count); int i = 0; - int len = p12.Count; + int len = p16.Count; while (i < len) { - TaskRoleSDto item = p12[i]; - result.Add(item == null ? null : new TaskRole() + TaskPositionSDto item = p16[i]; + result.Add(item == null ? null : new TaskPosition() { - RoleId = item.RoleId, + PositionId = item.PositionId, TaskId = item.TaskId, Id = item.Id }); @@ -350,23 +338,23 @@ namespace Brizco.Domain.Mappers } - private static List funcMain4(List p15, List p16) + private static List funcMain5(List p22) { - if (p15 == null) + if (p22 == null) { return null; } - List result = new List(p15.Count); + List result = new List(p22.Count); int i = 0; - int len = p15.Count; + int len = p22.Count; while (i < len) { - TaskUserSDto item = p15[i]; - result.Add(item == null ? null : new TaskUser() + TaskShift item = p22[i]; + result.Add(item == null ? null : new TaskShiftSDto() { - UserId = item.UserId, + ShiftId = item.ShiftId, TaskId = item.TaskId }); i++; @@ -375,48 +363,23 @@ namespace Brizco.Domain.Mappers } - private static List funcMain5(List p17, List p18) + private static List funcMain6(List p23) { - if (p17 == null) + if (p23 == null) { return null; } - List result = new List(p17.Count); + List result = new List(p23.Count); int i = 0; - int len = p17.Count; + int len = p23.Count; while (i < len) { - TaskShiftSDto item = p17[i]; - result.Add(item == null ? null : new TaskShift() + TaskPosition item = p23[i]; + result.Add(item == null ? null : new TaskPositionSDto() { - TaskId = item.TaskId, - ShiftId = item.ShiftId - }); - i++; - } - return result; - - } - - private static List funcMain6(List p19, List p20) - { - if (p19 == null) - { - return null; - } - List result = new List(p19.Count); - - int i = 0; - int len = p19.Count; - - while (i < len) - { - TaskRoleSDto item = p19[i]; - result.Add(item == null ? null : new TaskRole() - { - RoleId = item.RoleId, + PositionId = item.PositionId, TaskId = item.TaskId, Id = item.Id }); @@ -426,45 +389,20 @@ namespace Brizco.Domain.Mappers } - private static List funcMain7(List p26) + private static List funcMain7(List p26, List p27) { if (p26 == null) { return null; } - List result = new List(p26.Count); + List result = new List(p26.Count); int i = 0; int len = p26.Count; while (i < len) { - TaskUser item = p26[i]; - result.Add(item == null ? null : new TaskUserSDto() - { - UserId = item.UserId, - TaskId = item.TaskId - }); - i++; - } - return result; - - } - - private static List funcMain8(List p27) - { - if (p27 == null) - { - return null; - } - List result = new List(p27.Count); - - int i = 0; - int len = p27.Count; - - while (i < len) - { - TaskShift item = p27[i]; + TaskShift item = p26[i]; result.Add(item == null ? null : new TaskShiftSDto() { ShiftId = item.ShiftId, @@ -476,99 +414,23 @@ namespace Brizco.Domain.Mappers } - private static List funcMain9(List p28) + private static List funcMain8(List p28, List p29) { if (p28 == null) { return null; } - List result = new List(p28.Count); + List result = new List(p28.Count); int i = 0; int len = p28.Count; while (i < len) { - TaskRole item = p28[i]; - result.Add(item == null ? null : new TaskRoleSDto() + TaskPosition item = p28[i]; + result.Add(item == null ? null : new TaskPositionSDto() { - RoleId = item.RoleId, - TaskId = item.TaskId, - Id = item.Id - }); - i++; - } - return result; - - } - - private static List funcMain10(List p31, List p32) - { - if (p31 == null) - { - return null; - } - List result = new List(p31.Count); - - int i = 0; - int len = p31.Count; - - while (i < len) - { - TaskUser item = p31[i]; - result.Add(item == null ? null : new TaskUserSDto() - { - UserId = item.UserId, - TaskId = item.TaskId - }); - i++; - } - return result; - - } - - private static List funcMain11(List p33, List p34) - { - if (p33 == null) - { - return null; - } - List result = new List(p33.Count); - - int i = 0; - int len = p33.Count; - - while (i < len) - { - TaskShift item = p33[i]; - result.Add(item == null ? null : new TaskShiftSDto() - { - ShiftId = item.ShiftId, - TaskId = item.TaskId - }); - i++; - } - return result; - - } - - private static List funcMain12(List p35, List p36) - { - if (p35 == null) - { - return null; - } - List result = new List(p35.Count); - - int i = 0; - int len = p35.Count; - - while (i < len) - { - TaskRole item = p35[i]; - result.Add(item == null ? null : new TaskRoleSDto() - { - RoleId = item.RoleId, + PositionId = item.PositionId, TaskId = item.TaskId, Id = item.Id }); diff --git a/Brizco.Domain/Mappers/TaskPositionMapper.g.cs b/Brizco.Domain/Mappers/TaskPositionMapper.g.cs new file mode 100644 index 0000000..7f8fd68 --- /dev/null +++ b/Brizco.Domain/Mappers/TaskPositionMapper.g.cs @@ -0,0 +1,69 @@ +using System; +using System.Linq.Expressions; +using Brizco.Domain.Dtos.SmallDtos; +using Brizco.Domain.Entities.Task; + +namespace Brizco.Domain.Mappers +{ + public static partial class TaskPositionMapper + { + public static TaskPosition AdaptToTaskPosition(this TaskPositionSDto p1) + { + return p1 == null ? null : new TaskPosition() + { + PositionId = p1.PositionId, + TaskId = p1.TaskId, + Id = p1.Id + }; + } + public static TaskPosition AdaptTo(this TaskPositionSDto p2, TaskPosition p3) + { + if (p2 == null) + { + return null; + } + TaskPosition result = p3 ?? new TaskPosition(); + + result.PositionId = p2.PositionId; + result.TaskId = p2.TaskId; + result.Id = p2.Id; + return result; + + } + public static Expression> ProjectToTaskPosition => p4 => 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 = p5.PositionId, + TaskId = p5.TaskId, + Id = p5.Id + }; + } + public static TaskPositionSDto AdaptTo(this TaskPosition p6, TaskPositionSDto p7) + { + if (p6 == null) + { + return null; + } + TaskPositionSDto result = p7 ?? new TaskPositionSDto(); + + result.PositionId = p6.PositionId; + result.TaskId = p6.TaskId; + result.Id = p6.Id; + return result; + + } + public static Expression> ProjectToSDto => p8 => new TaskPositionSDto() + { + PositionId = p8.PositionId, + TaskId = p8.TaskId, + Id = p8.Id + }; + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/TaskRoleMapper.g.cs b/Brizco.Domain/Mappers/TaskRoleMapper.g.cs deleted file mode 100644 index 79ae17a..0000000 --- a/Brizco.Domain/Mappers/TaskRoleMapper.g.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Linq.Expressions; -using Brizco.Domain.Dtos.SmallDtos; -using Brizco.Domain.Entities.Task; - -namespace Brizco.Domain.Mappers -{ - public static partial class TaskRoleMapper - { - public static TaskRole AdaptToTaskRole(this TaskRoleSDto p1) - { - return p1 == null ? null : new TaskRole() - { - RoleId = p1.RoleId, - TaskId = p1.TaskId, - Id = p1.Id - }; - } - public static TaskRole AdaptTo(this TaskRoleSDto p2, TaskRole p3) - { - if (p2 == null) - { - return null; - } - TaskRole result = p3 ?? new TaskRole(); - - result.RoleId = p2.RoleId; - result.TaskId = p2.TaskId; - result.Id = p2.Id; - return result; - - } - public static Expression> ProjectToTaskRole => p4 => new TaskRole() - { - RoleId = p4.RoleId, - TaskId = p4.TaskId, - Id = p4.Id - }; - public static TaskRoleSDto AdaptToSDto(this TaskRole p5) - { - return p5 == null ? null : new TaskRoleSDto() - { - RoleId = p5.RoleId, - TaskId = p5.TaskId, - Id = p5.Id - }; - } - public static TaskRoleSDto AdaptTo(this TaskRole p6, TaskRoleSDto p7) - { - if (p6 == null) - { - return null; - } - TaskRoleSDto result = p7 ?? new TaskRoleSDto(); - - result.RoleId = p6.RoleId; - result.TaskId = p6.TaskId; - result.Id = p6.Id; - return result; - - } - public static Expression> ProjectToSDto => p8 => new TaskRoleSDto() - { - RoleId = p8.RoleId, - TaskId = p8.TaskId, - Id = p8.Id - }; - } -} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/TaskRoutineMapper.g.cs b/Brizco.Domain/Mappers/TaskRoutineMapper.g.cs new file mode 100644 index 0000000..83c0b94 --- /dev/null +++ b/Brizco.Domain/Mappers/TaskRoutineMapper.g.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Mappers +{ + public static partial class TaskRoutineMapper + { + } +} \ No newline at end of file diff --git a/Brizco.Domain/Mappers/TaskUserMapper.g.cs b/Brizco.Domain/Mappers/TaskUserMapper.g.cs deleted file mode 100644 index 58301c6..0000000 --- a/Brizco.Domain/Mappers/TaskUserMapper.g.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Linq.Expressions; -using Brizco.Domain.Dtos.SmallDtos; -using Brizco.Domain.Entities.Task; - -namespace Brizco.Domain.Mappers -{ - public static partial class TaskUserMapper - { - public static TaskUser AdaptToTaskUser(this TaskUserSDto p1) - { - return p1 == null ? null : new TaskUser() - { - UserId = p1.UserId, - TaskId = p1.TaskId - }; - } - public static TaskUser AdaptTo(this TaskUserSDto p2, TaskUser p3) - { - if (p2 == null) - { - return null; - } - TaskUser result = p3 ?? new TaskUser(); - - result.UserId = p2.UserId; - result.TaskId = p2.TaskId; - return result; - - } - public static Expression> ProjectToTaskUser => p4 => new TaskUser() - { - UserId = p4.UserId, - TaskId = p4.TaskId - }; - public static TaskUserSDto AdaptToSDto(this TaskUser p5) - { - return p5 == null ? null : new TaskUserSDto() - { - UserId = p5.UserId, - TaskId = p5.TaskId - }; - } - public static TaskUserSDto AdaptTo(this TaskUser p6, TaskUserSDto p7) - { - if (p6 == null) - { - return null; - } - TaskUserSDto result = p7 ?? new TaskUserSDto(); - - result.UserId = p6.UserId; - result.TaskId = p6.TaskId; - return result; - - } - public static Expression> ProjectToSDto => p8 => new TaskUserSDto() - { - UserId = p8.UserId, - TaskId = p8.TaskId - }; - } -} \ No newline at end of file diff --git a/Brizco.Repository/Handlers/Activity/CreateActivityCommandHandler.cs b/Brizco.Repository/Handlers/Activity/CreateActivityCommandHandler.cs index 44611e2..c16f63e 100644 --- a/Brizco.Repository/Handlers/Activity/CreateActivityCommandHandler.cs +++ b/Brizco.Repository/Handlers/Activity/CreateActivityCommandHandler.cs @@ -28,8 +28,6 @@ public class CreateActivityCommandHandler : IRequestHandler().Add(task); diff --git a/Brizco.Repository/Handlers/Activity/UpdateActivityCommandHandler.cs b/Brizco.Repository/Handlers/Activity/UpdateActivityCommandHandler.cs index 1beedae..875d6b1 100644 --- a/Brizco.Repository/Handlers/Activity/UpdateActivityCommandHandler.cs +++ b/Brizco.Repository/Handlers/Activity/UpdateActivityCommandHandler.cs @@ -32,8 +32,6 @@ public class UpdateActivityCommandHandler : IRequestHandler shift.SetDay(d)); + _repositoryWrapper.SetRepository().Add(shift); await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.CommitAsync(cancellationToken); diff --git a/Brizco.Repository/Handlers/Shift/GetShiftQueryHandler.cs b/Brizco.Repository/Handlers/Shift/GetShiftQueryHandler.cs index bd787a4..5ccbedb 100644 --- a/Brizco.Repository/Handlers/Shift/GetShiftQueryHandler.cs +++ b/Brizco.Repository/Handlers/Shift/GetShiftQueryHandler.cs @@ -15,6 +15,7 @@ public class GetShiftPlanQueryHandler : IRequestHandler s.Id == request.id) .Select(ShiftMapper.ProjectToSDto) .FirstOrDefaultAsync(cancellationToken); + if (shift == null) throw new AppException("Shift not found", ApiResultStatusCode.NotFound); return shift; diff --git a/Brizco.Repository/Handlers/Shift/UpdateShiftCommandHandler.cs b/Brizco.Repository/Handlers/Shift/UpdateShiftCommandHandler.cs index 3c607c9..83e2e26 100644 --- a/Brizco.Repository/Handlers/Shift/UpdateShiftCommandHandler.cs +++ b/Brizco.Repository/Handlers/Shift/UpdateShiftCommandHandler.cs @@ -1,4 +1,6 @@ -namespace Brizco.Repository.Handlers.Shift; +using Brizco.Domain.Entities.Shift; + +namespace Brizco.Repository.Handlers.Shift; public class UpdateShiftCommandHandler : IRequestHandler { @@ -29,7 +31,25 @@ public class UpdateShiftCommandHandler : IRequestHandler() + .TableNoTracking.Where(sd => sd.ShiftId == request.Id) + .ToListAsync(cancellationToken); + + foreach (var shiftDay in shiftDays.Where(shiftDay => !request.DayOfWeeks.Contains(shiftDay.DayOfWeek))) + { + _repositoryWrapper.SetRepository() + .Delete(shiftDay); + await _repositoryWrapper.SaveChangesAsync(cancellationToken); + } + + foreach (var dayOfWeek in request.DayOfWeeks) + { + var findDay = shiftDays.FirstOrDefault(sf => sf.DayOfWeek == dayOfWeek); + if (findDay != null) + shift.SetDay(dayOfWeek); + } + _repositoryWrapper.SetRepository() .Update(newShift); await _repositoryWrapper.SaveChangesAsync(cancellationToken); diff --git a/Brizco.Repository/Handlers/Task/CreateTaskCommandHandler.cs b/Brizco.Repository/Handlers/Task/CreateTaskCommandHandler.cs index af4881f..449c39b 100644 --- a/Brizco.Repository/Handlers/Task/CreateTaskCommandHandler.cs +++ b/Brizco.Repository/Handlers/Task/CreateTaskCommandHandler.cs @@ -20,9 +20,6 @@ public class CreateActivityCommandHandler : IRequestHandler().Add(task); await _repositoryWrapper.SaveChangesAsync(cancellationToken); diff --git a/Brizco.Repository/Handlers/Task/UpdateTaskCommandHandler.cs b/Brizco.Repository/Handlers/Task/UpdateTaskCommandHandler.cs index fc08f8d..db6bb92 100644 --- a/Brizco.Repository/Handlers/Task/UpdateTaskCommandHandler.cs +++ b/Brizco.Repository/Handlers/Task/UpdateTaskCommandHandler.cs @@ -26,9 +26,6 @@ public class UpdateActivityCommandHandler : 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("20230920133908_Init")] - partial class Init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ComplexUserId"); - - b.HasIndex("RoleId"); - - b.ToTable("ComplexUserRoles", "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") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("EndAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("StartAt") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ShiftId"); - - b.ToTable("ShiftPlans", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ApplicationUserId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("ShiftPlanId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("ShiftPlanId"); - - b.ToTable("ShiftPlanUsers", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Discriminator") - .IsRequired() - .HasColumnType("text"); - - b.Property("HasDisposed") - .HasColumnType("boolean"); - - b.Property("IsDisposable") - .HasColumnType("boolean"); - - b.Property("IsRelatedToPerson") - .HasColumnType("boolean"); - - b.Property("IsRelatedToRole") - .HasColumnType("boolean"); - - b.Property("IsRelatedToShift") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("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.TaskRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("TaskId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskRoles", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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.Task.TaskUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.HasIndex("UserId"); - - b.ToTable("TaskUsers", "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("InternationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - 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("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("Status") - .HasColumnType("integer"); - - 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.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.Shift.Shift", "Shift") - .WithMany("Plans") - .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Shift"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") - .WithMany("Users") - .HasForeignKey("ShiftPlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApplicationUser"); - - b.Navigation("ShiftPlan"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Tasks") - .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Roles") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - 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.Task.TaskUser", b => - { - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Users") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Task"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Roles") - .HasForeignKey("ComplexId"); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", 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.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.Shift.Shift", b => - { - b.Navigation("Days"); - - b.Navigation("Plans"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.Navigation("Roles"); - - b.Navigation("Shifts"); - - b.Navigation("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Brizco.Repository/Migrations/20231015082502_editTask.Designer.cs b/Brizco.Repository/Migrations/20231015082502_editTask.Designer.cs deleted file mode 100644 index fd170be..0000000 --- a/Brizco.Repository/Migrations/20231015082502_editTask.Designer.cs +++ /dev/null @@ -1,1138 +0,0 @@ -// -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("20231015082502_editTask")] - partial class editTask - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ComplexUserId"); - - b.HasIndex("RoleId"); - - b.ToTable("ComplexUserRoles", "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") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("EndAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("StartAt") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ShiftId"); - - b.ToTable("ShiftPlans", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ApplicationUserId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("ShiftPlanId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("ShiftPlanId"); - - b.ToTable("ShiftPlanUsers", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Discriminator") - .IsRequired() - .HasColumnType("text"); - - b.Property("HasDisposed") - .HasColumnType("boolean"); - - b.Property("IsDisposable") - .HasColumnType("boolean"); - - b.Property("IsRelatedToPerson") - .HasColumnType("boolean"); - - b.Property("IsRelatedToRole") - .HasColumnType("boolean"); - - b.Property("IsRelatedToShift") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("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") - .IsRequired() - .HasColumnType("text"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskDays", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("TaskId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskRoles", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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.Task.TaskUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.HasIndex("UserId"); - - b.ToTable("TaskUsers", "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("InternationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - 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("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("Status") - .HasColumnType("integer"); - - 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.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.Shift.Shift", "Shift") - .WithMany("Plans") - .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Shift"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") - .WithMany("Users") - .HasForeignKey("ShiftPlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApplicationUser"); - - b.Navigation("ShiftPlan"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Tasks") - .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.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.TaskRole", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Roles") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - 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.Task.TaskUser", b => - { - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Users") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Task"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Roles") - .HasForeignKey("ComplexId"); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", 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.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.Shift.Shift", b => - { - b.Navigation("Days"); - - b.Navigation("Plans"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.Navigation("Days"); - - b.Navigation("Roles"); - - b.Navigation("Shifts"); - - b.Navigation("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Brizco.Repository/Migrations/20231015082502_editTask.cs b/Brizco.Repository/Migrations/20231015082502_editTask.cs deleted file mode 100644 index f2d6da4..0000000 --- a/Brizco.Repository/Migrations/20231015082502_editTask.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Brizco.Repository.Migrations -{ - /// - public partial class editTask : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "TaskDays", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - DayOfWeek = table.Column(type: "integer", nullable: false), - TaskId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: false), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TaskDays", x => x.Id); - table.ForeignKey( - name: "FK_TaskDays_Tasks_TaskId", - column: x => x.TaskId, - principalSchema: "public", - principalTable: "Tasks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_TaskDays_TaskId", - schema: "public", - table: "TaskDays", - column: "TaskId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TaskDays", - schema: "public"); - } - } -} diff --git a/Brizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs b/Brizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs deleted file mode 100644 index 3622558..0000000 --- a/Brizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs +++ /dev/null @@ -1,1138 +0,0 @@ -// -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("20231018090720_editUserNationalId")] - partial class editUserNationalId - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ComplexUserId"); - - b.HasIndex("RoleId"); - - b.ToTable("ComplexUserRoles", "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") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("EndAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("StartAt") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ShiftId"); - - b.ToTable("ShiftPlans", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ApplicationUserId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("ShiftPlanId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("ShiftPlanId"); - - b.ToTable("ShiftPlanUsers", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Discriminator") - .IsRequired() - .HasColumnType("text"); - - b.Property("HasDisposed") - .HasColumnType("boolean"); - - b.Property("IsDisposable") - .HasColumnType("boolean"); - - b.Property("IsRelatedToPerson") - .HasColumnType("boolean"); - - b.Property("IsRelatedToRole") - .HasColumnType("boolean"); - - b.Property("IsRelatedToShift") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("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") - .IsRequired() - .HasColumnType("text"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskDays", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("TaskId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskRoles", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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.Task.TaskUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.HasIndex("UserId"); - - b.ToTable("TaskUsers", "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("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("Status") - .HasColumnType("integer"); - - 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.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.Shift.Shift", "Shift") - .WithMany("Plans") - .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Shift"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") - .WithMany("Users") - .HasForeignKey("ShiftPlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApplicationUser"); - - b.Navigation("ShiftPlan"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Tasks") - .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.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.TaskRole", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Roles") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - 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.Task.TaskUser", b => - { - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Users") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Task"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Roles") - .HasForeignKey("ComplexId"); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", 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.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.Shift.Shift", b => - { - b.Navigation("Days"); - - b.Navigation("Plans"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.Navigation("Days"); - - b.Navigation("Roles"); - - b.Navigation("Shifts"); - - b.Navigation("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Brizco.Repository/Migrations/20231018090720_editUserNationalId.cs b/Brizco.Repository/Migrations/20231018090720_editUserNationalId.cs deleted file mode 100644 index 860f6ba..0000000 --- a/Brizco.Repository/Migrations/20231018090720_editUserNationalId.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Brizco.Repository.Migrations -{ - /// - public partial class editUserNationalId : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "InternationalId", - schema: "public", - table: "Users", - newName: "NationalId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "NationalId", - schema: "public", - table: "Users", - newName: "InternationalId"); - } - } -} diff --git a/Brizco.Repository/Migrations/20231025193834_editUser.cs b/Brizco.Repository/Migrations/20231025193834_editUser.cs deleted file mode 100644 index 1242147..0000000 --- a/Brizco.Repository/Migrations/20231025193834_editUser.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Brizco.Repository.Migrations -{ - /// - public partial class editUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "SelectedComplexUserRoleId", - schema: "public", - table: "Users", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "SelectedComplexUserRoleId", - schema: "public", - table: "Users"); - } - } -} diff --git a/Brizco.Repository/Migrations/20231104072034_editShift.Designer.cs b/Brizco.Repository/Migrations/20231104072034_editShift.Designer.cs deleted file mode 100644 index fbc1b91..0000000 --- a/Brizco.Repository/Migrations/20231104072034_editShift.Designer.cs +++ /dev/null @@ -1,1079 +0,0 @@ -// -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("20231104072034_editShift")] - partial class editShift - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ComplexUserId"); - - b.HasIndex("RoleId"); - - b.ToTable("ComplexUserRoles", "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") - .IsRequired() - .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") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .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.ShiftPlan", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlanDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("ShiftId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ShiftId"); - - b.ToTable("ShiftPlans", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ApplicationUserId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("ShiftPlanId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.HasIndex("ShiftPlanId"); - - b.ToTable("ShiftPlanUsers", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Discriminator") - .IsRequired() - .HasColumnType("text"); - - b.Property("HasDisposed") - .HasColumnType("boolean"); - - b.Property("IsDisposable") - .HasColumnType("boolean"); - - b.Property("IsRelatedToPerson") - .HasColumnType("boolean"); - - b.Property("IsRelatedToRole") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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("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") - .IsRequired() - .HasColumnType("text"); - - b.Property("DayOfWeek") - .HasColumnType("integer"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskDays", "public"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("TaskId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.HasIndex("TaskId"); - - b.ToTable("TaskRoles", "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") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .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.Task.TaskUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.HasIndex("UserId"); - - b.ToTable("TaskUsers", "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("Status") - .HasColumnType("integer"); - - 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.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.ShiftPlan", b => - { - b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") - .WithMany("Plans") - .HasForeignKey("ShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Shift"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") - .WithMany("Users") - .HasForeignKey("ShiftPlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApplicationUser"); - - b.Navigation("ShiftPlan"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Tasks") - .HasForeignKey("ComplexId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.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.TaskRole", b => - { - b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Roles") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - 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.Task.TaskUser", b => - { - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Users") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Task"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => - { - b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") - .WithMany("Roles") - .HasForeignKey("ComplexId"); - - b.Navigation("Complex"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", 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.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.Shift.Shift", b => - { - b.Navigation("Plans"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => - { - b.Navigation("Users"); - }); - - modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => - { - b.Navigation("Days"); - - b.Navigation("Roles"); - - b.Navigation("Shifts"); - - b.Navigation("Users"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Brizco.Repository/Migrations/20231104072034_editShift.cs b/Brizco.Repository/Migrations/20231104072034_editShift.cs deleted file mode 100644 index 205ac79..0000000 --- a/Brizco.Repository/Migrations/20231104072034_editShift.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Brizco.Repository.Migrations -{ - /// - public partial class editShift : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ShiftDays", - schema: "public"); - - migrationBuilder.DropColumn( - name: "IsRelatedToShift", - schema: "public", - table: "Tasks"); - - migrationBuilder.DropColumn( - name: "EndAt", - schema: "public", - table: "ShiftPlans"); - - migrationBuilder.RenameColumn( - name: "StartAt", - schema: "public", - table: "ShiftPlans", - newName: "PlanDate"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "PlanDate", - schema: "public", - table: "ShiftPlans", - newName: "StartAt"); - - migrationBuilder.AddColumn( - name: "IsRelatedToShift", - schema: "public", - table: "Tasks", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "EndAt", - schema: "public", - table: "ShiftPlans", - type: "timestamp without time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.CreateTable( - name: "ShiftDays", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ShiftId = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - DayOfWeek = table.Column(type: "integer", nullable: false), - IsRemoved = table.Column(type: "boolean", nullable: false), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - RemovedBy = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ShiftDays", x => x.Id); - table.ForeignKey( - name: "FK_ShiftDays_Shifts_ShiftId", - column: x => x.ShiftId, - principalSchema: "public", - principalTable: "Shifts", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_ShiftDays_ShiftId", - schema: "public", - table: "ShiftDays", - column: "ShiftId"); - } - } -} diff --git a/Brizco.Repository/Migrations/20231025193834_editUser.Designer.cs b/Brizco.Repository/Migrations/20231113110204_init.Designer.cs similarity index 75% rename from Brizco.Repository/Migrations/20231025193834_editUser.Designer.cs rename to Brizco.Repository/Migrations/20231113110204_init.Designer.cs index 4ff48d6..51dd3b8 100644 --- a/Brizco.Repository/Migrations/20231025193834_editUser.Designer.cs +++ b/Brizco.Repository/Migrations/20231113110204_init.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Brizco.Repository.Migrations { [DbContext(typeof(ApplicationContext))] - [Migration("20231025193834_editUser")] - partial class editUser + [Migration("20231113110204_init")] + partial class init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -163,6 +163,200 @@ namespace Brizco.Repository.Migrations 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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.PositionUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("PositionId"); + + b.ToTable("PositionUsers", "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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Routines", "public"); + }); + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => { b.Property("Id") @@ -273,9 +467,6 @@ namespace Brizco.Repository.Migrations .IsRequired() .HasColumnType("text"); - b.Property("EndAt") - .HasColumnType("timestamp without time zone"); - b.Property("IsRemoved") .HasColumnType("boolean"); @@ -286,6 +477,9 @@ namespace Brizco.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("PlanDate") + .HasColumnType("timestamp without time zone"); + b.Property("RemovedAt") .HasColumnType("timestamp without time zone"); @@ -296,9 +490,6 @@ namespace Brizco.Repository.Migrations b.Property("ShiftId") .HasColumnType("uuid"); - b.Property("StartAt") - .HasColumnType("timestamp without time zone"); - b.HasKey("Id"); b.HasIndex("ShiftId"); @@ -351,6 +542,51 @@ namespace Brizco.Repository.Migrations 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .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") + .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") @@ -387,15 +623,6 @@ namespace Brizco.Repository.Migrations b.Property("IsDisposable") .HasColumnType("boolean"); - b.Property("IsRelatedToPerson") - .HasColumnType("boolean"); - - b.Property("IsRelatedToRole") - .HasColumnType("boolean"); - - b.Property("IsRelatedToShift") - .HasColumnType("boolean"); - b.Property("IsRemoved") .HasColumnType("boolean"); @@ -477,7 +704,52 @@ namespace Brizco.Repository.Migrations b.ToTable("TaskDays", "public"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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() @@ -507,7 +779,7 @@ namespace Brizco.Repository.Migrations .IsRequired() .HasColumnType("text"); - b.Property("RoleId") + b.Property("RoutineId") .HasColumnType("uuid"); b.Property("TaskId") @@ -515,11 +787,11 @@ namespace Brizco.Repository.Migrations b.HasKey("Id"); - b.HasIndex("RoleId"); + b.HasIndex("RoutineId"); b.HasIndex("TaskId"); - b.ToTable("TaskRoles", "public"); + b.ToTable("TaskRoutines", "public"); }); modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => @@ -567,51 +839,6 @@ namespace Brizco.Repository.Migrations b.ToTable("TaskShifts", "public"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.HasIndex("UserId"); - - b.ToTable("TaskUsers", "public"); - }); - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => { b.Property("Id") @@ -906,6 +1133,66 @@ namespace Brizco.Repository.Migrations 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.PositionUser", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany("Users") + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Position"); + }); + + 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") @@ -958,6 +1245,25 @@ namespace Brizco.Repository.Migrations b.Navigation("ShiftPlan"); }); + 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") @@ -980,16 +1286,16 @@ namespace Brizco.Repository.Migrations b.Navigation("Task"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => { - b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Role") .WithMany() - .HasForeignKey("RoleId") + .HasForeignKey("PositionId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Roles") + .WithMany("Positions") .HasForeignKey("TaskId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); @@ -999,6 +1305,25 @@ namespace Brizco.Repository.Migrations 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") @@ -1018,25 +1343,6 @@ namespace Brizco.Repository.Migrations b.Navigation("Task"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => - { - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Users") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Task"); - - b.Navigation("User"); - }); - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => { b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") @@ -1113,11 +1419,30 @@ namespace Brizco.Repository.Migrations b.Navigation("Roles"); }); + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.Navigation("Users"); + }); + + 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 => @@ -1129,11 +1454,11 @@ namespace Brizco.Repository.Migrations { b.Navigation("Days"); - b.Navigation("Roles"); + b.Navigation("Positions"); + + b.Navigation("Routines"); b.Navigation("Shifts"); - - b.Navigation("Users"); }); #pragma warning restore 612, 618 } diff --git a/Brizco.Repository/Migrations/20230920133908_Init.cs b/Brizco.Repository/Migrations/20231113110204_init.cs similarity index 70% rename from Brizco.Repository/Migrations/20230920133908_Init.cs rename to Brizco.Repository/Migrations/20231113110204_init.cs index 940b0a1..36ae38e 100644 --- a/Brizco.Repository/Migrations/20230920133908_Init.cs +++ b/Brizco.Repository/Migrations/20231113110204_init.cs @@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Brizco.Repository.Migrations { /// - public partial class Init : Migration + public partial class init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -45,7 +45,8 @@ namespace Brizco.Repository.Migrations Id = table.Column(type: "uuid", nullable: false), FirstName = table.Column(type: "text", nullable: false), LastName = table.Column(type: "text", nullable: false), - InternationalId = table.Column(type: "text", nullable: false), + NationalId = table.Column(type: "text", nullable: false), + SelectedComplexUserRoleId = table.Column(type: "uuid", nullable: false), BirthDate = table.Column(type: "timestamp without time zone", nullable: false), Gender = table.Column(type: "integer", nullable: false), SignUpStatus = table.Column(type: "integer", nullable: false), @@ -94,6 +95,64 @@ namespace Brizco.Repository.Migrations principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "Routines", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + ComplexId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Routines", x => x.Id); + table.ForeignKey( + name: "FK_Routines_Complexes_ComplexId", + column: x => x.ComplexId, + principalSchema: "public", + principalTable: "Complexes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Sections", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + ComplexId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sections", x => x.Id); + table.ForeignKey( + name: "FK_Sections_Complexes_ComplexId", + column: x => x.ComplexId, + principalSchema: "public", + principalTable: "Complexes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "Shifts", schema: "public", @@ -134,9 +193,6 @@ namespace Brizco.Repository.Migrations Type = table.Column(type: "integer", nullable: false), Title = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: false), - IsRelatedToShift = table.Column(type: "boolean", nullable: false), - IsRelatedToRole = table.Column(type: "boolean", nullable: false), - IsRelatedToPerson = table.Column(type: "boolean", nullable: false), IsDisposable = table.Column(type: "boolean", nullable: false), SetFor = table.Column(type: "timestamp without time zone", nullable: false), HasDisposed = table.Column(type: "boolean", nullable: false), @@ -320,6 +376,43 @@ namespace Brizco.Repository.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "Positions", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + ComplexId = table.Column(type: "uuid", nullable: false), + SectionId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Positions", x => x.Id); + table.ForeignKey( + name: "FK_Positions_Complexes_ComplexId", + column: x => x.ComplexId, + principalSchema: "public", + principalTable: "Complexes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Positions_Sections_SectionId", + column: x => x.SectionId, + principalSchema: "public", + principalTable: "Sections", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "ShiftDays", schema: "public", @@ -354,8 +447,7 @@ namespace Brizco.Repository.Migrations columns: table => new { Id = table.Column(type: "uuid", nullable: false), - StartAt = table.Column(type: "timestamp without time zone", nullable: false), - EndAt = table.Column(type: "timestamp without time zone", nullable: false), + PlanDate = table.Column(type: "timestamp without time zone", nullable: false), ShiftId = table.Column(type: "uuid", nullable: false), RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), @@ -378,12 +470,47 @@ namespace Brizco.Repository.Migrations }); migrationBuilder.CreateTable( - name: "TaskRoles", + name: "ShiftRoutines", schema: "public", columns: table => new { Id = table.Column(type: "uuid", nullable: false), - RoleId = table.Column(type: "uuid", nullable: false), + RoutineId = table.Column(type: "uuid", nullable: false), + ShiftId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShiftRoutines", x => x.Id); + table.ForeignKey( + name: "FK_ShiftRoutines_Routines_RoutineId", + column: x => x.RoutineId, + principalSchema: "public", + principalTable: "Routines", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ShiftRoutines_Shifts_ShiftId", + column: x => x.ShiftId, + principalSchema: "public", + principalTable: "Shifts", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "TaskDays", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DayOfWeek = table.Column(type: "integer", nullable: false), TaskId = table.Column(type: "uuid", nullable: false), RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), @@ -395,16 +522,44 @@ namespace Brizco.Repository.Migrations }, constraints: table => { - table.PrimaryKey("PK_TaskRoles", x => x.Id); + table.PrimaryKey("PK_TaskDays", x => x.Id); table.ForeignKey( - name: "FK_TaskRoles_Roles_RoleId", - column: x => x.RoleId, + name: "FK_TaskDays_Tasks_TaskId", + column: x => x.TaskId, principalSchema: "public", - principalTable: "Roles", + principalTable: "Tasks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "TaskRoutines", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + TaskId = table.Column(type: "uuid", nullable: false), + RoutineId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskRoutines", x => x.Id); + table.ForeignKey( + name: "FK_TaskRoutines_Routines_RoutineId", + column: x => x.RoutineId, + principalSchema: "public", + principalTable: "Routines", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_TaskRoles_Tasks_TaskId", + name: "FK_TaskRoutines_Tasks_TaskId", column: x => x.TaskId, principalSchema: "public", principalTable: "Tasks", @@ -447,41 +602,6 @@ namespace Brizco.Repository.Migrations onDelete: ReferentialAction.Restrict); }); - migrationBuilder.CreateTable( - name: "TaskUsers", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - TaskId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: false), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TaskUsers", x => x.Id); - table.ForeignKey( - name: "FK_TaskUsers_Tasks_TaskId", - column: x => x.TaskId, - principalSchema: "public", - principalTable: "Tasks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_TaskUsers_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - migrationBuilder.CreateTable( name: "ComplexUserRoles", schema: "public", @@ -517,6 +637,76 @@ namespace Brizco.Repository.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "PositionUsers", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ApplicationUserId = table.Column(type: "uuid", nullable: false), + PositionId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PositionUsers", x => x.Id); + table.ForeignKey( + name: "FK_PositionUsers_Positions_PositionId", + column: x => x.PositionId, + principalSchema: "public", + principalTable: "Positions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PositionUsers_Users_ApplicationUserId", + column: x => x.ApplicationUserId, + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "TaskPositions", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + PositionId = table.Column(type: "uuid", nullable: false), + TaskId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskPositions", x => x.Id); + table.ForeignKey( + name: "FK_TaskPositions_Positions_PositionId", + column: x => x.PositionId, + principalSchema: "public", + principalTable: "Positions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_TaskPositions_Tasks_TaskId", + column: x => x.TaskId, + principalSchema: "public", + principalTable: "Tasks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "ShiftPlanUsers", schema: "public", @@ -588,6 +778,30 @@ namespace Brizco.Repository.Migrations table: "Logins", column: "UserId"); + migrationBuilder.CreateIndex( + name: "IX_Positions_ComplexId", + schema: "public", + table: "Positions", + column: "ComplexId"); + + migrationBuilder.CreateIndex( + name: "IX_Positions_SectionId", + schema: "public", + table: "Positions", + column: "SectionId"); + + migrationBuilder.CreateIndex( + name: "IX_PositionUsers_ApplicationUserId", + schema: "public", + table: "PositionUsers", + column: "ApplicationUserId"); + + migrationBuilder.CreateIndex( + name: "IX_PositionUsers_PositionId", + schema: "public", + table: "PositionUsers", + column: "PositionId"); + migrationBuilder.CreateIndex( name: "IX_RoleClaims_RoleId", schema: "public", @@ -607,6 +821,18 @@ namespace Brizco.Repository.Migrations column: "NormalizedName", unique: true); + migrationBuilder.CreateIndex( + name: "IX_Routines_ComplexId", + schema: "public", + table: "Routines", + column: "ComplexId"); + + migrationBuilder.CreateIndex( + name: "IX_Sections_ComplexId", + schema: "public", + table: "Sections", + column: "ComplexId"); + migrationBuilder.CreateIndex( name: "IX_ShiftDays_ShiftId", schema: "public", @@ -631,6 +857,18 @@ namespace Brizco.Repository.Migrations table: "ShiftPlanUsers", column: "ShiftPlanId"); + migrationBuilder.CreateIndex( + name: "IX_ShiftRoutines_RoutineId", + schema: "public", + table: "ShiftRoutines", + column: "RoutineId"); + + migrationBuilder.CreateIndex( + name: "IX_ShiftRoutines_ShiftId", + schema: "public", + table: "ShiftRoutines", + column: "ShiftId"); + migrationBuilder.CreateIndex( name: "IX_Shifts_ComplexId", schema: "public", @@ -638,15 +876,33 @@ namespace Brizco.Repository.Migrations column: "ComplexId"); migrationBuilder.CreateIndex( - name: "IX_TaskRoles_RoleId", + name: "IX_TaskDays_TaskId", schema: "public", - table: "TaskRoles", - column: "RoleId"); + table: "TaskDays", + column: "TaskId"); migrationBuilder.CreateIndex( - name: "IX_TaskRoles_TaskId", + name: "IX_TaskPositions_PositionId", schema: "public", - table: "TaskRoles", + table: "TaskPositions", + column: "PositionId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskPositions_TaskId", + schema: "public", + table: "TaskPositions", + column: "TaskId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskRoutines_RoutineId", + schema: "public", + table: "TaskRoutines", + column: "RoutineId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskRoutines_TaskId", + schema: "public", + table: "TaskRoutines", column: "TaskId"); migrationBuilder.CreateIndex( @@ -667,18 +923,6 @@ namespace Brizco.Repository.Migrations table: "TaskShifts", column: "TaskId"); - migrationBuilder.CreateIndex( - name: "IX_TaskUsers_TaskId", - schema: "public", - table: "TaskUsers", - column: "TaskId"); - - migrationBuilder.CreateIndex( - name: "IX_TaskUsers_UserId", - schema: "public", - table: "TaskUsers", - column: "UserId"); - migrationBuilder.CreateIndex( name: "IX_UserRoles_RoleId", schema: "public", @@ -714,6 +958,10 @@ namespace Brizco.Repository.Migrations name: "Logins", schema: "public"); + migrationBuilder.DropTable( + name: "PositionUsers", + schema: "public"); + migrationBuilder.DropTable( name: "RoleClaims", schema: "public"); @@ -727,17 +975,25 @@ namespace Brizco.Repository.Migrations schema: "public"); migrationBuilder.DropTable( - name: "TaskRoles", + name: "ShiftRoutines", + schema: "public"); + + migrationBuilder.DropTable( + name: "TaskDays", + schema: "public"); + + migrationBuilder.DropTable( + name: "TaskPositions", + schema: "public"); + + migrationBuilder.DropTable( + name: "TaskRoutines", schema: "public"); migrationBuilder.DropTable( name: "TaskShifts", schema: "public"); - migrationBuilder.DropTable( - name: "TaskUsers", - schema: "public"); - migrationBuilder.DropTable( name: "Tokens", schema: "public"); @@ -754,6 +1010,14 @@ namespace Brizco.Repository.Migrations name: "ShiftPlans", schema: "public"); + migrationBuilder.DropTable( + name: "Positions", + schema: "public"); + + migrationBuilder.DropTable( + name: "Routines", + schema: "public"); + migrationBuilder.DropTable( name: "Tasks", schema: "public"); @@ -770,6 +1034,10 @@ namespace Brizco.Repository.Migrations name: "Shifts", schema: "public"); + migrationBuilder.DropTable( + name: "Sections", + schema: "public"); + migrationBuilder.DropTable( name: "Complexes", schema: "public"); diff --git a/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs index 55c61fb..a693af5 100644 --- a/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/Brizco.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -160,6 +160,200 @@ namespace Brizco.Repository.Migrations 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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.PositionUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("PositionId"); + + b.ToTable("PositionUsers", "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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Routines", "public"); + }); + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => { b.Property("Id") @@ -214,6 +408,49 @@ namespace Brizco.Repository.Migrations 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .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") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftDays", "public"); + }); + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => { b.Property("Id") @@ -302,6 +539,51 @@ namespace Brizco.Repository.Migrations 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .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") + .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") @@ -338,12 +620,6 @@ namespace Brizco.Repository.Migrations b.Property("IsDisposable") .HasColumnType("boolean"); - b.Property("IsRelatedToPerson") - .HasColumnType("boolean"); - - b.Property("IsRelatedToRole") - .HasColumnType("boolean"); - b.Property("IsRemoved") .HasColumnType("boolean"); @@ -425,7 +701,52 @@ namespace Brizco.Repository.Migrations b.ToTable("TaskDays", "public"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PositionId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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() @@ -455,7 +776,7 @@ namespace Brizco.Repository.Migrations .IsRequired() .HasColumnType("text"); - b.Property("RoleId") + b.Property("RoutineId") .HasColumnType("uuid"); b.Property("TaskId") @@ -463,11 +784,11 @@ namespace Brizco.Repository.Migrations b.HasKey("Id"); - b.HasIndex("RoleId"); + b.HasIndex("RoutineId"); b.HasIndex("TaskId"); - b.ToTable("TaskRoles", "public"); + b.ToTable("TaskRoutines", "public"); }); modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => @@ -515,51 +836,6 @@ namespace Brizco.Repository.Migrations b.ToTable("TaskShifts", "public"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .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") - .HasColumnType("uuid"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("TaskId"); - - b.HasIndex("UserId"); - - b.ToTable("TaskUsers", "public"); - }); - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => { b.Property("Id") @@ -854,6 +1130,66 @@ namespace Brizco.Repository.Migrations 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.PositionUser", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position") + .WithMany("Users") + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Position"); + }); + + 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") @@ -865,6 +1201,17 @@ namespace Brizco.Repository.Migrations 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.Shift.Shift", "Shift") @@ -895,6 +1242,25 @@ namespace Brizco.Repository.Migrations b.Navigation("ShiftPlan"); }); + 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") @@ -917,16 +1283,16 @@ namespace Brizco.Repository.Migrations b.Navigation("Task"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b => { - b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + b.HasOne("Brizco.Domain.Entities.Complex.Position", "Role") .WithMany() - .HasForeignKey("RoleId") + .HasForeignKey("PositionId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Roles") + .WithMany("Positions") .HasForeignKey("TaskId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); @@ -936,6 +1302,25 @@ namespace Brizco.Repository.Migrations 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") @@ -955,25 +1340,6 @@ namespace Brizco.Repository.Migrations b.Navigation("Task"); }); - modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => - { - b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") - .WithMany("Users") - .HasForeignKey("TaskId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Task"); - - b.Navigation("User"); - }); - modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => { b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") @@ -1050,9 +1416,30 @@ namespace Brizco.Repository.Migrations b.Navigation("Roles"); }); + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b => + { + b.Navigation("Users"); + }); + + 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 => @@ -1064,11 +1451,11 @@ namespace Brizco.Repository.Migrations { b.Navigation("Days"); - b.Navigation("Roles"); + b.Navigation("Positions"); + + b.Navigation("Routines"); b.Navigation("Shifts"); - - b.Navigation("Users"); }); #pragma warning restore 612, 618 }