feat(AddPositionPermission) , feat(CheckPermissionEndpoint) , refactor(PositionLDto)
- Add position permission entitiy - Add permission to create and update position CQRS - Add check position permission endpoint in AuthController - Add permission in PositionLDto - Ready for test new featuremaster
parent
bb6cba1ed9
commit
97cb9ae82b
|
@ -31,8 +31,16 @@ public class AuthController : ICarterModule
|
|||
.WithDisplayName("SignUp")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("/check/{permission}/permission", CheckPermissionAsync)
|
||||
.WithDisplayName("Check Permission")
|
||||
.WithDescription("Check position permission by permission name , it will check current active shit and positions")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
private async Task<IResult> CheckPermissionAsync([FromRoute] string permission, [FromServices] IAccountService accountService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await accountService.CheckPositionPermission(permission, cancellationToken));
|
||||
public async Task<IResult> SignUpComplex([FromBody] SignUpRequestDto request, IAccountService accountService, CancellationToken cancellationToken) =>
|
||||
TypedResults.Ok(await accountService.CompleteComplexSignUpAsync(request,cancellationToken));
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ public class PositionController : ICarterModule
|
|||
group.MapDelete("{id}", Delete)
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManagePositions))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
}
|
||||
|
||||
// GET:Get All Entity
|
||||
|
|
|
@ -7,5 +7,6 @@ public interface IAccountService : IScopedDependency
|
|||
public Task<VerifyCodeResponseDto> GetVerifyCodeAsync(string phoneNumber);
|
||||
public Task<bool> ForgetPasswordAsync(string phoneNumber);
|
||||
public Task<bool> CheckMemberShipAsync(string phoneNumber);
|
||||
public Task<bool> CheckPositionPermission(string permission,CancellationToken cancellationToken=default);
|
||||
public Task<AccessToken<ApplicationUserSDto, ComplexUserRoleSDto>> CompleteComplexSignUpAsync(SignUpRequestDto requestDto, CancellationToken cancellationToken);
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
namespace Brizco.Core.CoreServices;
|
||||
using Brizco.Domain.Entities.Shift;
|
||||
using System.Threading;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace Brizco.Core.CoreServices;
|
||||
|
||||
public class AccountService : IAccountService
|
||||
{
|
||||
|
@ -64,6 +68,39 @@ public class AccountService : IAccountService
|
|||
return true;
|
||||
}
|
||||
|
||||
public async Task<bool> CheckPositionPermission(string permission, CancellationToken cancellationToken=default)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is wrong");
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is wrong");
|
||||
if (_currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
if(!Guid.TryParse(_currentUserService.ComplexId,out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
var query = from shiftPlan in _repositoryWrapper.SetRepository<ShiftPlan>().Entities
|
||||
join shift in _repositoryWrapper.SetRepository<Shift>().Entities on shiftPlan.ShiftId equals shift.Id
|
||||
where shiftPlan.PlanFor.Date == DateTime.Today.Date && shiftPlan.ComplexId == complexId &&
|
||||
shift.EndAt >= DateTime.Now.TimeOfDay && shift.StartAt <= DateTime.Now.TimeOfDay
|
||||
select shiftPlan;
|
||||
|
||||
var currentShiftPlan = await query.FirstOrDefaultAsync(cancellationToken);
|
||||
if (currentShiftPlan == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "No active shift plan");
|
||||
|
||||
var userCurrentPositionPermissions =
|
||||
await (from positionPermission in _repositoryWrapper.SetRepository<PositionPermission>().Entities
|
||||
join position in _repositoryWrapper.SetRepository<Position>().Entities on positionPermission.PositionId
|
||||
equals position.Id
|
||||
join shiftPlaneUser in _repositoryWrapper.SetRepository<ShiftPlanUser>().Entities on position.Id equals
|
||||
shiftPlaneUser.PositionId
|
||||
where shiftPlaneUser.ShiftPlanId == currentShiftPlan.Id && shiftPlaneUser.UserId == userId
|
||||
select positionPermission).ToListAsync(cancellationToken);
|
||||
|
||||
return userCurrentPositionPermissions.Any(f => f.Permission == permission);
|
||||
}
|
||||
|
||||
public async Task<VerifyCodeResponseDto> GetVerifyCodeAsync(string phoneNumber)
|
||||
{
|
||||
var newPhoneNumber = StringExtensions.CheckPhoneNumber(phoneNumber);
|
||||
|
@ -150,8 +187,7 @@ public class AccountService : IAccountService
|
|||
|
||||
return await CompleteLogin(user, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<AccessToken<ApplicationUserSDto,ComplexUserRoleSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
|
||||
{
|
||||
AccessToken<ApplicationUserSDto,ComplexUserRoleSDto> jwt;
|
||||
|
|
|
@ -41,6 +41,7 @@ public class PageService : IPageService
|
|||
.Where(a => a.PlanFor.Date == DateTime.Today.Date && a.ComplexId == complexId)
|
||||
.Select(ShiftPlanMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var names = new List<string>();
|
||||
names.AddRange(todayShiftPlans.SelectMany(sp => sp.Users).Select(s => s.UserFullName).ToList());
|
||||
var page = new AppDashboardPageDto
|
||||
|
|
|
@ -1,9 +1,18 @@
|
|||
namespace Brizco.Domain.CommandQueries.Commands;
|
||||
|
||||
public sealed record CreatePositionCommand(string Title, string Description, Guid SectionId)
|
||||
public sealed record CreatePositionCommand(
|
||||
string Title,
|
||||
string Description,
|
||||
Guid SectionId,
|
||||
List<string> Permissions)
|
||||
: IRequest<PositionSDto>;
|
||||
|
||||
public sealed record UpdatePositionCommand(Guid Id, string Title, string Description, Guid SectionId)
|
||||
public sealed record UpdatePositionCommand(
|
||||
Guid Id,
|
||||
string Title,
|
||||
string Description,
|
||||
Guid SectionId,
|
||||
List<string> Permissions)
|
||||
: IRequest<bool>;
|
||||
|
||||
public sealed record DeletePositionCommand(Guid Id)
|
||||
|
|
|
@ -10,4 +10,5 @@ public class PositionLDto : BaseDto<PositionLDto, Position>
|
|||
|
||||
public Guid SectionId { get; set; }
|
||||
public string SectionName { get; set; } = string.Empty;
|
||||
public List<string> Permissions { get; set; } = new();
|
||||
}
|
|
@ -50,5 +50,13 @@ public partial class Position
|
|||
{
|
||||
return new Position(name, description, complexId, sectionId);
|
||||
}
|
||||
|
||||
public void AddPermission(string permission)
|
||||
=> Permissions.Add(PositionPermission.Create(permission, Id));
|
||||
}
|
||||
|
||||
public partial class PositionPermission
|
||||
{
|
||||
public static PositionPermission Create(string permission, Guid positionId)
|
||||
=> new PositionPermission(permission, positionId);
|
||||
}
|
||||
|
|
|
@ -17,12 +17,17 @@ public partial class Position : ApiEntity
|
|||
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<PositionPermission> Permissions { get; set; } = new();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
namespace Brizco.Domain.Entities.Complex;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class PositionPermission : ApiEntity
|
||||
{
|
||||
public PositionPermission()
|
||||
{
|
||||
|
||||
}
|
||||
public PositionPermission(string permission,Guid positionId)
|
||||
{
|
||||
PositionId = positionId;
|
||||
Permission = permission;
|
||||
}
|
||||
public Guid PositionId { get; set; }
|
||||
public Position? Position { get; set; }
|
||||
public string Permission { get; set; } = string.Empty;
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Brizco.Domain.Dtos.LargeDtos;
|
||||
using Brizco.Domain.Dtos.SmallDtos;
|
||||
|
@ -93,81 +95,171 @@ namespace Brizco.Domain.Mappers
|
|||
Name = p9.SectionName,
|
||||
Id = p9.SectionId
|
||||
},
|
||||
Permissions = funcMain1(p9.Permissions),
|
||||
Id = p9.Id
|
||||
};
|
||||
}
|
||||
public static Position AdaptTo(this PositionLDto p10, Position p11)
|
||||
public static Position AdaptTo(this PositionLDto p11, Position p12)
|
||||
{
|
||||
if (p11 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Position result = p12 ?? new Position();
|
||||
|
||||
result.Name = p11.Name;
|
||||
result.Description = p11.Description;
|
||||
result.ComplexId = p11.ComplexId;
|
||||
result.Complex = funcMain2(new Never(), result.Complex, p11);
|
||||
result.SectionId = p11.SectionId;
|
||||
result.Section = funcMain3(new Never(), result.Section, p11);
|
||||
result.Permissions = funcMain4(p11.Permissions, result.Permissions);
|
||||
result.Id = p11.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static PositionLDto AdaptToLDto(this Position p19)
|
||||
{
|
||||
return p19 == null ? null : new PositionLDto()
|
||||
{
|
||||
Name = p19.Name,
|
||||
Description = p19.Description,
|
||||
ComplexId = p19.ComplexId,
|
||||
SectionId = p19.SectionId,
|
||||
SectionName = p19.Section != null ? p19.Section.Name : string.Empty,
|
||||
Permissions = funcMain5(p19.Permissions.Select<PositionPermission, string>(funcMain6)),
|
||||
Id = p19.Id
|
||||
};
|
||||
}
|
||||
public static PositionLDto AdaptTo(this Position p21, PositionLDto p22)
|
||||
{
|
||||
if (p21 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
PositionLDto result = p22 ?? new PositionLDto();
|
||||
|
||||
result.Name = p21.Name;
|
||||
result.Description = p21.Description;
|
||||
result.ComplexId = p21.ComplexId;
|
||||
result.SectionId = p21.SectionId;
|
||||
result.SectionName = p21.Section != null ? p21.Section.Name : string.Empty;
|
||||
result.Permissions = funcMain7(p21.Permissions.Select<PositionPermission, string>(funcMain6), result.Permissions);
|
||||
result.Id = p21.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Position, PositionLDto>> ProjectToLDto => p25 => new PositionLDto()
|
||||
{
|
||||
Name = p25.Name,
|
||||
Description = p25.Description,
|
||||
ComplexId = p25.ComplexId,
|
||||
SectionId = p25.SectionId,
|
||||
SectionName = p25.Section != null ? p25.Section.Name : string.Empty,
|
||||
Permissions = (List<string>)p25.Permissions.Select<PositionPermission, string>(p => p.Permission),
|
||||
Id = p25.Id
|
||||
};
|
||||
|
||||
private static List<PositionPermission> funcMain1(List<string> p10)
|
||||
{
|
||||
if (p10 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Position result = p11 ?? new Position();
|
||||
List<PositionPermission> result = new List<PositionPermission>(p10.Count);
|
||||
|
||||
result.Name = p10.Name;
|
||||
result.Description = p10.Description;
|
||||
result.ComplexId = p10.ComplexId;
|
||||
result.Complex = funcMain1(new Never(), result.Complex, p10);
|
||||
result.SectionId = p10.SectionId;
|
||||
result.Section = funcMain2(new Never(), result.Section, p10);
|
||||
result.Id = p10.Id;
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
string item = p10[i];
|
||||
result.Add(item == null ? null : (PositionPermission)Convert.ChangeType((object)item, typeof(PositionPermission)));
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
public static PositionLDto AdaptToLDto(this Position p16)
|
||||
|
||||
private static Complex funcMain2(Never p13, Complex p14, PositionLDto p11)
|
||||
{
|
||||
return p16 == null ? null : new PositionLDto()
|
||||
{
|
||||
Name = p16.Name,
|
||||
Description = p16.Description,
|
||||
ComplexId = p16.ComplexId,
|
||||
SectionId = p16.SectionId,
|
||||
SectionName = p16.Section != null ? p16.Section.Name : string.Empty,
|
||||
Id = p16.Id
|
||||
};
|
||||
Complex result = p14 ?? new Complex();
|
||||
|
||||
result.Id = p11.ComplexId;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static PositionLDto AdaptTo(this Position p17, PositionLDto p18)
|
||||
|
||||
private static Section funcMain3(Never p15, Section p16, PositionLDto p11)
|
||||
{
|
||||
Section result = p16 ?? new Section();
|
||||
|
||||
result.Name = p11.SectionName;
|
||||
result.Id = p11.SectionId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<PositionPermission> funcMain4(List<string> p17, List<PositionPermission> p18)
|
||||
{
|
||||
if (p17 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
PositionLDto result = p18 ?? new PositionLDto();
|
||||
List<PositionPermission> result = new List<PositionPermission>(p17.Count);
|
||||
|
||||
result.Name = p17.Name;
|
||||
result.Description = p17.Description;
|
||||
result.ComplexId = p17.ComplexId;
|
||||
result.SectionId = p17.SectionId;
|
||||
result.SectionName = p17.Section != null ? p17.Section.Name : string.Empty;
|
||||
result.Id = p17.Id;
|
||||
return result;
|
||||
int i = 0;
|
||||
int len = p17.Count;
|
||||
|
||||
}
|
||||
public static Expression<Func<Position, PositionLDto>> ProjectToLDto => p19 => new PositionLDto()
|
||||
{
|
||||
Name = p19.Name,
|
||||
Description = p19.Description,
|
||||
ComplexId = p19.ComplexId,
|
||||
SectionId = p19.SectionId,
|
||||
SectionName = p19.Section != null ? p19.Section.Name : string.Empty,
|
||||
Id = p19.Id
|
||||
};
|
||||
|
||||
private static Complex funcMain1(Never p12, Complex p13, PositionLDto p10)
|
||||
{
|
||||
Complex result = p13 ?? new Complex();
|
||||
|
||||
result.Id = p10.ComplexId;
|
||||
while (i < len)
|
||||
{
|
||||
string item = p17[i];
|
||||
result.Add(item == null ? null : (PositionPermission)Convert.ChangeType((object)item, typeof(PositionPermission)));
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static Section funcMain2(Never p14, Section p15, PositionLDto p10)
|
||||
private static List<string> funcMain5(IEnumerable<string> p20)
|
||||
{
|
||||
Section result = p15 ?? new Section();
|
||||
if (p20 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<string> result = new List<string>();
|
||||
|
||||
result.Name = p10.SectionName;
|
||||
result.Id = p10.SectionId;
|
||||
IEnumerator<string> enumerator = p20.GetEnumerator();
|
||||
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
string item = enumerator.Current;
|
||||
result.Add(item);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static string funcMain6(PositionPermission p)
|
||||
{
|
||||
return p.Permission;
|
||||
}
|
||||
|
||||
private static List<string> funcMain7(IEnumerable<string> p23, List<string> p24)
|
||||
{
|
||||
if (p23 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<string> result = new List<string>();
|
||||
|
||||
IEnumerator<string> enumerator = p23.GetEnumerator();
|
||||
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
string item = enumerator.Current;
|
||||
result.Add(item);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
namespace Brizco.Domain.Mappers
|
||||
{
|
||||
public static partial class PositionPermissionMapper
|
||||
{
|
||||
}
|
||||
}
|
|
@ -64,6 +64,7 @@ public class MapsterRegister : IRegister
|
|||
|
||||
config.NewConfig<Position, PositionLDto>()
|
||||
.Map("SectionName", org => org.Section != null ? org.Section.Name : string.Empty)
|
||||
.Map(o=>o.Permissions, org => org.Permissions.Select(p=>p.Permission))
|
||||
.TwoWays();
|
||||
|
||||
config.NewConfig<ComplexUser, ComplexUserSDto>()
|
||||
|
|
|
@ -27,8 +27,7 @@ public class CreatePositionCommandHandler : IRequestHandler<CreatePositionComman
|
|||
complexId,
|
||||
request.SectionId);
|
||||
|
||||
//foreach (var userId in request.UserIds)
|
||||
// entity.AddUser(userId);
|
||||
request.Permissions.ForEach(f=>entity.AddPermission(f));
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>().Add(entity);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
|
|
@ -13,9 +13,9 @@ public class UpdatePositionCommandHandler : IRequestHandler<UpdatePositionComman
|
|||
|
||||
public async Task<bool> Handle(UpdatePositionCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>()
|
||||
var ent = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>()
|
||||
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken);
|
||||
if (shift == null)
|
||||
if (ent == null)
|
||||
throw new AppException("Postion not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
if (_currentUserService.ComplexId == null)
|
||||
|
@ -28,6 +28,23 @@ public class UpdatePositionCommandHandler : IRequestHandler<UpdatePositionComman
|
|||
complexId,
|
||||
request.SectionId);
|
||||
newPosition.Id = request.Id;
|
||||
newPosition.CreatedAt = ent.CreatedAt;
|
||||
newPosition.CreatedBy = ent.CreatedBy;
|
||||
|
||||
var permissionsDb = await _repositoryWrapper.SetRepository<PositionPermission>()
|
||||
.TableNoTracking
|
||||
.Where(f => f.PositionId == ent.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var permissionDb in permissionsDb.Where(p=>!request.Permissions.Contains(p.Permission)))
|
||||
{
|
||||
_repositoryWrapper.SetRepository<PositionPermission>()
|
||||
.Delete(permissionDb);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
|
||||
foreach (var permission in request.Permissions.Where(p => !permissionsDb.Select(d => d.Permission).Contains(p)))
|
||||
newPosition.AddPermission(permission);
|
||||
|
||||
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>()
|
||||
.Update(newPosition);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -37,6 +37,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -46,6 +47,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -56,6 +58,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SupportPhone")
|
||||
|
@ -80,6 +83,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -89,12 +93,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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>("UserId")
|
||||
|
@ -122,6 +128,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -131,12 +138,14 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
|
@ -164,6 +173,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -177,6 +187,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -187,6 +198,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("SectionId")
|
||||
|
@ -201,6 +213,50 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Positions", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.PositionPermission", 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<string>("Permission")
|
||||
.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("PositionId");
|
||||
|
||||
b.ToTable("PositionPermissions", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
@ -214,6 +270,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -227,6 +284,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -237,6 +295,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -259,6 +318,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -272,6 +332,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -282,6 +343,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -304,6 +366,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -320,12 +383,14 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<TimeSpan>("StartAt")
|
||||
|
@ -352,6 +417,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
|
@ -364,12 +430,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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")
|
||||
|
@ -402,6 +470,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsCompleted")
|
||||
|
@ -414,6 +483,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("PlanFor")
|
||||
|
@ -423,6 +493,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoutineId")
|
||||
|
@ -457,6 +528,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -466,6 +538,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("PositionId")
|
||||
|
@ -475,6 +548,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftPlanId")
|
||||
|
@ -504,6 +578,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -513,12 +588,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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")
|
||||
|
@ -555,6 +632,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -582,12 +660,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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<int>("ScheduleType")
|
||||
|
@ -624,6 +704,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
|
@ -636,12 +717,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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")
|
||||
|
@ -664,6 +747,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -673,6 +757,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("PositionId")
|
||||
|
@ -682,6 +767,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
|
@ -706,6 +792,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -715,12 +802,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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")
|
||||
|
@ -748,6 +837,7 @@ namespace Brizco.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -757,12 +847,14 @@ namespace Brizco.Repository.Migrations
|
|||
.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")
|
||||
|
@ -1101,6 +1193,16 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Section");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.PositionPermission", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
||||
.WithMany("Permissions")
|
||||
.HasForeignKey("PositionId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Position");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
|
@ -1371,6 +1473,11 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Roles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
|
||||
{
|
||||
b.Navigation("Permissions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||
{
|
||||
b.Navigation("Positions");
|
||||
|
|
Loading…
Reference in New Issue