feat : add cqrs and endpoints

add models , dtos , cqrs and endpoint
release/production
Amir Hossein Khademi 2023-09-18 09:45:02 +03:30
parent fbf57d7766
commit 24c4a23079
65 changed files with 3761 additions and 290 deletions

View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"mapster.tool": {
"version": "8.3.0",
"commands": [
"dotnet-mapster"
]
}
}
}

View File

@ -57,7 +57,8 @@
<Using Include="Brizco.Common.Models.Entity" />
<Using Include="Brizco.Common.Models.Exception" />
<Using Include="Brizco.Common.Models.Mapper" />
<Using Include="Brizco.Domain.CommandQueries.Shift" />
<Using Include="Brizco.Domain.CommandQueries.Commands" />
<Using Include="Brizco.Domain.CommandQueries.Queries" />
<Using Include="Brizco.Domain.Entities" />
<Using Include="Brizco.Repository.Repositories.Base.Contracts" />
<Using Include="Carter" />

View File

@ -1,6 +1,4 @@
using MediatR;
namespace Brizco.Api.Controllers;
namespace Brizco.Api.Controllers;
public class ShiftController : ICarterModule
{
public ShiftController()
@ -11,11 +9,11 @@ public class ShiftController : ICarterModule
var group = app.NewVersionedApi("Shift").MapGroup($"api/shift");
group.MapGet("", GetAllAsync)
.WithDisplayName("GetAll")
.WithDisplayName("GetAllShift")
.HasApiVersion(1.0);
group.MapGet("{id}", GetAsync)
.WithName("GetOne")
.WithDisplayName("GetOneShift")
.HasApiVersion(1.0);
group.MapPost("", Post)
@ -30,11 +28,11 @@ public class ShiftController : ICarterModule
// GET:Get All Entity
public async Task<IResult> GetAllAsync(ISender sender, CancellationToken cancellationToken)
=> TypedResults.Ok(await sender.Send(Activator.CreateInstance<TGetAllQuery>(), cancellationToken));
=> TypedResults.Ok(await sender.Send(new GetShiftsQuery(), cancellationToken));
// GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
=> TypedResults.Ok(await sender.Send(Activator.CreateInstance<TGetOneQuery>()));
=> TypedResults.Ok(await sender.Send(new GetShiftQuery(id)));
// POST:Create Entity
public async Task<IResult> Post([FromBody] CreateShiftCommand ent, ISender mediator, CancellationToken cancellationToken)

View File

@ -0,0 +1,51 @@
namespace Brizco.Api.Controllers;
public class TaskController : ICarterModule
{
public TaskController()
{
}
public virtual void AddRoutes(IEndpointRouteBuilder app)
{
var group = app.NewVersionedApi("Task").MapGroup($"api/task");
group.MapGet("", GetAllAsync)
.WithDisplayName("GetAllTask")
.HasApiVersion(1.0);
group.MapGet("{id}", GetAsync)
.WithDisplayName("GetOneTask")
.HasApiVersion(1.0);
group.MapPost("", Post)
.HasApiVersion(1.0);
group.MapPut("", Put)
.HasApiVersion(1.0);
group.MapDelete("", Delete)
.HasApiVersion(1.0);
}
// GET:Get All Entity
public async Task<IResult> GetAllAsync(ISender sender, CancellationToken cancellationToken)
=> TypedResults.Ok(await sender.Send(new GetTasksQuery(), cancellationToken));
// GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, ISender sender, CancellationToken cancellationToken)
=> TypedResults.Ok(await sender.Send(new GetTaskQuery(id)));
// POST:Create Entity
public async Task<IResult> Post([FromBody] CreateTaskCommand ent, ISender mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(ent, cancellationToken));
// PUT:Update Entity
public async Task<IResult> Put([FromBody] UpdateTaskCommand ent, ISender mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(ent, cancellationToken));
// DELETE:Delete Entity
public async Task<IResult> Delete(Guid id, ISender mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new DeleteTaskCommand(id), cancellationToken));
}

View File

@ -27,7 +27,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Handlers\Shift\" />
<Folder Include="Models\" />
<Folder Include="Extensions\" />
<Folder Include="Repositories\Base\" />
@ -41,9 +40,10 @@
<ItemGroup>
<Using Include=" Brizco.Repository.Repositories.Base.Contracts" />
<Using Include="Brizco.Common.Models.Api" />
<Using Include="Brizco.Common.Models.Exception" />
<Using Include="Brizco.Domain.CommandQueries.Commands" />
<Using Include="Brizco.Domain.CommandQueries.Queries" />
<Using Include="Brizco.Domain.CommandQueries.Shift" />
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
<Using Include="MediatR" />
<Using Include="Brizco.Common.Extensions" />
@ -66,5 +66,6 @@
<Using Include="StackExchange.Redis" />
<Using Include="System.Diagnostics" />
<Using Include="System.Reflection" />
<Using Include="Brizco.Domain.Mappers" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,57 @@
using Brizco.Domain.Dtos.LargDtos;
namespace Brizco.Repository.Handlers.Activity;
public class CreateActivityCommandHandler : IRequestHandler<CreateActivityCommand, ActivityLDto>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public CreateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<ActivityLDto> Handle(CreateActivityCommand request, CancellationToken cancellationToken)
{
var task = Domain.Entities.Task.Activity
.Create(
request.Status,
request.DoneAt,
request.PerformanceDescription,
request.Title,
request.Description,
request.Type,
request.IsRelatedToShift,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable,
request.SetFor,
request.HasDisposed,
request.Amount,
request.AmountType);
if (task.IsRelatedToPerson)
{
if (request.Users.Count == 0)
throw new AppException("اگر فعالیت برای یک فرد انتخاب شده باشد باید لیست افراد را ارسال نمایید");
task.AddUser(request.Users.ToArray());
}
if (task.IsRelatedToRole)
{
if (request.Roles.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
task.AddShift(request.Roles.ToArray());
}
if (task.IsRelatedToShift)
{
if (request.Shifts.Count == 0)
throw new AppException("اگر فعالیت برای یک شیفت انتخاب شده باشد باید لیست شیفت ها را ارسال نمایید");
task.AddRole(request.Shifts.ToArray());
}
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().Add(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return task.AdaptToLDto();
}
}

View File

@ -0,0 +1,24 @@
namespace Brizco.Repository.Handlers.Activity;
public class DeleteActivityCommandHandler : IRequestHandler<DeleteActivityCommand, bool>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public DeleteActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<bool> Handle(DeleteActivityCommand request, CancellationToken cancellationToken)
{
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
.TableNoTracking
.FirstOrDefaultAsync(s => s.Id == request.id, cancellationToken);
if (task == null)
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
.Delete(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -0,0 +1,21 @@
namespace Brizco.Repository.Handlers.Activity;
public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, List<ActivitySDto>>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public GetActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<List<ActivitySDto>> Handle(GetActivitiesQuery request, CancellationToken cancellationToken)
{
var tasks = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking
.OrderByDescending(s => s.CreatedAt)
.Skip(request.page * 15).Take(15)
.Select(ActivityMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
return tasks;
}
}

View File

@ -0,0 +1,25 @@
using Brizco.Domain.Dtos.LargDtos;
namespace Brizco.Repository.Handlers.Activity;
public class GetActivityQueryHandler : IRequestHandler<GetActivityQuery, ActivityLDto>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public GetActivityQueryHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<ActivityLDto> Handle(GetActivityQuery request, CancellationToken cancellationToken)
{
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
.TableNoTracking
.Where(s => s.Id == request.id)
.Select(ActivityMapper.ProjectToLDto)
.FirstOrDefaultAsync(cancellationToken);
if (task == null)
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
return task;
}
}

View File

@ -0,0 +1,43 @@
namespace Brizco.Repository.Handlers.Activity;
public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityCommand, bool>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<bool> Handle(UpdateActivityCommand request, CancellationToken cancellationToken)
{
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.Id,cancellationToken);
if (task == null)
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
var newTask = Domain.Entities.Task.Activity.Create(
request.Status,
request.DoneAt,
request.PerformanceDescription,
request.Title,
request.Description,
request.Type,
request.IsRelatedToShift,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable,
request.SetFor,
request.HasDisposed,
request.Amount,
request.AmountType);
newTask.Id = request.Id;
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>()
.Update(newTask);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -1,6 +1,6 @@
namespace Brizco.Repository.Handlers.Shift;
public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand,Domain.Entities.Shift.Shift>
public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Domain.Entities.Shift.Shift>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public CreateShiftCommandHandler(IRepositoryWrapper repositoryWrapper)
@ -15,7 +15,7 @@ public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand,Doma
request.StartAt,
request.EndAt);
request.DayOfWeeks.ForEach(d=>shift.SetDay(d));
request.DayOfWeeks.ForEach(d => shift.SetDay(d));
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -0,0 +1,24 @@
namespace Brizco.Repository.Handlers.Shift;
public class DeleteShiftCommandHandler : IRequestHandler<DeleteShiftCommand, bool>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public DeleteShiftCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<bool> Handle(DeleteShiftCommand request, CancellationToken cancellationToken)
{
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.TableNoTracking
.FirstOrDefaultAsync(s => s.Id == request.id, cancellationToken);
if (shift == null)
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.Delete(shift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -0,0 +1,22 @@
namespace Brizco.Repository.Handlers.Shift;
public class GetShiftQueryHandler : IRequestHandler<GetShiftQuery, ShiftSDto>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public GetShiftQueryHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<ShiftSDto> Handle(GetShiftQuery request, CancellationToken cancellationToken)
{
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.TableNoTracking
.Where(s => s.Id == request.id)
.Select(ShiftMapper.ProjectToSDto)
.FirstOrDefaultAsync(cancellationToken);
if (shift == null)
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
return shift;
}
}

View File

@ -1,6 +1,6 @@
namespace Brizco.Repository.Handlers.Shift;
public class GetShiftsQueryHandler : IRequestHandler<GetShiftsQuery,List<ShiftSDto>>
public class GetShiftsQueryHandler : IRequestHandler<GetShiftsQuery, List<ShiftSDto>>
{
private readonly IRepositoryWrapper _repositoryWrapper;
@ -11,8 +11,9 @@ public class GetShiftsQueryHandler : IRequestHandler<GetShiftsQuery,List<ShiftSD
public async Task<List<ShiftSDto>> Handle(GetShiftsQuery request, CancellationToken cancellationToken)
{
var shifts = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().TableNoTracking
.Skip(request.page * 15).Take(15)
.OrderByDescending(s => s.CreatedAt)
.Skip(request.page * 15).Take(15)
.Select(ShiftMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
return shifts;

View File

@ -0,0 +1,27 @@
namespace Brizco.Repository.Handlers.Shift;
public class UpdateShiftCommandHandler : IRequestHandler<UpdateShiftCommand, bool>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public UpdateShiftCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<bool> Handle(UpdateShiftCommand request, CancellationToken cancellationToken)
{
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.id);
if (shift == null)
throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
var newShift = Domain.Entities.Shift.Shift.Create(request.Title, request.Description, request.StartAt, request.EndAt);
newShift.Id = request.id;
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.Update(newShift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -0,0 +1,52 @@
using Brizco.Domain.Dtos.LargDtos;
namespace Brizco.Repository.Handlers.Task;
public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, TaskLDto>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public CreateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<TaskLDto> Handle(CreateTaskCommand request, CancellationToken cancellationToken)
{
var task = Domain.Entities.Task.Task
.Create(request.Title,
request.Description,
request.Type,
request.IsRelatedToShift,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable,
request.SetFor,
request.HasDisposed,
request.Amount,
request.AmountType);
if (task.IsRelatedToPerson)
{
if (request.Users.Count == 0)
throw new AppException("اگر فعالیت برای یک فرد انتخاب شده باشد باید لیست افراد را ارسال نمایید");
task.AddUser(request.Users.ToArray());
}
if (task.IsRelatedToRole)
{
if (request.Roles.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
task.AddShift(request.Roles.ToArray());
}
if (task.IsRelatedToShift)
{
if (request.Shifts.Count == 0)
throw new AppException("اگر فعالیت برای یک شیفت انتخاب شده باشد باید لیست شیفت ها را ارسال نمایید");
task.AddRole(request.Shifts.ToArray());
}
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>().Add(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return task.AdaptToLDto();
}
}

View File

@ -0,0 +1,24 @@
namespace Brizco.Repository.Handlers.Task;
public class DeleteActivityCommandHandler : IRequestHandler<DeleteTaskCommand, bool>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public DeleteActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<bool> Handle(DeleteTaskCommand request, CancellationToken cancellationToken)
{
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
.TableNoTracking
.FirstOrDefaultAsync(s => s.Id == request.id, cancellationToken);
if (task == null)
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
.Delete(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -0,0 +1,25 @@
using Brizco.Domain.Dtos.LargDtos;
namespace Brizco.Repository.Handlers.Task;
public class GetActivityQueryHandler : IRequestHandler<GetTaskQuery, TaskLDto>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public GetActivityQueryHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<TaskLDto> Handle(GetTaskQuery request, CancellationToken cancellationToken)
{
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
.TableNoTracking
.Where(s => s.Id == request.id)
.Select(TaskMapper.ProjectToLDto)
.FirstOrDefaultAsync(cancellationToken);
if (task == null)
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
return task;
}
}

View File

@ -0,0 +1,21 @@
namespace Brizco.Repository.Handlers.Task;
public class GetActivitiesQueryHandler : IRequestHandler<GetTasksQuery, List<TaskSDto>>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public GetActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<List<TaskSDto>> Handle(GetTasksQuery request, CancellationToken cancellationToken)
{
var tasks = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>().TableNoTracking
.OrderByDescending(s => s.CreatedAt)
.Skip(request.page * 15).Take(15)
.Select(TaskMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
return tasks;
}
}

View File

@ -0,0 +1,38 @@
namespace Brizco.Repository.Handlers.Task;
public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, bool>
{
private readonly IRepositoryWrapper _repositoryWrapper;
public UpdateActivityCommandHandler(IRepositoryWrapper repositoryWrapper)
{
_repositoryWrapper = repositoryWrapper;
}
public async Task<bool> Handle(UpdateTaskCommand request, CancellationToken cancellationToken)
{
var task = await _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
.TableNoTracking.FirstOrDefaultAsync(s => s.Id == request.id,cancellationToken);
if (task == null)
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
var newTask = Domain.Entities.Task.Task.Create(request.Title,
request.Description,
request.Type,
request.IsRelatedToShift,
request.IsRelatedToRole,
request.IsRelatedToPerson,
request.IsDisposable,
request.SetFor,
request.HasDisposed,
request.Amount,
request.AmountType);
newTask.Id = request.id;
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
.Update(newTask);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -0,0 +1,932 @@
// <auto-generated />
using System;
using Brizco.Repository.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Brizco.Repository.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20230917141849_editTask")]
partial class editTask
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SupportPhone")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Complexes");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ComplexId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ComplexId");
b.HasIndex("UserId");
b.ToTable("ComplexUsers");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<TimeSpan>("EndAt")
.HasColumnType("interval");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<TimeSpan>("StartAt")
.HasColumnType("interval");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Shifts");
});
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");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("EndAt")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ShiftId")
.HasColumnType("uuid");
b.Property<DateTime>("StartAt")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("ShiftId");
b.ToTable("ShiftPlans");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationUserId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ShiftPlanId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.HasIndex("ShiftPlanId");
b.ToTable("ShiftPlanUsers");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("Amount")
.HasColumnType("integer");
b.Property<int>("AmountType")
.HasColumnType("integer");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("HasDisposed")
.HasColumnType("boolean");
b.Property<bool>("IsDisposable")
.HasColumnType("boolean");
b.Property<bool>("IsRelatedToPerson")
.HasColumnType("boolean");
b.Property<bool>("IsRelatedToRole")
.HasColumnType("boolean");
b.Property<bool>("IsRelatedToShift")
.HasColumnType("boolean");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("SetFor")
.HasColumnType("timestamp without time zone");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Tasks");
b.HasDiscriminator<string>("Discriminator").HasValue("Task");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.Property<Guid>("TaskId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("TaskId");
b.ToTable("TaskRoles");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ShiftId")
.HasColumnType("uuid");
b.Property<Guid>("TaskId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ShiftId");
b.HasIndex("TaskId");
b.ToTable("TaskShifts");
});
modelBuilder.Entity("Brizco.Domain.Entities.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");
});
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("FirstName")
.HasColumnType("text");
b.Property<int>("Gender")
.HasColumnType("integer");
b.Property<string>("LastName")
.HasColumnType("text");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
{
b.HasBaseType("Brizco.Domain.Entities.Task.Task");
b.Property<DateTime>("DoneAt")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsDone")
.HasColumnType("boolean");
b.Property<string>("PerformanceDescription")
.HasColumnType("text");
b.Property<int>("Status")
.HasColumnType("integer");
b.HasDiscriminator().HasValue("Activity");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
{
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
.WithMany()
.HasForeignKey("ComplexId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Complex");
b.Navigation("User");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
{
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
.WithMany("Days")
.HasForeignKey("ShiftId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Shift");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
.WithMany("Plans")
.HasForeignKey("ShiftId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Shift");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
.WithMany("Users")
.HasForeignKey("ShiftPlanId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser");
b.Navigation("ShiftPlan");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Roles")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Role");
b.Navigation("Task");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
{
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
.WithMany()
.HasForeignKey("ShiftId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Shifts")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Shift");
b.Navigation("Task");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
{
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Users")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Task");
b.Navigation("User");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{
b.Navigation("Days");
b.Navigation("Plans");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{
b.Navigation("Roles");
b.Navigation("Shifts");
b.Navigation("Users");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,208 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
/// <inheritdoc />
public partial class editTask : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "Tasks",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Tasks",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AddColumn<bool>(
name: "IsDone",
table: "Tasks",
type: "boolean",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "Shifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Shifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "SupportPhone",
table: "Complexes",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Complexes",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Address",
table: "Complexes",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "AspNetUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "AspNetUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "AspNetRoles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDone",
table: "Tasks");
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "Tasks",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Tasks",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Title",
table: "Shifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Shifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "SupportPhone",
table: "Complexes",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Complexes",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Address",
table: "Complexes",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "AspNetUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "AspNetUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "AspNetRoles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
}
}

View File

@ -17,129 +17,18 @@ namespace Brizco.Repository.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.10")
.HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Brizco.Domain.Entities.ApplicationRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Brizco.Domain.Entities.ApplicationUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Gender")
.HasColumnType("integer");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
@ -160,7 +49,6 @@ namespace Brizco.Repository.Migrations
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
@ -171,7 +59,6 @@ namespace Brizco.Repository.Migrations
.HasColumnType("text");
b.Property<string>("SupportPhone")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
@ -179,7 +66,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("Complexes");
});
modelBuilder.Entity("Brizco.Domain.Entities.ComplexUser", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -227,7 +114,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("ComplexUsers");
});
modelBuilder.Entity("Brizco.Domain.Entities.Shift", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -241,7 +128,6 @@ namespace Brizco.Repository.Migrations
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<TimeSpan>("EndAt")
@ -268,7 +154,6 @@ namespace Brizco.Repository.Migrations
.HasColumnType("interval");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
@ -276,7 +161,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("Shifts");
});
modelBuilder.Entity("Brizco.Domain.Entities.ShiftDay", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -319,7 +204,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("ShiftDays");
});
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlan", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -365,7 +250,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("ShiftPlans");
});
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlanUser", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -410,7 +295,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("ShiftPlanUsers");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -430,7 +315,6 @@ namespace Brizco.Repository.Migrations
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Discriminator")
@ -473,7 +357,6 @@ namespace Brizco.Repository.Migrations
.HasColumnType("timestamp without time zone");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Type")
@ -488,7 +371,7 @@ namespace Brizco.Repository.Migrations
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Brizco.Domain.Entities.TaskRole", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -533,7 +416,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskRoles");
});
modelBuilder.Entity("Brizco.Domain.Entities.TaskShift", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -578,7 +461,7 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskShifts");
});
modelBuilder.Entity("Brizco.Domain.Entities.TaskUser", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -623,6 +506,113 @@ namespace Brizco.Repository.Migrations
b.ToTable("TaskUsers");
});
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("FirstName")
.HasColumnType("text");
b.Property<int>("Gender")
.HasColumnType("integer");
b.Property<string>("LastName")
.HasColumnType("text");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
@ -726,15 +716,17 @@ namespace Brizco.Repository.Migrations
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Brizco.Domain.Entities.Activity", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
{
b.HasBaseType("Brizco.Domain.Entities.Task");
b.HasBaseType("Brizco.Domain.Entities.Task.Task");
b.Property<DateTime>("DoneAt")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsDone")
.HasColumnType("boolean");
b.Property<string>("PerformanceDescription")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Status")
@ -743,22 +735,15 @@ namespace Brizco.Repository.Migrations
b.HasDiscriminator().HasValue("Activity");
});
modelBuilder.Entity("Brizco.Domain.Entities.SubTask", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
{
b.HasBaseType("Brizco.Domain.Entities.Task");
b.HasDiscriminator().HasValue("SubTask");
});
modelBuilder.Entity("Brizco.Domain.Entities.ComplexUser", b =>
{
b.HasOne("Brizco.Domain.Entities.Complex", "Complex")
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
.WithMany()
.HasForeignKey("ComplexId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "User")
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
@ -769,10 +754,10 @@ namespace Brizco.Repository.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Brizco.Domain.Entities.ShiftDay", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
{
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
.WithMany()
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
.WithMany("Days")
.HasForeignKey("ShiftId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
@ -780,10 +765,10 @@ namespace Brizco.Repository.Migrations
b.Navigation("Shift");
});
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlan", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
.WithMany()
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
.WithMany("Plans")
.HasForeignKey("ShiftId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
@ -791,16 +776,16 @@ namespace Brizco.Repository.Migrations
b.Navigation("Shift");
});
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlanUser", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "ApplicationUser")
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.ShiftPlan", "ShiftPlan")
.WithMany()
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
.WithMany("Users")
.HasForeignKey("ShiftPlanId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
@ -810,16 +795,16 @@ namespace Brizco.Repository.Migrations
b.Navigation("ShiftPlan");
});
modelBuilder.Entity("Brizco.Domain.Entities.TaskRole", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationRole", "Role")
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.Task", "Task")
.WithMany("TaskRoles")
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Roles")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
@ -829,16 +814,16 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task");
});
modelBuilder.Entity("Brizco.Domain.Entities.TaskShift", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
{
b.HasOne("Brizco.Domain.Entities.Shift", "Shift")
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
.WithMany()
.HasForeignKey("ShiftId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.Task", "Task")
.WithMany("TaskShifts")
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Shifts")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
@ -848,15 +833,15 @@ namespace Brizco.Repository.Migrations
b.Navigation("Task");
});
modelBuilder.Entity("Brizco.Domain.Entities.TaskUser", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b =>
{
b.HasOne("Brizco.Domain.Entities.Task", "Task")
.WithMany("TaskUsers")
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
.WithMany("Users")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.ApplicationUser", "User")
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
@ -869,7 +854,7 @@ namespace Brizco.Repository.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationRole", null)
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
@ -878,7 +863,7 @@ namespace Brizco.Repository.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
@ -887,7 +872,7 @@ namespace Brizco.Repository.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
@ -896,13 +881,13 @@ namespace Brizco.Repository.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationRole", null)
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
@ -911,20 +896,32 @@ namespace Brizco.Repository.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("Brizco.Domain.Entities.ApplicationUser", null)
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Brizco.Domain.Entities.Task", b =>
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
{
b.Navigation("TaskRoles");
b.Navigation("Days");
b.Navigation("TaskShifts");
b.Navigation("Plans");
});
b.Navigation("TaskUsers");
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
{
b.Navigation("Roles");
b.Navigation("Shifts");
b.Navigation("Users");
});
#pragma warning restore 612, 618
}

View File

@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>10</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@ -2,12 +2,12 @@
{
public interface IApiEntity
{
string CreatedBy { get; set; }
string ModifiedBy { get; set; }
string RemovedBy { get; set; }
bool IsRemoved { get; set; }
DateTime CreatedAt { get; set; }
DateTime RemovedAt { get; set; }
DateTime ModifiedAt { get; set; }
string CreatedBy { get; }
string ModifiedBy { get; }
string RemovedBy { get; }
bool IsRemoved { get; }
DateTime CreatedAt { get; }
DateTime RemovedAt { get; }
DateTime ModifiedAt { get; }
}
}

View File

@ -12,7 +12,7 @@ namespace Brizco.Common.Models.Mapper
/// <typeparam name="TEntity">Type of Entity Class</typeparam>
public abstract class BaseDto<TDto, TEntity> : INotifyPropertyChanged, IBaseDto<TDto,TEntity> where TEntity : class where TDto : class
{
public int Id { get; set; }
public Guid Id { get; set; }
public static Expression<Func<TEntity, TDto>> ProjectToDto
{
get => GetProjectToDto();

View File

@ -4,7 +4,7 @@ namespace Brizco.Common.Models.Mapper
{
public interface IBaseDto<TDto,TEntity>
{
int Id { get; set; }
Guid Id { get; set; }
bool Compare(object obj);
static Expression<Func<TEntity, TDto>> ProjectToDto;
}

View File

@ -1,10 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="Mapster.Core" Version="1.2.0" />
<PackageReference Include="MediatR" Version="12.1.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="7.0.11" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
</ItemGroup>-->
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>10</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
@ -12,11 +27,17 @@
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="Mapster.Core" Version="1.2.0" />
<PackageReference Include="MediatR" Version="12.1.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="7.0.11" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
</ItemGroup>
<Target Name="Mapster">
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet build" />
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet tool restore" />
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster extension -a &quot;$(TargetDir)$(ProjectName).dll&quot; -n Brizco.Domain.Mappers -o Mappers" />
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -a &quot;$(TargetDir)$(ProjectName).dll&quot; -n Brizco.Domain.Mappers -o Mappers" />
</Target>
<ItemGroup>
<ProjectReference Include="..\Brizco.Common\Brizco.Common.csproj" />
@ -27,8 +48,10 @@
<ItemGroup>
<Using Include="Brizco.Common.Models.Entity" />
<Using Include="Brizco.Common.Models.Mapper" />
<Using Include="Brizco.Domain.Dtos.LargDtos" />
<Using Include="Brizco.Domain.Dtos.SmallDtos" />
<Using Include="Brizco.Domain.Enums" />
<Using Include="Mapster" />
<Using Include="Microsoft.AspNetCore.Identity" />
<Using Include="System.ComponentModel" />
<Using Include="System.ComponentModel.DataAnnotations" />

View File

@ -0,0 +1,43 @@
namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateActivityCommand(
ActivityStatus Status,
DateTime DoneAt,
string PerformanceDescription,
TaskType Type,
string Title,
string Description,
bool IsRelatedToShift,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable,
DateTime SetFor,
bool HasDisposed,
int Amount,
PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts,
List<Guid> Roles) : IRequest<ActivityLDto>;
public sealed record UpdateActivityCommand(Guid Id,
ActivityStatus Status,
DateTime DoneAt,
string PerformanceDescription,
TaskType Type,
string Title,
string Description,
bool IsRelatedToShift,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable,
DateTime SetFor,
bool HasDisposed,
int Amount,
PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts,
List<Guid> Roles) : IRequest<bool>;
public sealed record DeleteActivityCommand(Guid id)
: IRequest<bool>;

View File

@ -5,7 +5,8 @@ namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description , List<DayOfWeek> DayOfWeeks)
: IRequest<Shift>;
public sealed record UpdateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks)
: IRequest<Shift>;
public sealed record UpdateShiftCommand(Guid id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks)
: IRequest<bool>;
public sealed record DeleteShiftCommand(Guid id) : IRequest;
public sealed record DeleteShiftCommand(Guid id)
: IRequest<bool>;

View File

@ -0,0 +1,38 @@
using Brizco.Domain.Entities.Shift;
namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateTaskCommand(TaskType Type,
string Title,
string Description,
bool IsRelatedToShift,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable,
DateTime SetFor,
bool HasDisposed,
int Amount,
PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts,
List<Guid> Roles) : IRequest<TaskLDto>;
public sealed record UpdateTaskCommand(Guid id,
TaskType Type,
string Title,
string Description,
bool IsRelatedToShift,
bool IsRelatedToRole,
bool IsRelatedToPerson,
bool IsDisposable,
DateTime SetFor,
bool HasDisposed,
int Amount,
PurchaseAmountType AmountType,
List<Guid> Users,
List<Guid> Shifts,
List<Guid> Roles) : IRequest<bool>;
public sealed record DeleteTaskCommand(Guid id)
: IRequest<bool>;

View File

@ -0,0 +1,7 @@
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetActivitiesQuery(int page = 0) :
IRequest<List<ActivitySDto>>;
public sealed record GetActivityQuery(Guid id) :
IRequest<ActivityLDto>;

View File

@ -1,4 +1,7 @@
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetShiftsQuery(int page = 0) : IRequest<List<ShiftSDto>>;
public sealed record GetShiftQuery(Guid id) : IRequest<ShiftSDto>;
public sealed record GetShiftsQuery(int page = 0) :
IRequest<List<ShiftSDto>>;
public sealed record GetShiftQuery(Guid id) :
IRequest<ShiftSDto>;

View File

@ -0,0 +1,7 @@
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetTasksQuery(int page = 0) :
IRequest<List<TaskSDto>>;
public sealed record GetTaskQuery(Guid id) :
IRequest<TaskLDto>;

View File

@ -0,0 +1,24 @@
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Dtos.LargDtos;
public class ActivityLDto : BaseDto<ActivityLDto , Activity>
{
public TaskType Type { get; set; }
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsRelatedToShift { get; set; }
public bool IsRelatedToRole { get; set; }
public bool IsRelatedToPerson { get; set; }
public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; }
public ActivityStatus Status { get; set; }
public DateTime DoneAt { get; set; }
public bool IsDone { get; set; }
public string PerformanceDescription { get; set; } = string.Empty;
public int Amount { get; set; }
public PurchaseAmountType AmountType { get; set; }
}

View File

@ -0,0 +1,11 @@
using Brizco.Domain.Entities.Complex;
namespace Brizco.Domain.Dtos.LargDtos;
public class ComplexLDto : BaseDto<ComplexLDto,Complex>
{
public string Name { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public string SupportPhone { get; set; } = string.Empty;
public List<ComplexUserSDto> Users { get; set; } = new();
}

View File

@ -0,0 +1,27 @@
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Dtos.LargDtos;
public class TaskLDto : BaseDto<TaskLDto, Entities.Task.Task>
{
public TaskType Type { get; set; }
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsRelatedToShift { get; set; }
public bool IsRelatedToRole { get; set; }
public bool IsRelatedToPerson { get; set; }
public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; }
public int Amount { get; set; }
public PurchaseAmountType AmountType { get; set; }
public List<TaskUserSDto> Users { get; set; } = new();
public List<TaskShiftSDto> Shifts { get; set; } = new();
public List<TaskRoleSDto> Roles { get; set; } = new();
}

View File

@ -0,0 +1,24 @@
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ActivitySDto : BaseDto<ActivitySDto , Activity>
{
public TaskType Type { get; internal set; }
public string Title { get; internal set; } = string.Empty;
public string Description { get; internal set; } = string.Empty;
public bool IsRelatedToShift { get; internal set; }
public bool IsRelatedToRole { get; internal set; }
public bool IsRelatedToPerson { get; internal set; }
public bool IsDisposable { get; internal set; }
public DateTime SetFor { get; internal set; }
public bool HasDisposed { get; internal set; }
public ActivityStatus Status { get; internal set; }
public DateTime DoneAt { get; internal set; }
public bool IsDone { get; set; }
public string PerformanceDescription { get; internal set; } = string.Empty;
public int Amount { get; internal set; }
public PurchaseAmountType AmountType { get; internal set; }
}

View File

@ -0,0 +1,11 @@
using Brizco.Domain.Entities.Complex;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ComplexSDto : BaseDto<ComplexSDto, Complex>
{
public string Name { get; set; } = string.Empty;
public string Address { get; set; } = string.Empty;
public string SupportPhone { get; set; } = string.Empty;
}

View File

@ -0,0 +1,11 @@
using Brizco.Domain.Entities.Complex;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ComplexUserSDto : BaseDto<ComplexUserSDto,ComplexUser>
{
public Guid UserId { get; set; }
public Guid ComplexId { get; set; }
public Guid RoleId { get; set; }
}

View File

@ -0,0 +1,9 @@
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Dtos.SmallDtos;
public class TaskRoleSDto : BaseDto<TaskRoleSDto , TaskRole>
{
public Guid RoleId { get; set; }
public Guid TaskId { get; set; }
}

View File

@ -0,0 +1,18 @@
namespace Brizco.Domain.Dtos.SmallDtos;
public class TaskSDto : BaseDto<TaskSDto,Entities.Task.Task>
{
public TaskType Type { get; set; }
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsRelatedToShift { get; set; }
public bool IsRelatedToRole { get; set; }
public bool IsRelatedToPerson { get; set; }
public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; }
public int Amount { get; set; }
public PurchaseAmountType AmountType { get; set; }
}

View File

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

View File

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

View File

@ -1,8 +1,11 @@
namespace Brizco.Domain.Entities.Complex;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public class Complex : ApiEntity
{
public string Name { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public string SupportPhone { get; private set; } = string.Empty;
public string Name { get; internal set; } = string.Empty;
public string Address { get; internal set; } = string.Empty;
public string SupportPhone { get; internal set; } = string.Empty;
}

View File

@ -1,13 +1,14 @@
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 ComplexUser : ApiEntity
{
public Guid UserId { get; private set; }
public Guid ComplexId { get; private set; }
public Guid UserId { get; internal set; }
public Guid ComplexId { get; internal set; }
public Guid RoleId { get; internal set; }
public Guid RoleId { get; private set; }
public ApplicationUser? User { get; private set; }
public Complex? Complex { get; private set; }
public ApplicationUser? User { get; internal set; }
public Complex? Complex { get; internal set; }
}

View File

@ -1,4 +1,6 @@
namespace Brizco.Domain.Entities.Shift;
using System;
namespace Brizco.Domain.Entities.Shift;
public partial class Shift
{
public static Shift Create(string title, string description, TimeSpan startAt, TimeSpan endAt)
@ -9,14 +11,14 @@ public partial class Shift
public ShiftDay SetDay(DayOfWeek dayOfWeek)
{
var shiftDay = new ShiftDay(dayOfWeek , Id);
ShiftDays.Add(shiftDay);
Days.Add(shiftDay);
return shiftDay;
}
public ShiftPlan AddPlan(DateTime startAt, DateTime endAt)
{
var plan = new ShiftPlan(startAt, endAt , Id);
ShiftPlans.Add(plan);
Plans.Add(plan);
return plan;
}
}

View File

@ -1,5 +1,11 @@
namespace Brizco.Domain.Entities.Shift;
using System;
using System.Collections.Generic;
using Mapster;
namespace Brizco.Domain.Entities.Shift;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public partial class Shift : ApiEntity
{
public Shift() { }
@ -12,14 +18,12 @@ public partial class Shift : ApiEntity
EndAt = endAt;
}
public string Title { get; set; } = string.Empty;
public TimeSpan StartAt { get; set; }
public TimeSpan EndAt { get; set; }
public string Description { get; set; } = string.Empty;
public string Title { get; internal set; } = string.Empty;
public TimeSpan StartAt { get; internal set; }
public TimeSpan EndAt { get; internal set; }
public string Description { get; internal set; } = string.Empty;
public IReadOnlyCollection<ShiftDay>? Days => ShiftDays;
internal List<ShiftDay>? ShiftDays { get; private set; } = new();
public List<ShiftDay> Days { get; internal set; } = new();
public IReadOnlyCollection<ShiftPlan>? Plans => ShiftPlans;
internal List<ShiftPlan>? ShiftPlans { get; private set; } = new();
public List<ShiftPlan> Plans { get; internal set; } = new();
}

View File

@ -1,8 +1,47 @@
namespace Brizco.Domain.Entities.Task;
using System;
public class Activity : Task
namespace Brizco.Domain.Entities.Task;
public partial class Activity : Task
{
public ActivityStatus Status { get; private set; }
public DateTime DoneAt { get; private set; }
public string PerformanceDescription { get; private set; } = string.Empty;
public Activity()
{
}
public Activity(
ActivityStatus status,
DateTime doneAt,
string performanceDescription,
TaskType type,
bool isRelatedToShift,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable,
DateTime setFor,
bool hasDisposed,
int amount,
PurchaseAmountType amountType,
string title,
string description) : base(type,
isRelatedToShift,
isRelatedToRole,
isRelatedToPerson,
isDisposable,
setFor,
hasDisposed,
amount,
amountType,
title,
description)
{
Status = status;
DoneAt = doneAt;
PerformanceDescription = performanceDescription;
}
public ActivityStatus Status { get; internal set; }
public DateTime DoneAt { get; internal set; }
public bool IsDone { get; internal set; }
public string PerformanceDescription { get; internal set; } = string.Empty;
}

View File

@ -0,0 +1,120 @@
namespace Brizco.Domain.Entities.Task;
public partial class Task
{
public static Task Create(
string title,
string description,
TaskType type,
bool isRelatedToShift,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable,
DateTime setFor,
bool hasDisposed,
int amount,
PurchaseAmountType amountType)
{
return new Task(type,
isRelatedToShift,
isRelatedToRole,
isRelatedToPerson,
isDisposable,
setFor,
hasDisposed,
amount,
amountType,
title,
description);
}
public void AddShift(params Guid[] shiftIds)
{
foreach (var shiftId in shiftIds)
{
var plan = new TaskShift(Id, shiftId);
Shifts.Add(plan);
}
}
public TaskShift AddShift(Guid shiftId)
{
var plan = new TaskShift(Id, shiftId);
Shifts.Add(plan);
return plan;
}
public void AddUser(params Guid[] userIds)
{
foreach (var userId in userIds)
{
var plan = new TaskUser(Id, userId);
Users.Add(plan);
}
}
public TaskUser AddUser(Guid userId)
{
var plan = new TaskUser(Id, userId);
Users.Add(plan);
return plan;
}
public TaskRole AddRole(Guid roleId)
{
var plan = new TaskRole(Id, roleId);
Roles.Add(plan);
return plan;
}
public void AddRole(params Guid[] roleIds)
{
foreach (var roleId in roleIds)
{
var plan = new TaskRole(Id, roleId);
Roles.Add(plan);
}
}
}
public partial class Activity
{
public static Activity Create(
ActivityStatus status,
DateTime doneAt,
string performanceDescription,
string title,
string description,
TaskType type,
bool isRelatedToShift,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable,
DateTime setFor,
bool hasDisposed,
int amount,
PurchaseAmountType amountType)
{
return new Activity(
status,
doneAt,
performanceDescription,
type,
isRelatedToShift,
isRelatedToRole,
isRelatedToPerson,
isDisposable,
setFor,
hasDisposed,
amount,
amountType,
title,
description);
}
public void DoneActivity()
{
DoneAt = DateTime.UtcNow;
IsDone = true;
}
}

View File

@ -1,5 +0,0 @@
namespace Brizco.Domain.Entities.Task;
public class SubTask : Task
{
}

View File

@ -1,36 +1,15 @@
namespace Brizco.Domain.Entities.Task;
public class Task : ApiEntity
using Brizco.Domain.Entities.Shift;
namespace Brizco.Domain.Entities.Task;
[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 Task : ApiEntity
{
public Task()
{
}
public static Task Create(
string title,
string description,
TaskType type,
bool isRelatedToShift,
bool isRelatedToRole,
bool isRelatedToPerson,
bool isDisposable,
DateTime setFor,
bool hasDisposed,
int amount,
PurchaseAmountType amountType)
{
return new Task(type,
isRelatedToShift,
isRelatedToRole,
isRelatedToPerson,
isDisposable,
setFor,
hasDisposed,
amount,
amountType,
title,
description);
}
internal Task(
TaskType type,
bool isRelatedToShift,
@ -57,21 +36,24 @@ public class Task : ApiEntity
Description = description;
}
public TaskType Type { get; private set; }
public string Title { get; private set; } = string.Empty;
public string Description { get; private set; } = string.Empty;
public bool IsRelatedToShift { get; private set; }
public bool IsRelatedToRole { get; private set; }
public bool IsRelatedToPerson { get; private set; }
public bool IsDisposable { get; private set; }
public DateTime SetFor { get; private set; }
public bool HasDisposed { get; private set; }
public TaskType Type { get; internal set; }
public string Title { get; internal set; } = string.Empty;
public string Description { get; internal set; } = string.Empty;
public bool IsRelatedToShift { get; internal set; }
public bool IsRelatedToRole { get; internal set; }
public bool IsRelatedToPerson { get; internal set; }
public bool IsDisposable { get; internal set; }
public DateTime SetFor { get; internal set; }
public bool HasDisposed { get; internal set; }
public int Amount { get; private set; }
public PurchaseAmountType AmountType { get; private set; }
public int Amount { get; internal set; }
public PurchaseAmountType AmountType { get; internal set; }
public virtual ICollection<TaskUser>? TaskUsers { get; set; }
public virtual ICollection<TaskShift>? TaskShifts { get; set; }
public virtual ICollection<TaskRole>? TaskRoles { get; set; }
public List<TaskUser> Users { get; internal set; } = new();
public List<TaskShift> Shifts { get; internal set; } = new();
public List<TaskRole> Roles { get; internal set; } = new();
}

View File

@ -2,11 +2,23 @@
namespace Brizco.Domain.Entities.Task;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public class TaskRole : ApiEntity
{
public Guid RoleId { get; private set; }
public virtual ApplicationRole? Role { get; private set; }
public Guid TaskId { get; private set; }
public virtual Task? Task { get; private set; }
public TaskRole()
{
}
public TaskRole(Guid roleId, Guid taskId)
{
RoleId = roleId;
TaskId = taskId;
}
public Guid RoleId { get; internal set; }
public virtual ApplicationRole? Role { get; internal set; }
public Guid TaskId { get; internal set; }
public virtual Task? Task { get; internal set; }
}

View File

@ -1,10 +1,22 @@
namespace Brizco.Domain.Entities.Task;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public class TaskShift : ApiEntity
{
public Guid TaskId { get; private set; }
public virtual Task? Task { get; private set; }
public TaskShift()
{
}
public Guid ShiftId { get; private set; }
public virtual Shift.Shift? Shift { get; private set; }
internal TaskShift(Guid taskId, Guid shiftId)
{
TaskId = taskId;
ShiftId = shiftId;
}
public Guid TaskId { get; internal set; }
public virtual Task? Task { get; internal set; }
public Guid ShiftId { get; internal set; }
public virtual Shift.Shift? Shift { get; internal set; }
}

View File

@ -2,10 +2,22 @@
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 Guid UserId { get; private set; }
public virtual ApplicationUser? User { get; private set; }
public Guid TaskId { get; private set; }
public virtual Task? Task { get; private set; }
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

@ -0,0 +1,218 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.LargDtos;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Mappers
{
public static partial class ActivityMapper
{
public static Activity AdaptToActivity(this ActivitySDto p1)
{
return p1 == null ? null : new Activity()
{
Status = p1.Status,
DoneAt = p1.DoneAt,
IsDone = p1.IsDone,
PerformanceDescription = p1.PerformanceDescription,
Id = p1.Id
};
}
public static Activity AdaptTo(this ActivitySDto p2, Activity p3)
{
if (p2 == null)
{
return null;
}
Activity result = p3 ?? new Activity();
result.Status = p2.Status;
result.DoneAt = p2.DoneAt;
result.IsDone = p2.IsDone;
result.PerformanceDescription = p2.PerformanceDescription;
result.Id = p2.Id;
return result;
}
public static Expression<Func<ActivitySDto, Activity>> ProjectToActivity => p4 => new Activity()
{
Status = p4.Status,
DoneAt = p4.DoneAt,
IsDone = p4.IsDone,
PerformanceDescription = p4.PerformanceDescription,
Id = p4.Id
};
public static ActivitySDto AdaptToSDto(this Activity p5)
{
return p5 == null ? null : new ActivitySDto()
{
Type = p5.Type,
Title = p5.Title,
Description = p5.Description,
IsRelatedToShift = p5.IsRelatedToShift,
IsRelatedToRole = p5.IsRelatedToRole,
IsRelatedToPerson = p5.IsRelatedToPerson,
IsDisposable = p5.IsDisposable,
SetFor = p5.SetFor,
HasDisposed = p5.HasDisposed,
Status = p5.Status,
DoneAt = p5.DoneAt,
IsDone = p5.IsDone,
PerformanceDescription = p5.PerformanceDescription,
Amount = p5.Amount,
AmountType = p5.AmountType,
Id = p5.Id
};
}
public static ActivitySDto AdaptTo(this Activity p6, ActivitySDto p7)
{
if (p6 == null)
{
return null;
}
ActivitySDto result = p7 ?? new ActivitySDto();
result.Type = p6.Type;
result.Title = p6.Title;
result.Description = p6.Description;
result.IsRelatedToShift = p6.IsRelatedToShift;
result.IsRelatedToRole = p6.IsRelatedToRole;
result.IsRelatedToPerson = p6.IsRelatedToPerson;
result.IsDisposable = p6.IsDisposable;
result.SetFor = p6.SetFor;
result.HasDisposed = p6.HasDisposed;
result.Status = p6.Status;
result.DoneAt = p6.DoneAt;
result.IsDone = p6.IsDone;
result.PerformanceDescription = p6.PerformanceDescription;
result.Amount = p6.Amount;
result.AmountType = p6.AmountType;
result.Id = p6.Id;
return result;
}
public static Expression<Func<Activity, ActivitySDto>> ProjectToSDto => p8 => new ActivitySDto()
{
Type = p8.Type,
Title = p8.Title,
Description = p8.Description,
IsRelatedToShift = p8.IsRelatedToShift,
IsRelatedToRole = p8.IsRelatedToRole,
IsRelatedToPerson = p8.IsRelatedToPerson,
IsDisposable = p8.IsDisposable,
SetFor = p8.SetFor,
HasDisposed = p8.HasDisposed,
Status = p8.Status,
DoneAt = p8.DoneAt,
IsDone = p8.IsDone,
PerformanceDescription = p8.PerformanceDescription,
Amount = p8.Amount,
AmountType = p8.AmountType,
Id = p8.Id
};
public static Activity AdaptToActivity(this ActivityLDto p9)
{
return p9 == null ? null : new Activity()
{
Status = p9.Status,
DoneAt = p9.DoneAt,
IsDone = p9.IsDone,
PerformanceDescription = p9.PerformanceDescription,
Id = p9.Id
};
}
public static Activity AdaptTo(this ActivityLDto p10, Activity p11)
{
if (p10 == null)
{
return null;
}
Activity result = p11 ?? new Activity();
result.Status = p10.Status;
result.DoneAt = p10.DoneAt;
result.IsDone = p10.IsDone;
result.PerformanceDescription = p10.PerformanceDescription;
result.Id = p10.Id;
return result;
}
public static Expression<Func<ActivityLDto, Activity>> ProjectLDtoToActivity => p12 => new Activity()
{
Status = p12.Status,
DoneAt = p12.DoneAt,
IsDone = p12.IsDone,
PerformanceDescription = p12.PerformanceDescription,
Id = p12.Id
};
public static ActivityLDto AdaptToLDto(this Activity p13)
{
return p13 == null ? null : new ActivityLDto()
{
Type = p13.Type,
Title = p13.Title,
Description = p13.Description,
IsRelatedToShift = p13.IsRelatedToShift,
IsRelatedToRole = p13.IsRelatedToRole,
IsRelatedToPerson = p13.IsRelatedToPerson,
IsDisposable = p13.IsDisposable,
SetFor = p13.SetFor,
HasDisposed = p13.HasDisposed,
Status = p13.Status,
DoneAt = p13.DoneAt,
IsDone = p13.IsDone,
PerformanceDescription = p13.PerformanceDescription,
Amount = p13.Amount,
AmountType = p13.AmountType,
Id = p13.Id
};
}
public static ActivityLDto AdaptTo(this Activity p14, ActivityLDto p15)
{
if (p14 == null)
{
return null;
}
ActivityLDto result = p15 ?? new ActivityLDto();
result.Type = p14.Type;
result.Title = p14.Title;
result.Description = p14.Description;
result.IsRelatedToShift = p14.IsRelatedToShift;
result.IsRelatedToRole = p14.IsRelatedToRole;
result.IsRelatedToPerson = p14.IsRelatedToPerson;
result.IsDisposable = p14.IsDisposable;
result.SetFor = p14.SetFor;
result.HasDisposed = p14.HasDisposed;
result.Status = p14.Status;
result.DoneAt = p14.DoneAt;
result.IsDone = p14.IsDone;
result.PerformanceDescription = p14.PerformanceDescription;
result.Amount = p14.Amount;
result.AmountType = p14.AmountType;
result.Id = p14.Id;
return result;
}
public static Expression<Func<Activity, ActivityLDto>> ProjectToLDto => p16 => new ActivityLDto()
{
Type = p16.Type,
Title = p16.Title,
Description = p16.Description,
IsRelatedToShift = p16.IsRelatedToShift,
IsRelatedToRole = p16.IsRelatedToRole,
IsRelatedToPerson = p16.IsRelatedToPerson,
IsDisposable = p16.IsDisposable,
SetFor = p16.SetFor,
HasDisposed = p16.HasDisposed,
Status = p16.Status,
DoneAt = p16.DoneAt,
IsDone = p16.IsDone,
PerformanceDescription = p16.PerformanceDescription,
Amount = p16.Amount,
AmountType = p16.AmountType,
Id = p16.Id
};
}
}

View File

@ -0,0 +1,140 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.LargDtos;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complex;
namespace Brizco.Domain.Mappers
{
public static partial class ComplexMapper
{
public static Complex AdaptToComplex(this ComplexSDto p1)
{
return p1 == null ? null : new Complex()
{
Name = p1.Name,
Address = p1.Address,
SupportPhone = p1.SupportPhone,
Id = p1.Id
};
}
public static Complex AdaptTo(this ComplexSDto p2, Complex p3)
{
if (p2 == null)
{
return null;
}
Complex result = p3 ?? new Complex();
result.Name = p2.Name;
result.Address = p2.Address;
result.SupportPhone = p2.SupportPhone;
result.Id = p2.Id;
return result;
}
public static Expression<Func<ComplexSDto, Complex>> ProjectToComplex => p4 => new Complex()
{
Name = p4.Name,
Address = p4.Address,
SupportPhone = p4.SupportPhone,
Id = p4.Id
};
public static ComplexSDto AdaptToSDto(this Complex p5)
{
return p5 == null ? null : new ComplexSDto()
{
Name = p5.Name,
Address = p5.Address,
SupportPhone = p5.SupportPhone,
Id = p5.Id
};
}
public static ComplexSDto AdaptTo(this Complex p6, ComplexSDto p7)
{
if (p6 == null)
{
return null;
}
ComplexSDto result = p7 ?? new ComplexSDto();
result.Name = p6.Name;
result.Address = p6.Address;
result.SupportPhone = p6.SupportPhone;
result.Id = p6.Id;
return result;
}
public static Expression<Func<Complex, ComplexSDto>> ProjectToSDto => p8 => new ComplexSDto()
{
Name = p8.Name,
Address = p8.Address,
SupportPhone = p8.SupportPhone,
Id = p8.Id
};
public static Complex AdaptToComplex(this ComplexLDto p9)
{
return p9 == null ? null : new Complex()
{
Name = p9.Name,
Address = p9.Address,
SupportPhone = p9.SupportPhone,
Id = p9.Id
};
}
public static Complex AdaptTo(this ComplexLDto p10, Complex p11)
{
if (p10 == null)
{
return null;
}
Complex result = p11 ?? new Complex();
result.Name = p10.Name;
result.Address = p10.Address;
result.SupportPhone = p10.SupportPhone;
result.Id = p10.Id;
return result;
}
public static Expression<Func<ComplexLDto, Complex>> ProjectLDtoToComplex => p12 => new Complex()
{
Name = p12.Name,
Address = p12.Address,
SupportPhone = p12.SupportPhone,
Id = p12.Id
};
public static ComplexLDto AdaptToLDto(this Complex p13)
{
return p13 == null ? null : new ComplexLDto()
{
Name = p13.Name,
Address = p13.Address,
SupportPhone = p13.SupportPhone,
Id = p13.Id
};
}
public static ComplexLDto AdaptTo(this Complex p14, ComplexLDto p15)
{
if (p14 == null)
{
return null;
}
ComplexLDto result = p15 ?? new ComplexLDto();
result.Name = p14.Name;
result.Address = p14.Address;
result.SupportPhone = p14.SupportPhone;
result.Id = p14.Id;
return result;
}
public static Expression<Func<Complex, ComplexLDto>> ProjectToLDto => p16 => new ComplexLDto()
{
Name = p16.Name,
Address = p16.Address,
SupportPhone = p16.SupportPhone,
Id = p16.Id
};
}
}

View File

@ -0,0 +1,75 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complex;
namespace Brizco.Domain.Mappers
{
public static partial class ComplexUserMapper
{
public static ComplexUser AdaptToComplexUser(this ComplexUserSDto p1)
{
return p1 == null ? null : new ComplexUser()
{
UserId = p1.UserId,
ComplexId = p1.ComplexId,
RoleId = p1.RoleId,
Id = p1.Id
};
}
public static ComplexUser AdaptTo(this ComplexUserSDto p2, ComplexUser p3)
{
if (p2 == null)
{
return null;
}
ComplexUser result = p3 ?? new ComplexUser();
result.UserId = p2.UserId;
result.ComplexId = p2.ComplexId;
result.RoleId = p2.RoleId;
result.Id = p2.Id;
return result;
}
public static Expression<Func<ComplexUserSDto, ComplexUser>> ProjectToComplexUser => p4 => new ComplexUser()
{
UserId = p4.UserId,
ComplexId = p4.ComplexId,
RoleId = p4.RoleId,
Id = p4.Id
};
public static ComplexUserSDto AdaptToSDto(this ComplexUser p5)
{
return p5 == null ? null : new ComplexUserSDto()
{
UserId = p5.UserId,
ComplexId = p5.ComplexId,
RoleId = p5.RoleId,
Id = p5.Id
};
}
public static ComplexUserSDto AdaptTo(this ComplexUser p6, ComplexUserSDto p7)
{
if (p6 == null)
{
return null;
}
ComplexUserSDto result = p7 ?? new ComplexUserSDto();
result.UserId = p6.UserId;
result.ComplexId = p6.ComplexId;
result.RoleId = p6.RoleId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<ComplexUser, ComplexUserSDto>> ProjectToSDto => p8 => new ComplexUserSDto()
{
UserId = p8.UserId,
ComplexId = p8.ComplexId,
RoleId = p8.RoleId,
Id = p8.Id
};
}
}

View File

@ -0,0 +1,178 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Shift;
namespace Brizco.Domain.Mappers
{
public static partial class ShiftMapper
{
public static Shift AdaptToShift(this ShiftSDto p1)
{
return p1 == null ? null : new Shift()
{
Title = p1.Title,
StartAt = p1.StartAt,
EndAt = p1.EndAt,
Description = p1.Description,
Days = funcMain1(p1.Days),
Id = p1.Id
};
}
public static Shift AdaptTo(this ShiftSDto p3, Shift p4)
{
if (p3 == null)
{
return null;
}
Shift result = p4 ?? new Shift();
result.Title = p3.Title;
result.StartAt = p3.StartAt;
result.EndAt = p3.EndAt;
result.Description = p3.Description;
result.Days = funcMain2(p3.Days, result.Days);
result.Id = p3.Id;
return result;
}
public static Expression<Func<ShiftSDto, Shift>> ProjectToShift => p7 => new Shift()
{
Title = p7.Title,
StartAt = p7.StartAt,
EndAt = p7.EndAt,
Description = p7.Description,
Days = p7.Days.Select<DayOfWeek, ShiftDay>(p8 => new ShiftDay() {}).ToList<ShiftDay>(),
Id = p7.Id
};
public static ShiftSDto AdaptToSDto(this Shift p9)
{
return p9 == null ? null : new ShiftSDto()
{
Title = p9.Title,
Description = p9.Description,
StartAt = p9.StartAt,
EndAt = p9.EndAt,
Days = funcMain3(p9.Days != null ? p9.Days.Select<ShiftDay, DayOfWeek>(funcMain4).ToList<DayOfWeek>() : new List<DayOfWeek>()),
Id = p9.Id
};
}
public static ShiftSDto AdaptTo(this Shift p11, ShiftSDto p12)
{
if (p11 == null)
{
return null;
}
ShiftSDto result = p12 ?? new ShiftSDto();
result.Title = p11.Title;
result.Description = p11.Description;
result.StartAt = p11.StartAt;
result.EndAt = p11.EndAt;
result.Days = funcMain5(p11.Days != null ? p11.Days.Select<ShiftDay, DayOfWeek>(funcMain4).ToList<DayOfWeek>() : new List<DayOfWeek>(), result.Days);
result.Id = p11.Id;
return result;
}
public static Expression<Func<Shift, ShiftSDto>> ProjectToSDto => p15 => new ShiftSDto()
{
Title = p15.Title,
Description = p15.Description,
StartAt = p15.StartAt,
EndAt = p15.EndAt,
Days = p15.Days != null ? p15.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>() : new List<DayOfWeek>(),
Id = p15.Id
};
private static List<ShiftDay> funcMain1(List<DayOfWeek> p2)
{
if (p2 == null)
{
return null;
}
List<ShiftDay> result = new List<ShiftDay>(p2.Count);
int i = 0;
int len = p2.Count;
while (i < len)
{
DayOfWeek item = p2[i];
result.Add(new ShiftDay() {});
i++;
}
return result;
}
private static List<ShiftDay> funcMain2(List<DayOfWeek> p5, List<ShiftDay> p6)
{
if (p5 == null)
{
return null;
}
List<ShiftDay> result = new List<ShiftDay>(p5.Count);
int i = 0;
int len = p5.Count;
while (i < len)
{
DayOfWeek item = p5[i];
result.Add(new ShiftDay() {});
i++;
}
return result;
}
private static List<DayOfWeek> funcMain3(List<DayOfWeek> p10)
{
if (p10 == null)
{
return null;
}
List<DayOfWeek> result = new List<DayOfWeek>(p10.Count);
int i = 0;
int len = p10.Count;
while (i < len)
{
DayOfWeek item = p10[i];
result.Add(item);
i++;
}
return result;
}
private static DayOfWeek funcMain4(ShiftDay d)
{
return d.DayOfWeek;
}
private static List<DayOfWeek> funcMain5(List<DayOfWeek> p13, List<DayOfWeek> p14)
{
if (p13 == null)
{
return null;
}
List<DayOfWeek> result = new List<DayOfWeek>(p13.Count);
int i = 0;
int len = p13.Count;
while (i < len)
{
DayOfWeek item = p13[i];
result.Add(item);
i++;
}
return result;
}
}
}

View File

@ -0,0 +1,587 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.LargDtos;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Task;
using Task = Brizco.Domain.Entities.Task.Task;
namespace Brizco.Domain.Mappers
{
public static partial class TaskMapper
{
public static Task AdaptToTask(this TaskSDto p1)
{
return p1 == null ? null : new Task()
{
Type = p1.Type,
Title = p1.Title,
Description = p1.Description,
IsRelatedToShift = p1.IsRelatedToShift,
IsRelatedToRole = p1.IsRelatedToRole,
IsRelatedToPerson = p1.IsRelatedToPerson,
IsDisposable = p1.IsDisposable,
SetFor = p1.SetFor,
HasDisposed = p1.HasDisposed,
Amount = p1.Amount,
AmountType = p1.AmountType,
Id = p1.Id
};
}
public static Task AdaptTo(this TaskSDto p2, Task p3)
{
if (p2 == null)
{
return null;
}
Task result = p3 ?? new Task();
result.Type = p2.Type;
result.Title = p2.Title;
result.Description = p2.Description;
result.IsRelatedToShift = p2.IsRelatedToShift;
result.IsRelatedToRole = p2.IsRelatedToRole;
result.IsRelatedToPerson = p2.IsRelatedToPerson;
result.IsDisposable = p2.IsDisposable;
result.SetFor = p2.SetFor;
result.HasDisposed = p2.HasDisposed;
result.Amount = p2.Amount;
result.AmountType = p2.AmountType;
result.Id = p2.Id;
return result;
}
public static Expression<Func<TaskSDto, Task>> ProjectToTask => p4 => new Task()
{
Type = p4.Type,
Title = p4.Title,
Description = p4.Description,
IsRelatedToShift = p4.IsRelatedToShift,
IsRelatedToRole = p4.IsRelatedToRole,
IsRelatedToPerson = p4.IsRelatedToPerson,
IsDisposable = p4.IsDisposable,
SetFor = p4.SetFor,
HasDisposed = p4.HasDisposed,
Amount = p4.Amount,
AmountType = p4.AmountType,
Id = p4.Id
};
public static TaskSDto AdaptToSDto(this Task p5)
{
return p5 == null ? null : new TaskSDto()
{
Type = p5.Type,
Title = p5.Title,
Description = p5.Description,
IsRelatedToShift = p5.IsRelatedToShift,
IsRelatedToRole = p5.IsRelatedToRole,
IsRelatedToPerson = p5.IsRelatedToPerson,
IsDisposable = p5.IsDisposable,
SetFor = p5.SetFor,
HasDisposed = p5.HasDisposed,
Amount = p5.Amount,
AmountType = p5.AmountType,
Id = p5.Id
};
}
public static TaskSDto AdaptTo(this Task p6, TaskSDto p7)
{
if (p6 == null)
{
return null;
}
TaskSDto result = p7 ?? new TaskSDto();
result.Type = p6.Type;
result.Title = p6.Title;
result.Description = p6.Description;
result.IsRelatedToShift = p6.IsRelatedToShift;
result.IsRelatedToRole = p6.IsRelatedToRole;
result.IsRelatedToPerson = p6.IsRelatedToPerson;
result.IsDisposable = p6.IsDisposable;
result.SetFor = p6.SetFor;
result.HasDisposed = p6.HasDisposed;
result.Amount = p6.Amount;
result.AmountType = p6.AmountType;
result.Id = p6.Id;
return result;
}
public static Expression<Func<Task, TaskSDto>> ProjectToSDto => p8 => new TaskSDto()
{
Type = p8.Type,
Title = p8.Title,
Description = p8.Description,
IsRelatedToShift = p8.IsRelatedToShift,
IsRelatedToRole = p8.IsRelatedToRole,
IsRelatedToPerson = p8.IsRelatedToPerson,
IsDisposable = p8.IsDisposable,
SetFor = p8.SetFor,
HasDisposed = p8.HasDisposed,
Amount = p8.Amount,
AmountType = p8.AmountType,
Id = p8.Id
};
public static Task AdaptToTask(this TaskLDto p9)
{
return p9 == null ? null : new Task()
{
Type = p9.Type,
Title = p9.Title,
Description = p9.Description,
IsRelatedToShift = p9.IsRelatedToShift,
IsRelatedToRole = p9.IsRelatedToRole,
IsRelatedToPerson = p9.IsRelatedToPerson,
IsDisposable = p9.IsDisposable,
SetFor = p9.SetFor,
HasDisposed = p9.HasDisposed,
Amount = p9.Amount,
AmountType = p9.AmountType,
Users = funcMain1(p9.Users),
Shifts = funcMain2(p9.Shifts),
Roles = funcMain3(p9.Roles),
Id = p9.Id
};
}
public static Task AdaptTo(this TaskLDto p13, Task p14)
{
if (p13 == null)
{
return null;
}
Task result = p14 ?? new Task();
result.Type = p13.Type;
result.Title = p13.Title;
result.Description = p13.Description;
result.IsRelatedToShift = p13.IsRelatedToShift;
result.IsRelatedToRole = p13.IsRelatedToRole;
result.IsRelatedToPerson = p13.IsRelatedToPerson;
result.IsDisposable = p13.IsDisposable;
result.SetFor = p13.SetFor;
result.HasDisposed = p13.HasDisposed;
result.Amount = p13.Amount;
result.AmountType = p13.AmountType;
result.Users = funcMain4(p13.Users, result.Users);
result.Shifts = funcMain5(p13.Shifts, result.Shifts);
result.Roles = funcMain6(p13.Roles, result.Roles);
result.Id = p13.Id;
return result;
}
public static Expression<Func<TaskLDto, Task>> ProjectLDtoToTask => p21 => new Task()
{
Type = p21.Type,
Title = p21.Title,
Description = p21.Description,
IsRelatedToShift = p21.IsRelatedToShift,
IsRelatedToRole = p21.IsRelatedToRole,
IsRelatedToPerson = p21.IsRelatedToPerson,
IsDisposable = p21.IsDisposable,
SetFor = p21.SetFor,
HasDisposed = p21.HasDisposed,
Amount = p21.Amount,
AmountType = p21.AmountType,
Users = p21.Users.Select<TaskUserSDto, TaskUser>(p22 => new TaskUser()
{
UserId = p22.UserId,
TaskId = p22.TaskId
}).ToList<TaskUser>(),
Shifts = p21.Shifts.Select<TaskShiftSDto, TaskShift>(p23 => new TaskShift()
{
TaskId = p23.TaskId,
ShiftId = p23.ShiftId
}).ToList<TaskShift>(),
Roles = p21.Roles.Select<TaskRoleSDto, TaskRole>(p24 => new TaskRole()
{
RoleId = p24.RoleId,
TaskId = p24.TaskId,
Id = p24.Id
}).ToList<TaskRole>(),
Id = p21.Id
};
public static TaskLDto AdaptToLDto(this Task p25)
{
return p25 == null ? null : new TaskLDto()
{
Type = p25.Type,
Title = p25.Title,
Description = p25.Description,
IsRelatedToShift = p25.IsRelatedToShift,
IsRelatedToRole = p25.IsRelatedToRole,
IsRelatedToPerson = p25.IsRelatedToPerson,
IsDisposable = p25.IsDisposable,
SetFor = p25.SetFor,
HasDisposed = p25.HasDisposed,
Amount = p25.Amount,
AmountType = p25.AmountType,
Users = funcMain7(p25.Users),
Shifts = funcMain8(p25.Shifts),
Roles = funcMain9(p25.Roles),
Id = p25.Id
};
}
public static TaskLDto AdaptTo(this Task p29, TaskLDto p30)
{
if (p29 == null)
{
return null;
}
TaskLDto result = p30 ?? new TaskLDto();
result.Type = p29.Type;
result.Title = p29.Title;
result.Description = p29.Description;
result.IsRelatedToShift = p29.IsRelatedToShift;
result.IsRelatedToRole = p29.IsRelatedToRole;
result.IsRelatedToPerson = p29.IsRelatedToPerson;
result.IsDisposable = p29.IsDisposable;
result.SetFor = p29.SetFor;
result.HasDisposed = p29.HasDisposed;
result.Amount = p29.Amount;
result.AmountType = p29.AmountType;
result.Users = funcMain10(p29.Users, result.Users);
result.Shifts = funcMain11(p29.Shifts, result.Shifts);
result.Roles = funcMain12(p29.Roles, result.Roles);
result.Id = p29.Id;
return result;
}
public static Expression<Func<Task, TaskLDto>> ProjectToLDto => p37 => new TaskLDto()
{
Type = p37.Type,
Title = p37.Title,
Description = p37.Description,
IsRelatedToShift = p37.IsRelatedToShift,
IsRelatedToRole = p37.IsRelatedToRole,
IsRelatedToPerson = p37.IsRelatedToPerson,
IsDisposable = p37.IsDisposable,
SetFor = p37.SetFor,
HasDisposed = p37.HasDisposed,
Amount = p37.Amount,
AmountType = p37.AmountType,
Users = p37.Users.Select<TaskUser, TaskUserSDto>(p38 => new TaskUserSDto()
{
UserId = p38.UserId,
TaskId = p38.TaskId
}).ToList<TaskUserSDto>(),
Shifts = p37.Shifts.Select<TaskShift, TaskShiftSDto>(p39 => new TaskShiftSDto()
{
ShiftId = p39.ShiftId,
TaskId = p39.TaskId
}).ToList<TaskShiftSDto>(),
Roles = p37.Roles.Select<TaskRole, TaskRoleSDto>(p40 => new TaskRoleSDto()
{
RoleId = p40.RoleId,
TaskId = p40.TaskId,
Id = p40.Id
}).ToList<TaskRoleSDto>(),
Id = p37.Id
};
private static List<TaskUser> funcMain1(List<TaskUserSDto> p10)
{
if (p10 == null)
{
return null;
}
List<TaskUser> result = new List<TaskUser>(p10.Count);
int i = 0;
int len = p10.Count;
while (i < len)
{
TaskUserSDto item = p10[i];
result.Add(item == null ? null : new TaskUser()
{
UserId = item.UserId,
TaskId = item.TaskId
});
i++;
}
return result;
}
private static List<TaskShift> funcMain2(List<TaskShiftSDto> p11)
{
if (p11 == null)
{
return null;
}
List<TaskShift> result = new List<TaskShift>(p11.Count);
int i = 0;
int len = p11.Count;
while (i < len)
{
TaskShiftSDto item = p11[i];
result.Add(item == null ? null : new TaskShift()
{
TaskId = item.TaskId,
ShiftId = item.ShiftId
});
i++;
}
return result;
}
private static List<TaskRole> funcMain3(List<TaskRoleSDto> p12)
{
if (p12 == null)
{
return null;
}
List<TaskRole> result = new List<TaskRole>(p12.Count);
int i = 0;
int len = p12.Count;
while (i < len)
{
TaskRoleSDto item = p12[i];
result.Add(item == null ? null : new TaskRole()
{
RoleId = item.RoleId,
TaskId = item.TaskId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskUser> funcMain4(List<TaskUserSDto> p15, List<TaskUser> p16)
{
if (p15 == null)
{
return null;
}
List<TaskUser> result = new List<TaskUser>(p15.Count);
int i = 0;
int len = p15.Count;
while (i < len)
{
TaskUserSDto item = p15[i];
result.Add(item == null ? null : new TaskUser()
{
UserId = item.UserId,
TaskId = item.TaskId
});
i++;
}
return result;
}
private static List<TaskShift> funcMain5(List<TaskShiftSDto> p17, List<TaskShift> p18)
{
if (p17 == null)
{
return null;
}
List<TaskShift> result = new List<TaskShift>(p17.Count);
int i = 0;
int len = p17.Count;
while (i < len)
{
TaskShiftSDto item = p17[i];
result.Add(item == null ? null : new TaskShift()
{
TaskId = item.TaskId,
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,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskUserSDto> funcMain7(List<TaskUser> p26)
{
if (p26 == null)
{
return null;
}
List<TaskUserSDto> result = new List<TaskUserSDto>(p26.Count);
int i = 0;
int len = p26.Count;
while (i < len)
{
TaskUser item = p26[i];
result.Add(item == null ? null : new TaskUserSDto()
{
UserId = item.UserId,
TaskId = item.TaskId
});
i++;
}
return result;
}
private static List<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()
{
ShiftId = item.ShiftId,
TaskId = item.TaskId
});
i++;
}
return result;
}
private static List<TaskRoleSDto> funcMain9(List<TaskRole> p28)
{
if (p28 == null)
{
return null;
}
List<TaskRoleSDto> result = new List<TaskRoleSDto>(p28.Count);
int i = 0;
int len = p28.Count;
while (i < len)
{
TaskRole item = p28[i];
result.Add(item == null ? null : new TaskRoleSDto()
{
RoleId = item.RoleId,
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,
Id = item.Id
});
i++;
}
return result;
}
}
}

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 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,63 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Mappers
{
public static partial class TaskShiftMapper
{
public static TaskShift AdaptToTaskShift(this TaskShiftSDto p1)
{
return p1 == null ? null : new TaskShift()
{
TaskId = p1.TaskId,
ShiftId = p1.ShiftId
};
}
public static TaskShift AdaptTo(this TaskShiftSDto p2, TaskShift p3)
{
if (p2 == null)
{
return null;
}
TaskShift result = p3 ?? new TaskShift();
result.TaskId = p2.TaskId;
result.ShiftId = p2.ShiftId;
return result;
}
public static Expression<Func<TaskShiftSDto, TaskShift>> ProjectToTaskShift => p4 => new TaskShift()
{
TaskId = p4.TaskId,
ShiftId = p4.ShiftId
};
public static TaskShiftSDto AdaptToSDto(this TaskShift p5)
{
return p5 == null ? null : new TaskShiftSDto()
{
ShiftId = p5.ShiftId,
TaskId = p5.TaskId
};
}
public static TaskShiftSDto AdaptTo(this TaskShift p6, TaskShiftSDto p7)
{
if (p6 == null)
{
return null;
}
TaskShiftSDto result = p7 ?? new TaskShiftSDto();
result.ShiftId = p6.ShiftId;
result.TaskId = p6.TaskId;
return result;
}
public static Expression<Func<TaskShift, TaskShiftSDto>> ProjectToSDto => p8 => new TaskShiftSDto()
{
ShiftId = p8.ShiftId,
TaskId = p8.TaskId
};
}
}

View File

@ -0,0 +1,63 @@
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

@ -0,0 +1,15 @@
using Brizco.Domain.Entities.Shift;
using Mapster;
namespace Brizco.Domain;
public class MapsterRegister : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<Shift, ShiftSDto>()
.Map("Days", org => org.Days != null ? org.Days.Select(d=>d.DayOfWeek).ToList()
: new List<DayOfWeek>())
.TwoWays();
}
}

5
global.json 100644
View File

@ -0,0 +1,5 @@
{
"sdk": {
"version": "7.0.400"
}
}