feat : edit infra

master
Amir Hossein Khademi 2023-11-13 14:42:49 +03:30
parent 9092109cd2
commit 574e3eae62
62 changed files with 1884 additions and 5482 deletions

View File

@ -0,0 +1,6 @@
namespace Brizco.Api.Controllers;
public class PositionController
{
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Api.Controllers;
public class SectionController
{
}

View File

@ -18,6 +18,21 @@ public static class ApplicationClaims
Detail = "دسترسی به مشاهده مجموعه ها" 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 public static ClaimDto ManageShifts { get; } = new ClaimDto
{ {
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
@ -78,6 +93,9 @@ public static class ApplicationClaims
public static List<Claim> AllClaims = new List<Claim> public static List<Claim> AllClaims = new List<Claim>
{ {
ManageStaffs.GetClaim,
ViewStaffs.GetClaim,
ManageActivities.GetClaim, ManageActivities.GetClaim,
ViewTasks.GetClaim, ViewTasks.GetClaim,
ManageTasks.GetClaim, ManageTasks.GetClaim,
@ -92,6 +110,9 @@ public static class ApplicationClaims
public static List<Claim> ManagerClaims = new List<Claim> public static List<Claim> ManagerClaims = new List<Claim>
{ {
ManageStaffs.GetClaim,
ViewStaffs.GetClaim,
ManageActivities.GetClaim, ManageActivities.GetClaim,
ViewTasks.GetClaim, ViewTasks.GetClaim,
ManageTasks.GetClaim, ManageTasks.GetClaim,
@ -100,4 +121,22 @@ public static class ApplicationClaims
ViewShifts.GetClaim, ViewShifts.GetClaim,
ManageShifts.GetClaim, ManageShifts.GetClaim,
}; };
public static List<Claim> SuperVisorClaims = new List<Claim>
{
ManageActivities.GetClaim,
ViewTasks.GetClaim,
ManageTasks.GetClaim,
ManageShiftPlans.GetClaim,
ViewShifts.GetClaim,
ManageShifts.GetClaim,
};
public static List<Claim> StaffClaims = new List<Claim>
{
ManageActivities.GetClaim,
ViewTasks.GetClaim,
};
} }

View File

@ -4,6 +4,10 @@ public static class ApplicationPermission
public const string ManageComplexes = nameof(ManageComplexes); public const string ManageComplexes = nameof(ManageComplexes);
public const string ViewComplexes = nameof(ViewComplexes); 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 ManageShifts = nameof(ManageShifts);
public const string ViewShifts = nameof(ViewShifts); public const string ViewShifts = nameof(ViewShifts);
public const string ManageShiftPlans = nameof(ManageShiftPlans); public const string ManageShiftPlans = nameof(ManageShiftPlans);

View File

@ -36,6 +36,38 @@ public class ComplexService : IComplexService
foreach (var claim in ApplicationClaims.ManagerClaims) foreach (var claim in ApplicationClaims.ManagerClaims)
await _roleManager.AddClaimAsync(managerRole, claim); 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<Guid>{ managerRole.Id }), cancellationToken); var complexUser = await _sender.Send(new CreateComplexUserCommand(complex.Id, managerUserId, new List<Guid>{ managerRole.Id }), cancellationToken);
return complex; return complex;

View File

@ -53,6 +53,9 @@
<Using Include="Brizco.Common.Models.Mapper" /> <Using Include="Brizco.Common.Models.Mapper" />
<Using Include="Brizco.Domain.Dtos.LargDtos" /> <Using Include="Brizco.Domain.Dtos.LargDtos" />
<Using Include="Brizco.Domain.Dtos.SmallDtos" /> <Using Include="Brizco.Domain.Dtos.SmallDtos" />
<Using Include="Brizco.Domain.Entities.Complex" />
<Using Include="Brizco.Domain.Entities.Shift" />
<Using Include="Brizco.Domain.Entities.Task" />
<Using Include="Brizco.Domain.Enums" /> <Using Include="Brizco.Domain.Enums" />
<Using Include="Mapster" /> <Using Include="Mapster" />
<Using Include="Microsoft.AspNetCore.Identity" /> <Using Include="Microsoft.AspNetCore.Identity" />

View File

@ -7,16 +7,13 @@ public sealed record CreateActivityCommand(
TaskType Type, TaskType Type,
string Title, string Title,
string Description, string Description,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable, bool IsDisposable,
DateTime SetFor, DateTime SetFor,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Roles) : IRequest<ActivityLDto>; List<Guid> Positions) : IRequest<ActivityLDto>;
public sealed record UpdateActivityCommand(Guid Id, public sealed record UpdateActivityCommand(Guid Id,
ActivityStatus Status, ActivityStatus Status,
@ -25,16 +22,13 @@ public sealed record UpdateActivityCommand(Guid Id,
TaskType Type, TaskType Type,
string Title, string Title,
string Description, string Description,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable, bool IsDisposable,
DateTime SetFor, DateTime SetFor,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Roles) : IRequest<bool>; List<Guid> Positions) : IRequest<bool>;
public sealed record DeleteActivityCommand(Guid Id) public sealed record DeleteActivityCommand(Guid Id)

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.CommandQueries.Commands;
public class PositionCommands
{
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.CommandQueries.Commands;
public class SectionCommand
{
}

View File

@ -2,10 +2,10 @@
namespace Brizco.Domain.CommandQueries.Commands; 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<DayOfWeek> DayOfWeeks)
: IRequest<ShiftSDto>; : IRequest<ShiftSDto>;
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<DayOfWeek> DayOfWeeks)
: IRequest<bool>; : IRequest<bool>;
public sealed record DeleteShiftCommand(Guid Id) public sealed record DeleteShiftCommand(Guid Id)

View File

@ -3,34 +3,26 @@
public sealed record CreateTaskCommand(TaskType Type, public sealed record CreateTaskCommand(TaskType Type,
string Title, string Title,
string Description, string Description,
bool IsRelatedToShift,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable, bool IsDisposable,
DateTime SetFor, DateTime SetFor,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Roles, List<Guid> Positions,
List<DayOfWeek> Days) : IRequest<TaskLDto>; List<DayOfWeek> Days) : IRequest<TaskLDto>;
public sealed record UpdateTaskCommand(Guid Id, public sealed record UpdateTaskCommand(Guid Id,
TaskType Type, TaskType Type,
string Title, string Title,
string Description, string Description,
bool IsRelatedToShift,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable, bool IsDisposable,
DateTime SetFor, DateTime SetFor,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Roles, List<Guid> Positions,
List<DayOfWeek> Days) : IRequest<bool>; List<DayOfWeek> Days) : IRequest<bool>;

View File

@ -7,9 +7,6 @@ public class ActivityLDto : BaseDto<ActivityLDto , Activity>
public TaskType Type { get; set; } public TaskType Type { get; set; }
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public bool IsRelatedToShift { get; set; }
public bool IsRelatedToRole { get; set; }
public bool IsRelatedToPerson { get; set; }
public bool IsDisposable { get; set; } public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; } public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; } public bool HasDisposed { get; set; }

View File

@ -7,9 +7,6 @@ public class TaskLDto : BaseDto<TaskLDto, Entities.Task.Task>
public TaskType Type { get; set; } public TaskType Type { get; set; }
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public bool IsRelatedToShift { get; set; }
public bool IsRelatedToRole { get; set; }
public bool IsRelatedToPerson { get; set; }
public bool IsDisposable { get; set; } public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; } public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; } public bool HasDisposed { get; set; }
@ -19,9 +16,8 @@ public class TaskLDto : BaseDto<TaskLDto, Entities.Task.Task>
public PurchaseAmountType AmountType { get; set; } public PurchaseAmountType AmountType { get; set; }
public List<TaskUserSDto> Users { get; set; } = new();
public List<TaskShiftSDto> Shifts { get; set; } = new(); public List<TaskShiftSDto> Shifts { get; set; } = new();
public List<TaskRoleSDto> Roles { get; set; } = new(); public List<TaskPositionSDto> Positions { get; set; } = new();
} }

View File

@ -7,9 +7,6 @@ public class ActivitySDto : BaseDto<ActivitySDto , Activity>
public TaskType Type { get; internal set; } public TaskType Type { get; internal set; }
public string Title { get; internal set; } = string.Empty; public string Title { get; internal set; } = string.Empty;
public string Description { 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 bool IsDisposable { get; internal set; }
public DateTime SetFor { get; internal set; } public DateTime SetFor { get; internal set; }
public bool HasDisposed { get; internal set; } public bool HasDisposed { get; internal set; }

View File

@ -2,8 +2,8 @@
namespace Brizco.Domain.Dtos.SmallDtos; namespace Brizco.Domain.Dtos.SmallDtos;
public class TaskRoleSDto : BaseDto<TaskRoleSDto , TaskRole> public class TaskPositionSDto : BaseDto<TaskPositionSDto , TaskPosition>
{ {
public Guid RoleId { get; set; } public Guid PositionId { get; set; }
public Guid TaskId { get; set; } public Guid TaskId { get; set; }
} }

View File

@ -5,9 +5,6 @@ public class TaskSDto : BaseDto<TaskSDto,Entities.Task.Task>
public TaskType Type { get; set; } public TaskType Type { get; set; }
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public bool IsRelatedToShift { get; set; }
public bool IsRelatedToRole { get; set; }
public bool IsRelatedToPerson { get; set; }
public bool IsDisposable { get; set; } public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; } public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; } public bool HasDisposed { get; set; }

View File

@ -1,7 +0,0 @@
namespace Brizco.Domain.Dtos.SmallDtos;
public class TaskUserSDto
{
public Guid UserId { get; set; }
public Guid TaskId { get; set; }
}

View File

@ -28,3 +28,33 @@ public partial class ComplexUser
return role; 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;
}
}

View File

@ -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<PositionUser> Users { get; internal set; } = new();
}

View File

@ -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; }
}

View File

@ -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<Position> Positions { get; internal set; } = new();
}

View File

@ -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;
}
}

View File

@ -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<TaskRoutine> Tasks { get; internal set; } = new();
public List<ShiftRoutine> Shifts { get; internal set; } = new();
}

View File

@ -8,6 +8,12 @@ public partial class Shift
return new Shift(title, description, startAt, endAt,complexId); 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) public ShiftPlan AddPlan(DateTime planDate)
{ {
var plan = new ShiftPlan(planDate , Id); var plan = new ShiftPlan(planDate , Id);

View File

@ -23,5 +23,7 @@ public partial class Shift : ApiEntity
public Guid ComplexId { get; set; } public Guid ComplexId { get; set; }
public Complex.Complex? Complex { get; set; } public Complex.Complex? Complex { get; set; }
public List<ShiftDay> Days { get; internal set; } = new();
public List<ShiftPlan> Plans { get; internal set; } = new(); public List<ShiftPlan> Plans { get; internal set; } = new();
public List<ShiftRoutine> Routines { get; internal set; } = new();
} }

View File

@ -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; }
}

View File

@ -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; }
}

View File

@ -15,8 +15,6 @@ public partial class Activity : Task
DateTime doneAt, DateTime doneAt,
string performanceDescription, string performanceDescription,
TaskType type, TaskType type,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable, bool isDisposable,
DateTime setFor, DateTime setFor,
bool hasDisposed, bool hasDisposed,
@ -25,7 +23,7 @@ public partial class Activity : Task
string title, string title,
string description, string description,
Guid complexId) : base( 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; Status = status;
DoneAt = doneAt; DoneAt = doneAt;

View File

@ -1,4 +1,6 @@
namespace Brizco.Domain.Entities.Task; using Brizco.Domain.Entities.Routine;
namespace Brizco.Domain.Entities.Task;
public partial class Task public partial class Task
@ -8,9 +10,6 @@ public partial class Task
string title, string title,
string description, string description,
TaskType type, TaskType type,
bool isRelatedToShift,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable, bool isDisposable,
DateTime setFor, DateTime setFor,
bool hasDisposed, bool hasDisposed,
@ -18,9 +17,8 @@ public partial class Task
PurchaseAmountType amountType, PurchaseAmountType amountType,
Guid complexId) Guid complexId)
{ {
return new Task(type, return new Task(
isRelatedToRole, type,
isRelatedToPerson,
isDisposable, isDisposable,
setFor, setFor,
hasDisposed, hasDisposed,
@ -48,6 +46,7 @@ public partial class Task
Shifts.Add(plan); Shifts.Add(plan);
} }
} }
public TaskShift AddShift(Guid shiftId) public TaskShift AddShift(Guid shiftId)
{ {
var plan = new TaskShift(Id, shiftId); var plan = new TaskShift(Id, shiftId);
@ -55,35 +54,37 @@ public partial class Task
return plan; 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); var position = new TaskPosition(Id, positionId);
Users.Add(plan); Positions.Add(position);
} }
} }
public TaskUser AddUser(Guid userId) public TaskPosition AddPosition(Guid positionId)
{ {
var plan = new TaskUser(Id, userId); var position = new TaskPosition(Id, positionId);
Users.Add(plan); Positions.Add(position);
return plan; return position;
} }
public TaskRole AddRole(Guid roleId)
public void AddRoutine(params Guid[] routineIds)
{ {
var plan = new TaskRole(Id, roleId); foreach (var routineId in routineIds)
Roles.Add(plan);
return plan;
}
public void AddRole(params Guid[] roleIds)
{
foreach (var roleId in roleIds)
{ {
var plan = new TaskRole(Id, roleId); var routine = new TaskRoutine(Id, routineId);
Roles.Add(plan); Routines.Add(routine);
} }
} }
public TaskRoutine AddRoutine(Guid routineId)
{
var routine = new TaskRoutine(Id, routineId);
Routines.Add(routine);
return routine;
}
} }
public partial class Activity public partial class Activity
@ -96,8 +97,6 @@ public partial class Activity
string title, string title,
string description, string description,
TaskType type, TaskType type,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable, bool isDisposable,
DateTime setFor, DateTime setFor,
bool hasDisposed, bool hasDisposed,
@ -110,8 +109,6 @@ public partial class Activity
doneAt, doneAt,
performanceDescription, performanceDescription,
type, type,
isRelatedToRole,
isRelatedToPerson,
isDisposable, isDisposable,
setFor, setFor,
hasDisposed, hasDisposed,

View File

@ -12,8 +12,6 @@ public partial class Task : ApiEntity
} }
internal Task( internal Task(
TaskType type, TaskType type,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable, bool isDisposable,
DateTime setFor, DateTime setFor,
bool hasDisposed, bool hasDisposed,
@ -24,8 +22,6 @@ public partial class Task : ApiEntity
Guid complexId) Guid complexId)
{ {
Type = type; Type = type;
IsRelatedToRole = isRelatedToRole;
IsRelatedToPerson = isRelatedToPerson;
IsDisposable = isDisposable; IsDisposable = isDisposable;
SetFor = setFor; SetFor = setFor;
HasDisposed = hasDisposed; HasDisposed = hasDisposed;
@ -39,8 +35,6 @@ public partial class Task : ApiEntity
public TaskType Type { get; internal set; } public TaskType Type { get; internal set; }
public string Title { get; internal set; } = string.Empty; public string Title { get; internal set; } = string.Empty;
public string Description { 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 bool IsDisposable { get; internal set; }
public DateTime SetFor { get; internal set; } public DateTime SetFor { get; internal set; }
public bool HasDisposed { 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 PurchaseAmountType AmountType { get; internal set; }
public List<TaskUser> Users { get; internal set; } = new();
public List<TaskShift> Shifts { get; internal set; } = new(); public List<TaskShift> Shifts { get; internal set; } = new();
public List<TaskDay> Days { get; internal set; } = new(); public List<TaskDay> Days { get; internal set; } = new();
public List<TaskRole> Roles { get; internal set; } = new(); public List<TaskPosition> Positions { get; internal set; } = new();
public List<TaskRoutine> Routines { get; internal set; } = new();
} }

View File

@ -1,23 +1,23 @@
using Brizco.Domain.Entities.User; using Brizco.Domain.Entities.Complex;
namespace Brizco.Domain.Entities.Task; namespace Brizco.Domain.Entities.Task;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper] [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; TaskId = taskId;
} }
public Guid RoleId { get; internal set; } public Guid PositionId { get; internal set; }
public virtual ApplicationRole? Role { get; internal set; } public virtual Position? Role { get; internal set; }
public Guid TaskId { get; internal set; } public Guid TaskId { get; internal set; }
public virtual Task? Task { get; internal set; } public virtual Task? Task { get; internal set; }

View File

@ -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; }
}

View File

@ -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; }
}

View File

@ -19,8 +19,6 @@ namespace Brizco.Domain.Mappers
Type = p1.Type, Type = p1.Type,
Title = p1.Title, Title = p1.Title,
Description = p1.Description, Description = p1.Description,
IsRelatedToRole = p1.IsRelatedToRole,
IsRelatedToPerson = p1.IsRelatedToPerson,
IsDisposable = p1.IsDisposable, IsDisposable = p1.IsDisposable,
SetFor = p1.SetFor, SetFor = p1.SetFor,
HasDisposed = p1.HasDisposed, HasDisposed = p1.HasDisposed,
@ -44,8 +42,6 @@ namespace Brizco.Domain.Mappers
result.Type = p2.Type; result.Type = p2.Type;
result.Title = p2.Title; result.Title = p2.Title;
result.Description = p2.Description; result.Description = p2.Description;
result.IsRelatedToRole = p2.IsRelatedToRole;
result.IsRelatedToPerson = p2.IsRelatedToPerson;
result.IsDisposable = p2.IsDisposable; result.IsDisposable = p2.IsDisposable;
result.SetFor = p2.SetFor; result.SetFor = p2.SetFor;
result.HasDisposed = p2.HasDisposed; result.HasDisposed = p2.HasDisposed;
@ -64,8 +60,6 @@ namespace Brizco.Domain.Mappers
Type = p4.Type, Type = p4.Type,
Title = p4.Title, Title = p4.Title,
Description = p4.Description, Description = p4.Description,
IsRelatedToRole = p4.IsRelatedToRole,
IsRelatedToPerson = p4.IsRelatedToPerson,
IsDisposable = p4.IsDisposable, IsDisposable = p4.IsDisposable,
SetFor = p4.SetFor, SetFor = p4.SetFor,
HasDisposed = p4.HasDisposed, HasDisposed = p4.HasDisposed,
@ -80,8 +74,6 @@ namespace Brizco.Domain.Mappers
Type = p5.Type, Type = p5.Type,
Title = p5.Title, Title = p5.Title,
Description = p5.Description, Description = p5.Description,
IsRelatedToRole = p5.IsRelatedToRole,
IsRelatedToPerson = p5.IsRelatedToPerson,
IsDisposable = p5.IsDisposable, IsDisposable = p5.IsDisposable,
SetFor = p5.SetFor, SetFor = p5.SetFor,
HasDisposed = p5.HasDisposed, HasDisposed = p5.HasDisposed,
@ -105,8 +97,6 @@ namespace Brizco.Domain.Mappers
result.Type = p6.Type; result.Type = p6.Type;
result.Title = p6.Title; result.Title = p6.Title;
result.Description = p6.Description; result.Description = p6.Description;
result.IsRelatedToRole = p6.IsRelatedToRole;
result.IsRelatedToPerson = p6.IsRelatedToPerson;
result.IsDisposable = p6.IsDisposable; result.IsDisposable = p6.IsDisposable;
result.SetFor = p6.SetFor; result.SetFor = p6.SetFor;
result.HasDisposed = p6.HasDisposed; result.HasDisposed = p6.HasDisposed;
@ -125,8 +115,6 @@ namespace Brizco.Domain.Mappers
Type = p8.Type, Type = p8.Type,
Title = p8.Title, Title = p8.Title,
Description = p8.Description, Description = p8.Description,
IsRelatedToRole = p8.IsRelatedToRole,
IsRelatedToPerson = p8.IsRelatedToPerson,
IsDisposable = p8.IsDisposable, IsDisposable = p8.IsDisposable,
SetFor = p8.SetFor, SetFor = p8.SetFor,
HasDisposed = p8.HasDisposed, HasDisposed = p8.HasDisposed,
@ -149,8 +137,6 @@ namespace Brizco.Domain.Mappers
Type = p9.Type, Type = p9.Type,
Title = p9.Title, Title = p9.Title,
Description = p9.Description, Description = p9.Description,
IsRelatedToRole = p9.IsRelatedToRole,
IsRelatedToPerson = p9.IsRelatedToPerson,
IsDisposable = p9.IsDisposable, IsDisposable = p9.IsDisposable,
SetFor = p9.SetFor, SetFor = p9.SetFor,
HasDisposed = p9.HasDisposed, HasDisposed = p9.HasDisposed,
@ -174,8 +160,6 @@ namespace Brizco.Domain.Mappers
result.Type = p10.Type; result.Type = p10.Type;
result.Title = p10.Title; result.Title = p10.Title;
result.Description = p10.Description; result.Description = p10.Description;
result.IsRelatedToRole = p10.IsRelatedToRole;
result.IsRelatedToPerson = p10.IsRelatedToPerson;
result.IsDisposable = p10.IsDisposable; result.IsDisposable = p10.IsDisposable;
result.SetFor = p10.SetFor; result.SetFor = p10.SetFor;
result.HasDisposed = p10.HasDisposed; result.HasDisposed = p10.HasDisposed;
@ -194,8 +178,6 @@ namespace Brizco.Domain.Mappers
Type = p12.Type, Type = p12.Type,
Title = p12.Title, Title = p12.Title,
Description = p12.Description, Description = p12.Description,
IsRelatedToRole = p12.IsRelatedToRole,
IsRelatedToPerson = p12.IsRelatedToPerson,
IsDisposable = p12.IsDisposable, IsDisposable = p12.IsDisposable,
SetFor = p12.SetFor, SetFor = p12.SetFor,
HasDisposed = p12.HasDisposed, HasDisposed = p12.HasDisposed,
@ -210,8 +192,6 @@ namespace Brizco.Domain.Mappers
Type = p13.Type, Type = p13.Type,
Title = p13.Title, Title = p13.Title,
Description = p13.Description, Description = p13.Description,
IsRelatedToRole = p13.IsRelatedToRole,
IsRelatedToPerson = p13.IsRelatedToPerson,
IsDisposable = p13.IsDisposable, IsDisposable = p13.IsDisposable,
SetFor = p13.SetFor, SetFor = p13.SetFor,
HasDisposed = p13.HasDisposed, HasDisposed = p13.HasDisposed,
@ -235,8 +215,6 @@ namespace Brizco.Domain.Mappers
result.Type = p14.Type; result.Type = p14.Type;
result.Title = p14.Title; result.Title = p14.Title;
result.Description = p14.Description; result.Description = p14.Description;
result.IsRelatedToRole = p14.IsRelatedToRole;
result.IsRelatedToPerson = p14.IsRelatedToPerson;
result.IsDisposable = p14.IsDisposable; result.IsDisposable = p14.IsDisposable;
result.SetFor = p14.SetFor; result.SetFor = p14.SetFor;
result.HasDisposed = p14.HasDisposed; result.HasDisposed = p14.HasDisposed;
@ -255,8 +233,6 @@ namespace Brizco.Domain.Mappers
Type = p16.Type, Type = p16.Type,
Title = p16.Title, Title = p16.Title,
Description = p16.Description, Description = p16.Description,
IsRelatedToRole = p16.IsRelatedToRole,
IsRelatedToPerson = p16.IsRelatedToPerson,
IsDisposable = p16.IsDisposable, IsDisposable = p16.IsDisposable,
SetFor = p16.SetFor, SetFor = p16.SetFor,
HasDisposed = p16.HasDisposed, HasDisposed = p16.HasDisposed,

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.Mappers
{
public static partial class PositionMapper
{
}
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.Mappers
{
public static partial class PositionUserMapper
{
}
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.Mappers
{
public static partial class RoutineMapper
{
}
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.Mappers
{
public static partial class SectionMapper
{
}
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.Mappers
{
public static partial class ShiftRoutineMapper
{
}
}

View File

@ -18,8 +18,6 @@ namespace Brizco.Domain.Mappers
Type = p1.Type, Type = p1.Type,
Title = p1.Title, Title = p1.Title,
Description = p1.Description, Description = p1.Description,
IsRelatedToRole = p1.IsRelatedToRole,
IsRelatedToPerson = p1.IsRelatedToPerson,
IsDisposable = p1.IsDisposable, IsDisposable = p1.IsDisposable,
SetFor = p1.SetFor, SetFor = p1.SetFor,
HasDisposed = p1.HasDisposed, HasDisposed = p1.HasDisposed,
@ -40,8 +38,6 @@ namespace Brizco.Domain.Mappers
result.Type = p2.Type; result.Type = p2.Type;
result.Title = p2.Title; result.Title = p2.Title;
result.Description = p2.Description; result.Description = p2.Description;
result.IsRelatedToRole = p2.IsRelatedToRole;
result.IsRelatedToPerson = p2.IsRelatedToPerson;
result.IsDisposable = p2.IsDisposable; result.IsDisposable = p2.IsDisposable;
result.SetFor = p2.SetFor; result.SetFor = p2.SetFor;
result.HasDisposed = p2.HasDisposed; result.HasDisposed = p2.HasDisposed;
@ -57,8 +53,6 @@ namespace Brizco.Domain.Mappers
Type = p4.Type, Type = p4.Type,
Title = p4.Title, Title = p4.Title,
Description = p4.Description, Description = p4.Description,
IsRelatedToRole = p4.IsRelatedToRole,
IsRelatedToPerson = p4.IsRelatedToPerson,
IsDisposable = p4.IsDisposable, IsDisposable = p4.IsDisposable,
SetFor = p4.SetFor, SetFor = p4.SetFor,
HasDisposed = p4.HasDisposed, HasDisposed = p4.HasDisposed,
@ -74,8 +68,6 @@ namespace Brizco.Domain.Mappers
Type = p5.Type, Type = p5.Type,
Title = p5.Title, Title = p5.Title,
Description = p5.Description, Description = p5.Description,
IsRelatedToRole = p5.IsRelatedToRole,
IsRelatedToPerson = p5.IsRelatedToPerson,
IsDisposable = p5.IsDisposable, IsDisposable = p5.IsDisposable,
SetFor = p5.SetFor, SetFor = p5.SetFor,
HasDisposed = p5.HasDisposed, HasDisposed = p5.HasDisposed,
@ -96,8 +88,6 @@ namespace Brizco.Domain.Mappers
result.Type = p6.Type; result.Type = p6.Type;
result.Title = p6.Title; result.Title = p6.Title;
result.Description = p6.Description; result.Description = p6.Description;
result.IsRelatedToRole = p6.IsRelatedToRole;
result.IsRelatedToPerson = p6.IsRelatedToPerson;
result.IsDisposable = p6.IsDisposable; result.IsDisposable = p6.IsDisposable;
result.SetFor = p6.SetFor; result.SetFor = p6.SetFor;
result.HasDisposed = p6.HasDisposed; result.HasDisposed = p6.HasDisposed;
@ -113,8 +103,6 @@ namespace Brizco.Domain.Mappers
Type = p8.Type, Type = p8.Type,
Title = p8.Title, Title = p8.Title,
Description = p8.Description, Description = p8.Description,
IsRelatedToRole = p8.IsRelatedToRole,
IsRelatedToPerson = p8.IsRelatedToPerson,
IsDisposable = p8.IsDisposable, IsDisposable = p8.IsDisposable,
SetFor = p8.SetFor, SetFor = p8.SetFor,
HasDisposed = p8.HasDisposed, HasDisposed = p8.HasDisposed,
@ -130,168 +118,142 @@ namespace Brizco.Domain.Mappers
Type = p9.Type, Type = p9.Type,
Title = p9.Title, Title = p9.Title,
Description = p9.Description, Description = p9.Description,
IsRelatedToRole = p9.IsRelatedToRole,
IsRelatedToPerson = p9.IsRelatedToPerson,
IsDisposable = p9.IsDisposable, IsDisposable = p9.IsDisposable,
SetFor = p9.SetFor, SetFor = p9.SetFor,
HasDisposed = p9.HasDisposed, HasDisposed = p9.HasDisposed,
Amount = p9.Amount, Amount = p9.Amount,
AmountType = p9.AmountType, AmountType = p9.AmountType,
Users = funcMain1(p9.Users), Shifts = funcMain1(p9.Shifts),
Shifts = funcMain2(p9.Shifts), Positions = funcMain2(p9.Positions),
Roles = funcMain3(p9.Roles),
Id = p9.Id 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; return null;
} }
Task result = p14 ?? new Task(); Task result = p13 ?? new Task();
result.Type = p13.Type; result.Type = p12.Type;
result.Title = p13.Title; result.Title = p12.Title;
result.Description = p13.Description; result.Description = p12.Description;
result.IsRelatedToRole = p13.IsRelatedToRole; result.IsDisposable = p12.IsDisposable;
result.IsRelatedToPerson = p13.IsRelatedToPerson; result.SetFor = p12.SetFor;
result.IsDisposable = p13.IsDisposable; result.HasDisposed = p12.HasDisposed;
result.SetFor = p13.SetFor; result.Amount = p12.Amount;
result.HasDisposed = p13.HasDisposed; result.AmountType = p12.AmountType;
result.Amount = p13.Amount; result.Shifts = funcMain3(p12.Shifts, result.Shifts);
result.AmountType = p13.AmountType; result.Positions = funcMain4(p12.Positions, result.Positions);
result.Users = funcMain4(p13.Users, result.Users); result.Id = p12.Id;
result.Shifts = funcMain5(p13.Shifts, result.Shifts);
result.Roles = funcMain6(p13.Roles, result.Roles);
result.Id = p13.Id;
return result; return result;
} }
public static Expression<Func<TaskLDto, Task>> ProjectLDtoToTask => p21 => new Task() public static Expression<Func<TaskLDto, Task>> ProjectLDtoToTask => p18 => new Task()
{ {
Type = p21.Type, Type = p18.Type,
Title = p21.Title, Title = p18.Title,
Description = p21.Description, Description = p18.Description,
IsRelatedToRole = p21.IsRelatedToRole, IsDisposable = p18.IsDisposable,
IsRelatedToPerson = p21.IsRelatedToPerson, SetFor = p18.SetFor,
IsDisposable = p21.IsDisposable, HasDisposed = p18.HasDisposed,
SetFor = p21.SetFor, Amount = p18.Amount,
HasDisposed = p21.HasDisposed, AmountType = p18.AmountType,
Amount = p21.Amount, Shifts = p18.Shifts.Select<TaskShiftSDto, TaskShift>(p19 => new TaskShift()
AmountType = p21.AmountType,
Users = p21.Users.Select<TaskUserSDto, TaskUser>(p22 => new TaskUser()
{ {
UserId = p22.UserId, TaskId = p19.TaskId,
TaskId = p22.TaskId ShiftId = p19.ShiftId
}).ToList<TaskUser>(),
Shifts = p21.Shifts.Select<TaskShiftSDto, TaskShift>(p23 => new TaskShift()
{
TaskId = p23.TaskId,
ShiftId = p23.ShiftId
}).ToList<TaskShift>(), }).ToList<TaskShift>(),
Roles = p21.Roles.Select<TaskRoleSDto, TaskRole>(p24 => new TaskRole() Positions = p18.Positions.Select<TaskPositionSDto, TaskPosition>(p20 => new TaskPosition()
{ {
RoleId = p24.RoleId, PositionId = p20.PositionId,
TaskId = p24.TaskId, TaskId = p20.TaskId,
Id = p24.Id Id = p20.Id
}).ToList<TaskRole>(), }).ToList<TaskPosition>(),
Id = p21.Id 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, Type = p21.Type,
Title = p25.Title, Title = p21.Title,
Description = p25.Description, Description = p21.Description,
IsRelatedToRole = p25.IsRelatedToRole, IsDisposable = p21.IsDisposable,
IsRelatedToPerson = p25.IsRelatedToPerson, SetFor = p21.SetFor,
IsDisposable = p25.IsDisposable, HasDisposed = p21.HasDisposed,
SetFor = p25.SetFor, Amount = p21.Amount,
HasDisposed = p25.HasDisposed, AmountType = p21.AmountType,
Amount = p25.Amount, Shifts = funcMain5(p21.Shifts),
AmountType = p25.AmountType, Positions = funcMain6(p21.Positions),
Users = funcMain7(p25.Users), Id = p21.Id
Shifts = funcMain8(p25.Shifts),
Roles = funcMain9(p25.Roles),
Id = p25.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; return null;
} }
TaskLDto result = p30 ?? new TaskLDto(); TaskLDto result = p25 ?? new TaskLDto();
result.Type = p29.Type; result.Type = p24.Type;
result.Title = p29.Title; result.Title = p24.Title;
result.Description = p29.Description; result.Description = p24.Description;
result.IsRelatedToRole = p29.IsRelatedToRole; result.IsDisposable = p24.IsDisposable;
result.IsRelatedToPerson = p29.IsRelatedToPerson; result.SetFor = p24.SetFor;
result.IsDisposable = p29.IsDisposable; result.HasDisposed = p24.HasDisposed;
result.SetFor = p29.SetFor; result.Amount = p24.Amount;
result.HasDisposed = p29.HasDisposed; result.AmountType = p24.AmountType;
result.Amount = p29.Amount; result.Shifts = funcMain7(p24.Shifts, result.Shifts);
result.AmountType = p29.AmountType; result.Positions = funcMain8(p24.Positions, result.Positions);
result.Users = funcMain10(p29.Users, result.Users); result.Id = p24.Id;
result.Shifts = funcMain11(p29.Shifts, result.Shifts);
result.Roles = funcMain12(p29.Roles, result.Roles);
result.Id = p29.Id;
return result; return result;
} }
public static Expression<Func<Task, TaskLDto>> ProjectToLDto => p37 => new TaskLDto() public static Expression<Func<Task, TaskLDto>> ProjectToLDto => p30 => new TaskLDto()
{ {
Type = p37.Type, Type = p30.Type,
Title = p37.Title, Title = p30.Title,
Description = p37.Description, Description = p30.Description,
IsRelatedToRole = p37.IsRelatedToRole, IsDisposable = p30.IsDisposable,
IsRelatedToPerson = p37.IsRelatedToPerson, SetFor = p30.SetFor,
IsDisposable = p37.IsDisposable, HasDisposed = p30.HasDisposed,
SetFor = p37.SetFor, Amount = p30.Amount,
HasDisposed = p37.HasDisposed, AmountType = p30.AmountType,
Amount = p37.Amount, Shifts = p30.Shifts.Select<TaskShift, TaskShiftSDto>(p31 => new TaskShiftSDto()
AmountType = p37.AmountType,
Users = p37.Users.Select<TaskUser, TaskUserSDto>(p38 => new TaskUserSDto()
{ {
UserId = p38.UserId, ShiftId = p31.ShiftId,
TaskId = p38.TaskId TaskId = p31.TaskId
}).ToList<TaskUserSDto>(),
Shifts = p37.Shifts.Select<TaskShift, TaskShiftSDto>(p39 => new TaskShiftSDto()
{
ShiftId = p39.ShiftId,
TaskId = p39.TaskId
}).ToList<TaskShiftSDto>(), }).ToList<TaskShiftSDto>(),
Roles = p37.Roles.Select<TaskRole, TaskRoleSDto>(p40 => new TaskRoleSDto() Positions = p30.Positions.Select<TaskPosition, TaskPositionSDto>(p32 => new TaskPositionSDto()
{ {
RoleId = p40.RoleId, PositionId = p32.PositionId,
TaskId = p40.TaskId, TaskId = p32.TaskId,
Id = p40.Id Id = p32.Id
}).ToList<TaskRoleSDto>(), }).ToList<TaskPositionSDto>(),
Id = p37.Id Id = p30.Id
}; };
private static List<TaskUser> funcMain1(List<TaskUserSDto> p10) private static List<TaskShift> funcMain1(List<TaskShiftSDto> p10)
{ {
if (p10 == null) if (p10 == null)
{ {
return null; return null;
} }
List<TaskUser> result = new List<TaskUser>(p10.Count); List<TaskShift> result = new List<TaskShift>(p10.Count);
int i = 0; int i = 0;
int len = p10.Count; int len = p10.Count;
while (i < len) while (i < len)
{ {
TaskUserSDto item = p10[i]; TaskShiftSDto item = p10[i];
result.Add(item == null ? null : new TaskUser() result.Add(item == null ? null : new TaskShift()
{ {
UserId = item.UserId, TaskId = item.TaskId,
TaskId = item.TaskId ShiftId = item.ShiftId
}); });
i++; i++;
} }
@ -299,20 +261,46 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskShift> funcMain2(List<TaskShiftSDto> p11) private static List<TaskPosition> funcMain2(List<TaskPositionSDto> p11)
{ {
if (p11 == null) if (p11 == null)
{ {
return null; return null;
} }
List<TaskShift> result = new List<TaskShift>(p11.Count); List<TaskPosition> result = new List<TaskPosition>(p11.Count);
int i = 0; int i = 0;
int len = p11.Count; int len = p11.Count;
while (i < len) 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<TaskShift> funcMain3(List<TaskShiftSDto> p14, List<TaskShift> p15)
{
if (p14 == null)
{
return null;
}
List<TaskShift> result = new List<TaskShift>(p14.Count);
int i = 0;
int len = p14.Count;
while (i < len)
{
TaskShiftSDto item = p14[i];
result.Add(item == null ? null : new TaskShift() result.Add(item == null ? null : new TaskShift()
{ {
TaskId = item.TaskId, TaskId = item.TaskId,
@ -324,23 +312,23 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskRole> funcMain3(List<TaskRoleSDto> p12) private static List<TaskPosition> funcMain4(List<TaskPositionSDto> p16, List<TaskPosition> p17)
{ {
if (p12 == null) if (p16 == null)
{ {
return null; return null;
} }
List<TaskRole> result = new List<TaskRole>(p12.Count); List<TaskPosition> result = new List<TaskPosition>(p16.Count);
int i = 0; int i = 0;
int len = p12.Count; int len = p16.Count;
while (i < len) while (i < len)
{ {
TaskRoleSDto item = p12[i]; TaskPositionSDto item = p16[i];
result.Add(item == null ? null : new TaskRole() result.Add(item == null ? null : new TaskPosition()
{ {
RoleId = item.RoleId, PositionId = item.PositionId,
TaskId = item.TaskId, TaskId = item.TaskId,
Id = item.Id Id = item.Id
}); });
@ -350,23 +338,23 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskUser> funcMain4(List<TaskUserSDto> p15, List<TaskUser> p16) private static List<TaskShiftSDto> funcMain5(List<TaskShift> p22)
{ {
if (p15 == null) if (p22 == null)
{ {
return null; return null;
} }
List<TaskUser> result = new List<TaskUser>(p15.Count); List<TaskShiftSDto> result = new List<TaskShiftSDto>(p22.Count);
int i = 0; int i = 0;
int len = p15.Count; int len = p22.Count;
while (i < len) while (i < len)
{ {
TaskUserSDto item = p15[i]; TaskShift item = p22[i];
result.Add(item == null ? null : new TaskUser() result.Add(item == null ? null : new TaskShiftSDto()
{ {
UserId = item.UserId, ShiftId = item.ShiftId,
TaskId = item.TaskId TaskId = item.TaskId
}); });
i++; i++;
@ -375,48 +363,23 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskShift> funcMain5(List<TaskShiftSDto> p17, List<TaskShift> p18) private static List<TaskPositionSDto> funcMain6(List<TaskPosition> p23)
{ {
if (p17 == null) if (p23 == null)
{ {
return null; return null;
} }
List<TaskShift> result = new List<TaskShift>(p17.Count); List<TaskPositionSDto> result = new List<TaskPositionSDto>(p23.Count);
int i = 0; int i = 0;
int len = p17.Count; int len = p23.Count;
while (i < len) while (i < len)
{ {
TaskShiftSDto item = p17[i]; TaskPosition item = p23[i];
result.Add(item == null ? null : new TaskShift() result.Add(item == null ? null : new TaskPositionSDto()
{ {
TaskId = item.TaskId, PositionId = item.PositionId,
ShiftId = item.ShiftId
});
i++;
}
return result;
}
private static List<TaskRole> funcMain6(List<TaskRoleSDto> p19, List<TaskRole> p20)
{
if (p19 == null)
{
return null;
}
List<TaskRole> result = new List<TaskRole>(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,
TaskId = item.TaskId, TaskId = item.TaskId,
Id = item.Id Id = item.Id
}); });
@ -426,45 +389,20 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskUserSDto> funcMain7(List<TaskUser> p26) private static List<TaskShiftSDto> funcMain7(List<TaskShift> p26, List<TaskShiftSDto> p27)
{ {
if (p26 == null) if (p26 == null)
{ {
return null; return null;
} }
List<TaskUserSDto> result = new List<TaskUserSDto>(p26.Count); List<TaskShiftSDto> result = new List<TaskShiftSDto>(p26.Count);
int i = 0; int i = 0;
int len = p26.Count; int len = p26.Count;
while (i < len) while (i < len)
{ {
TaskUser item = p26[i]; TaskShift item = p26[i];
result.Add(item == null ? null : new TaskUserSDto()
{
UserId = item.UserId,
TaskId = item.TaskId
});
i++;
}
return result;
}
private static List<TaskShiftSDto> funcMain8(List<TaskShift> p27)
{
if (p27 == null)
{
return null;
}
List<TaskShiftSDto> result = new List<TaskShiftSDto>(p27.Count);
int i = 0;
int len = p27.Count;
while (i < len)
{
TaskShift item = p27[i];
result.Add(item == null ? null : new TaskShiftSDto() result.Add(item == null ? null : new TaskShiftSDto()
{ {
ShiftId = item.ShiftId, ShiftId = item.ShiftId,
@ -476,99 +414,23 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskRoleSDto> funcMain9(List<TaskRole> p28) private static List<TaskPositionSDto> funcMain8(List<TaskPosition> p28, List<TaskPositionSDto> p29)
{ {
if (p28 == null) if (p28 == null)
{ {
return null; return null;
} }
List<TaskRoleSDto> result = new List<TaskRoleSDto>(p28.Count); List<TaskPositionSDto> result = new List<TaskPositionSDto>(p28.Count);
int i = 0; int i = 0;
int len = p28.Count; int len = p28.Count;
while (i < len) while (i < len)
{ {
TaskRole item = p28[i]; TaskPosition item = p28[i];
result.Add(item == null ? null : new TaskRoleSDto() result.Add(item == null ? null : new TaskPositionSDto()
{ {
RoleId = item.RoleId, PositionId = item.PositionId,
TaskId = item.TaskId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskUserSDto> funcMain10(List<TaskUser> p31, List<TaskUserSDto> p32)
{
if (p31 == null)
{
return null;
}
List<TaskUserSDto> result = new List<TaskUserSDto>(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<TaskShiftSDto> funcMain11(List<TaskShift> p33, List<TaskShiftSDto> p34)
{
if (p33 == null)
{
return null;
}
List<TaskShiftSDto> result = new List<TaskShiftSDto>(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<TaskRoleSDto> funcMain12(List<TaskRole> p35, List<TaskRoleSDto> p36)
{
if (p35 == null)
{
return null;
}
List<TaskRoleSDto> result = new List<TaskRoleSDto>(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,
TaskId = item.TaskId, TaskId = item.TaskId,
Id = item.Id Id = item.Id
}); });

View File

@ -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<Func<TaskPositionSDto, TaskPosition>> 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<Func<TaskPosition, TaskPositionSDto>> ProjectToSDto => p8 => new TaskPositionSDto()
{
PositionId = p8.PositionId,
TaskId = p8.TaskId,
Id = p8.Id
};
}
}

View File

@ -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<Func<TaskRoleSDto, TaskRole>> 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<Func<TaskRole, TaskRoleSDto>> ProjectToSDto => p8 => new TaskRoleSDto()
{
RoleId = p8.RoleId,
TaskId = p8.TaskId,
Id = p8.Id
};
}
}

View File

@ -0,0 +1,6 @@
namespace Brizco.Domain.Mappers
{
public static partial class TaskRoutineMapper
{
}
}

View File

@ -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<Func<TaskUserSDto, TaskUser>> 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<Func<TaskUser, TaskUserSDto>> ProjectToSDto => p8 => new TaskUserSDto()
{
UserId = p8.UserId,
TaskId = p8.TaskId
};
}
}

View File

@ -28,8 +28,6 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateActivityComman
request.Title, request.Title,
request.Description, request.Description,
request.Type, request.Type,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable, request.IsDisposable,
request.SetFor, request.SetFor,
request.HasDisposed, request.HasDisposed,
@ -37,20 +35,17 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateActivityComman
request.AmountType, request.AmountType,
complexId); complexId);
if (task.IsRelatedToPerson)
{
if (request.Users.Count == 0)
throw new AppException("اگر فعالیت برای یک فرد انتخاب شده باشد باید لیست افراد را ارسال نمایید");
task.AddUser(request.Users.ToArray());
}
if (task.IsRelatedToRole)
{ if (request.Shifts.Count == 0)
if (request.Roles.Count == 0) throw new AppException(
throw new AppException( "اگر فعالیت برای یک شیفت نقش انتخاب شده باشد باید لیست شیفت ها را ارسال نمایید");
"اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید"); task.AddShift(request.Shifts.ToArray());
task.AddShift(request.Roles.ToArray());
} if (request.Positions.Count == 0)
throw new AppException(
"اگر فعالیت برای یک پوزیشن نقش انتخاب شده باشد باید لیست پوزیشن ها را ارسال نمایید");
task.AddPosition(request.Positions.ToArray());
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().Add(task); _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().Add(task);

View File

@ -32,8 +32,6 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityComman
request.Title, request.Title,
request.Description, request.Description,
request.Type, request.Type,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable, request.IsDisposable,
request.SetFor, request.SetFor,
request.HasDisposed, request.HasDisposed,

View File

@ -28,6 +28,8 @@ public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Shi
request.EndAt, request.EndAt,
complexId); complexId);
request.DayOfWeeks.ForEach(d => shift.SetDay(d));
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift); _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
await _repositoryWrapper.CommitAsync(cancellationToken); await _repositoryWrapper.CommitAsync(cancellationToken);

View File

@ -15,6 +15,7 @@ public class GetShiftPlanQueryHandler : IRequestHandler<GetShiftQuery, ShiftSDto
.Where(s => s.Id == request.id) .Where(s => s.Id == request.id)
.Select(ShiftMapper.ProjectToSDto) .Select(ShiftMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken); .FirstOrDefaultAsync(cancellationToken);
if (shift == null) if (shift == null)
throw new AppException("Shift not found", ApiResultStatusCode.NotFound); throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
return shift; return shift;

View File

@ -1,4 +1,6 @@
namespace Brizco.Repository.Handlers.Shift; using Brizco.Domain.Entities.Shift;
namespace Brizco.Repository.Handlers.Shift;
public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, bool> public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, bool>
{ {
@ -29,7 +31,25 @@ public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, boo
request.EndAt, request.EndAt,
complexId); complexId);
newShift.Id = request.Id; newShift.Id = request.Id;
var shiftDays = await _repositoryWrapper.SetRepository<ShiftDay>()
.TableNoTracking.Where(sd => sd.ShiftId == request.Id)
.ToListAsync(cancellationToken);
foreach (var shiftDay in shiftDays.Where(shiftDay => !request.DayOfWeeks.Contains(shiftDay.DayOfWeek)))
{
_repositoryWrapper.SetRepository<ShiftDay>()
.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<Domain.Entities.Shift.Shift>() _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.Update(newShift); .Update(newShift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -20,9 +20,6 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, T
.Create(request.Title, .Create(request.Title,
request.Description, request.Description,
request.Type, request.Type,
request.IsRelatedToShift,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable, request.IsDisposable,
request.SetFor, request.SetFor,
request.HasDisposed, request.HasDisposed,
@ -30,19 +27,15 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, T
request.AmountType, request.AmountType,
complexId); complexId);
if (task.IsRelatedToPerson)
{
if (request.Users.Count == 0)
throw new AppException("اگر فعالیت برای یک فرد انتخاب شده باشد باید لیست افراد را ارسال نمایید");
task.AddUser(request.Users.ToArray());
}
if (task.IsRelatedToRole)
{ if (request.Shifts.Count == 0)
if (request.Roles.Count == 0) throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید"); task.AddShift(request.Shifts.ToArray());
task.AddShift(request.Roles.ToArray());
} if (request.Positions.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
task.AddShift(request.Positions.ToArray());
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>().Add(task); _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>().Add(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -26,9 +26,6 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, b
var newTask = Domain.Entities.Task.Task.Create(request.Title, var newTask = Domain.Entities.Task.Task.Create(request.Title,
request.Description, request.Description,
request.Type, request.Type,
request.IsRelatedToShift,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable, request.IsDisposable,
request.SetFor, request.SetFor,
request.HasDisposed, request.HasDisposed,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
/// <inheritdoc />
public partial class editTask : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TaskDays",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DayOfWeek = table.Column<int>(type: "integer", nullable: false),
TaskId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TaskDays",
schema: "public");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
/// <inheritdoc />
public partial class editUserNationalId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "InternationalId",
schema: "public",
table: "Users",
newName: "NationalId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "NationalId",
schema: "public",
table: "Users",
newName: "InternationalId");
}
}
}

View File

@ -1,32 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
/// <inheritdoc />
public partial class editUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "SelectedComplexUserRoleId",
schema: "public",
table: "Users",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SelectedComplexUserRoleId",
schema: "public",
table: "Users");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
/// <inheritdoc />
public partial class editShift : Migration
{
/// <inheritdoc />
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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "PlanDate",
schema: "public",
table: "ShiftPlans",
newName: "StartAt");
migrationBuilder.AddColumn<bool>(
name: "IsRelatedToShift",
schema: "public",
table: "Tasks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
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<Guid>(type: "uuid", nullable: false),
ShiftId = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
DayOfWeek = table.Column<int>(type: "integer", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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");
}
}
}

View File

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Brizco.Repository.Migrations namespace Brizco.Repository.Migrations
{ {
[DbContext(typeof(ApplicationContext))] [DbContext(typeof(ApplicationContext))]
[Migration("20231025193834_editUser")] [Migration("20231113110204_init")]
partial class editUser partial class init
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -163,6 +163,200 @@ namespace Brizco.Repository.Migrations
b.ToTable("ComplexUserRoles", "public"); b.ToTable("ComplexUserRoles", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationUserId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("PositionId")
.HasColumnType("uuid");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.HasIndex("PositionId");
b.ToTable("PositionUsers", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ComplexId");
b.ToTable("Sections", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ComplexId");
b.ToTable("Routines", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -273,9 +467,6 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<DateTime>("EndAt")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -286,6 +477,9 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<DateTime>("PlanDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("RemovedAt") b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
@ -296,9 +490,6 @@ namespace Brizco.Repository.Migrations
b.Property<Guid>("ShiftId") b.Property<Guid>("ShiftId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<DateTime>("StartAt")
.HasColumnType("timestamp without time zone");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ShiftId"); b.HasIndex("ShiftId");
@ -351,6 +542,51 @@ namespace Brizco.Repository.Migrations
b.ToTable("ShiftPlanUsers", "public"); b.ToTable("ShiftPlanUsers", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("RoutineId")
.HasColumnType("uuid");
b.Property<Guid>("ShiftId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoutineId");
b.HasIndex("ShiftId");
b.ToTable("ShiftRoutines", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -387,15 +623,6 @@ namespace Brizco.Repository.Migrations
b.Property<bool>("IsDisposable") b.Property<bool>("IsDisposable")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("IsRelatedToPerson")
.HasColumnType("boolean");
b.Property<bool>("IsRelatedToRole")
.HasColumnType("boolean");
b.Property<bool>("IsRelatedToShift")
.HasColumnType("boolean");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -477,7 +704,52 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskDays", "public"); b.ToTable("TaskDays", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("PositionId")
.HasColumnType("uuid");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("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<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -507,7 +779,7 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("RoleId") b.Property<Guid>("RoutineId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid>("TaskId") b.Property<Guid>("TaskId")
@ -515,11 +787,11 @@ namespace Brizco.Repository.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("RoleId"); b.HasIndex("RoutineId");
b.HasIndex("TaskId"); b.HasIndex("TaskId");
b.ToTable("TaskRoles", "public"); b.ToTable("TaskRoutines", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
@ -567,51 +839,6 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskShifts", "public"); b.ToTable("TaskShifts", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("TaskId")
.HasColumnType("uuid");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TaskId");
b.HasIndex("UserId");
b.ToTable("TaskUsers", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -906,6 +1133,66 @@ namespace Brizco.Repository.Migrations
b.Navigation("Role"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
@ -958,6 +1245,25 @@ namespace Brizco.Repository.Migrations
b.Navigation("ShiftPlan"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
@ -980,16 +1286,16 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task"); 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() .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("PositionId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Roles") .WithMany("Positions")
.HasForeignKey("TaskId") .HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
@ -999,6 +1305,25 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
@ -1018,25 +1343,6 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
@ -1113,11 +1419,30 @@ namespace Brizco.Repository.Migrations
b.Navigation("Roles"); b.Navigation("Roles");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
{
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 => modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{ {
b.Navigation("Days"); b.Navigation("Days");
b.Navigation("Plans"); b.Navigation("Plans");
b.Navigation("Routines");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
@ -1129,11 +1454,11 @@ namespace Brizco.Repository.Migrations
{ {
b.Navigation("Days"); b.Navigation("Days");
b.Navigation("Roles"); b.Navigation("Positions");
b.Navigation("Routines");
b.Navigation("Shifts"); b.Navigation("Shifts");
b.Navigation("Users");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

View File

@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Brizco.Repository.Migrations namespace Brizco.Repository.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class Init : Migration public partial class init : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@ -45,7 +45,8 @@ namespace Brizco.Repository.Migrations
Id = table.Column<Guid>(type: "uuid", nullable: false), Id = table.Column<Guid>(type: "uuid", nullable: false),
FirstName = table.Column<string>(type: "text", nullable: false), FirstName = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false), LastName = table.Column<string>(type: "text", nullable: false),
InternationalId = table.Column<string>(type: "text", nullable: false), NationalId = table.Column<string>(type: "text", nullable: false),
SelectedComplexUserRoleId = table.Column<Guid>(type: "uuid", nullable: false),
BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Gender = table.Column<int>(type: "integer", nullable: false), Gender = table.Column<int>(type: "integer", nullable: false),
SignUpStatus = table.Column<int>(type: "integer", nullable: false), SignUpStatus = table.Column<int>(type: "integer", nullable: false),
@ -94,6 +95,64 @@ namespace Brizco.Repository.Migrations
principalColumn: "Id"); principalColumn: "Id");
}); });
migrationBuilder.CreateTable(
name: "Routines",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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( migrationBuilder.CreateTable(
name: "Shifts", name: "Shifts",
schema: "public", schema: "public",
@ -134,9 +193,6 @@ namespace Brizco.Repository.Migrations
Type = table.Column<int>(type: "integer", nullable: false), Type = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(type: "text", nullable: false), Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false), Description = table.Column<string>(type: "text", nullable: false),
IsRelatedToShift = table.Column<bool>(type: "boolean", nullable: false),
IsRelatedToRole = table.Column<bool>(type: "boolean", nullable: false),
IsRelatedToPerson = table.Column<bool>(type: "boolean", nullable: false),
IsDisposable = table.Column<bool>(type: "boolean", nullable: false), IsDisposable = table.Column<bool>(type: "boolean", nullable: false),
SetFor = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), SetFor = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
HasDisposed = table.Column<bool>(type: "boolean", nullable: false), HasDisposed = table.Column<bool>(type: "boolean", nullable: false),
@ -320,6 +376,43 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "Positions",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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( migrationBuilder.CreateTable(
name: "ShiftDays", name: "ShiftDays",
schema: "public", schema: "public",
@ -354,8 +447,7 @@ namespace Brizco.Repository.Migrations
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uuid", nullable: false), Id = table.Column<Guid>(type: "uuid", nullable: false),
StartAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), PlanDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
EndAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ShiftId = table.Column<Guid>(type: "uuid", nullable: false), ShiftId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
@ -378,12 +470,47 @@ namespace Brizco.Repository.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "TaskRoles", name: "ShiftRoutines",
schema: "public", schema: "public",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uuid", nullable: false), Id = table.Column<Guid>(type: "uuid", nullable: false),
RoleId = table.Column<Guid>(type: "uuid", nullable: false), RoutineId = table.Column<Guid>(type: "uuid", nullable: false),
ShiftId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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<Guid>(type: "uuid", nullable: false),
DayOfWeek = table.Column<int>(type: "integer", nullable: false),
TaskId = table.Column<Guid>(type: "uuid", nullable: false), TaskId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
@ -395,16 +522,44 @@ namespace Brizco.Repository.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_TaskRoles", x => x.Id); table.PrimaryKey("PK_TaskDays", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_TaskRoles_Roles_RoleId", name: "FK_TaskDays_Tasks_TaskId",
column: x => x.RoleId, column: x => x.TaskId,
principalSchema: "public", principalSchema: "public",
principalTable: "Roles", principalTable: "Tasks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "TaskRoutines",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TaskId = table.Column<Guid>(type: "uuid", nullable: false),
RoutineId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TaskRoutines", x => x.Id);
table.ForeignKey(
name: "FK_TaskRoutines_Routines_RoutineId",
column: x => x.RoutineId,
principalSchema: "public",
principalTable: "Routines",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
table.ForeignKey( table.ForeignKey(
name: "FK_TaskRoles_Tasks_TaskId", name: "FK_TaskRoutines_Tasks_TaskId",
column: x => x.TaskId, column: x => x.TaskId,
principalSchema: "public", principalSchema: "public",
principalTable: "Tasks", principalTable: "Tasks",
@ -447,41 +602,6 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "TaskUsers",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
TaskId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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( migrationBuilder.CreateTable(
name: "ComplexUserRoles", name: "ComplexUserRoles",
schema: "public", schema: "public",
@ -517,6 +637,76 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "PositionUsers",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
PositionId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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<Guid>(type: "uuid", nullable: false),
PositionId = table.Column<Guid>(type: "uuid", nullable: false),
TaskId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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( migrationBuilder.CreateTable(
name: "ShiftPlanUsers", name: "ShiftPlanUsers",
schema: "public", schema: "public",
@ -588,6 +778,30 @@ namespace Brizco.Repository.Migrations
table: "Logins", table: "Logins",
column: "UserId"); 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( migrationBuilder.CreateIndex(
name: "IX_RoleClaims_RoleId", name: "IX_RoleClaims_RoleId",
schema: "public", schema: "public",
@ -607,6 +821,18 @@ namespace Brizco.Repository.Migrations
column: "NormalizedName", column: "NormalizedName",
unique: true); 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( migrationBuilder.CreateIndex(
name: "IX_ShiftDays_ShiftId", name: "IX_ShiftDays_ShiftId",
schema: "public", schema: "public",
@ -631,6 +857,18 @@ namespace Brizco.Repository.Migrations
table: "ShiftPlanUsers", table: "ShiftPlanUsers",
column: "ShiftPlanId"); 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( migrationBuilder.CreateIndex(
name: "IX_Shifts_ComplexId", name: "IX_Shifts_ComplexId",
schema: "public", schema: "public",
@ -638,15 +876,33 @@ namespace Brizco.Repository.Migrations
column: "ComplexId"); column: "ComplexId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_TaskRoles_RoleId", name: "IX_TaskDays_TaskId",
schema: "public", schema: "public",
table: "TaskRoles", table: "TaskDays",
column: "RoleId"); column: "TaskId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_TaskRoles_TaskId", name: "IX_TaskPositions_PositionId",
schema: "public", 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"); column: "TaskId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
@ -667,18 +923,6 @@ namespace Brizco.Repository.Migrations
table: "TaskShifts", table: "TaskShifts",
column: "TaskId"); 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( migrationBuilder.CreateIndex(
name: "IX_UserRoles_RoleId", name: "IX_UserRoles_RoleId",
schema: "public", schema: "public",
@ -714,6 +958,10 @@ namespace Brizco.Repository.Migrations
name: "Logins", name: "Logins",
schema: "public"); schema: "public");
migrationBuilder.DropTable(
name: "PositionUsers",
schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RoleClaims", name: "RoleClaims",
schema: "public"); schema: "public");
@ -727,17 +975,25 @@ namespace Brizco.Repository.Migrations
schema: "public"); schema: "public");
migrationBuilder.DropTable( 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"); schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "TaskShifts", name: "TaskShifts",
schema: "public"); schema: "public");
migrationBuilder.DropTable(
name: "TaskUsers",
schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Tokens", name: "Tokens",
schema: "public"); schema: "public");
@ -754,6 +1010,14 @@ namespace Brizco.Repository.Migrations
name: "ShiftPlans", name: "ShiftPlans",
schema: "public"); schema: "public");
migrationBuilder.DropTable(
name: "Positions",
schema: "public");
migrationBuilder.DropTable(
name: "Routines",
schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Tasks", name: "Tasks",
schema: "public"); schema: "public");
@ -770,6 +1034,10 @@ namespace Brizco.Repository.Migrations
name: "Shifts", name: "Shifts",
schema: "public"); schema: "public");
migrationBuilder.DropTable(
name: "Sections",
schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Complexes", name: "Complexes",
schema: "public"); schema: "public");

View File

@ -160,6 +160,200 @@ namespace Brizco.Repository.Migrations
b.ToTable("ComplexUserRoles", "public"); b.ToTable("ComplexUserRoles", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("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<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationUserId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("PositionId")
.HasColumnType("uuid");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.HasIndex("PositionId");
b.ToTable("PositionUsers", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ComplexId");
b.ToTable("Sections", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ComplexId");
b.ToTable("Routines", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -214,6 +408,49 @@ namespace Brizco.Repository.Migrations
b.ToTable("Shifts", "public"); b.ToTable("Shifts", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<int>("DayOfWeek")
.HasColumnType("integer");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ShiftId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ShiftId");
b.ToTable("ShiftDays", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -302,6 +539,51 @@ namespace Brizco.Repository.Migrations
b.ToTable("ShiftPlanUsers", "public"); b.ToTable("ShiftPlanUsers", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("RoutineId")
.HasColumnType("uuid");
b.Property<Guid>("ShiftId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoutineId");
b.HasIndex("ShiftId");
b.ToTable("ShiftRoutines", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -338,12 +620,6 @@ namespace Brizco.Repository.Migrations
b.Property<bool>("IsDisposable") b.Property<bool>("IsDisposable")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("IsRelatedToPerson")
.HasColumnType("boolean");
b.Property<bool>("IsRelatedToRole")
.HasColumnType("boolean");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -425,7 +701,52 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskDays", "public"); b.ToTable("TaskDays", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("PositionId")
.HasColumnType("uuid");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("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<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -455,7 +776,7 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("RoleId") b.Property<Guid>("RoutineId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid>("TaskId") b.Property<Guid>("TaskId")
@ -463,11 +784,11 @@ namespace Brizco.Repository.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("RoleId"); b.HasIndex("RoutineId");
b.HasIndex("TaskId"); b.HasIndex("TaskId");
b.ToTable("TaskRoles", "public"); b.ToTable("TaskRoutines", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
@ -515,51 +836,6 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskShifts", "public"); b.ToTable("TaskShifts", "public");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("TaskId")
.HasColumnType("uuid");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TaskId");
b.HasIndex("UserId");
b.ToTable("TaskUsers", "public");
});
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -854,6 +1130,66 @@ namespace Brizco.Repository.Migrations
b.Navigation("Role"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
@ -865,6 +1201,17 @@ namespace Brizco.Repository.Migrations
b.Navigation("Complex"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
@ -895,6 +1242,25 @@ namespace Brizco.Repository.Migrations
b.Navigation("ShiftPlan"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
@ -917,16 +1283,16 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task"); 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() .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("PositionId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Roles") .WithMany("Positions")
.HasForeignKey("TaskId") .HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
@ -936,6 +1302,25 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
@ -955,25 +1340,6 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task"); 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 => modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
{ {
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
@ -1050,9 +1416,30 @@ namespace Brizco.Repository.Migrations
b.Navigation("Roles"); b.Navigation("Roles");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
{
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 => modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{ {
b.Navigation("Days");
b.Navigation("Plans"); b.Navigation("Plans");
b.Navigation("Routines");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
@ -1064,11 +1451,11 @@ namespace Brizco.Repository.Migrations
{ {
b.Navigation("Days"); b.Navigation("Days");
b.Navigation("Roles"); b.Navigation("Positions");
b.Navigation("Routines");
b.Navigation("Shifts"); b.Navigation("Shifts");
b.Navigation("Users");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }