Compare commits
2 Commits
81762ecb64
...
5328e74f79
Author | SHA1 | Date |
---|---|---|
|
5328e74f79 | |
|
a8f6fe66b3 |
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"ConnectionStrings": {
|
||||
"PostgresServer": "Host=185.220.227.123;port=5432;Username=postgres;Password=ub0J7sFFThkSBmkc0TzSKsCfheRnQpyu;Database=BrizcoDB",
|
||||
"PostgresServer": "Host=185.220.227.126;port=5432;Username=postgres;Password=ub0J7sFFThkSBmkc0TzSKsCfheRnQpyu;Database=BrizcoDB",
|
||||
"MartenDBServer": "Host=185.228.236.40;port=5432;Username=postgres;Password=ub0J7sFFThkSBmkc0TzSKsCfheRnQpyu;Database=BrizcoMartenDB",
|
||||
"Postgres": "Host=pg-0;Username=postgres;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=BrizcoDB;Application Name=BrizCo",
|
||||
"MartenDB": "Host=pg-0;Username=postgres;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=BrizcoMartenDB;"
|
||||
},
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<AssemblyVersion>1.0.1.2</AssemblyVersion>
|
||||
<FileVersion>1.0.1.2</FileVersion>
|
||||
<AssemblyVersion>1.4.9.4</AssemblyVersion>
|
||||
<FileVersion>1.4.9.4</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using Brizco.Domain.Enums;
|
||||
|
||||
namespace Brizco.Api.Controllers;
|
||||
namespace Brizco.Api.Controllers;
|
||||
|
||||
public class ActivityController : ICarterModule
|
||||
{
|
||||
|
@ -12,7 +10,7 @@ public class ActivityController : ICarterModule
|
|||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetActivities")
|
||||
.RequireAuthorization(builder=>builder.RequireClaim(CustomClaimType.Permission,ApplicationPermission.ViewActivities, ApplicationPermission.ManageActivities))
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewActivities, ApplicationPermission.ManageActivities))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id:guid}", GetAsync)
|
||||
|
@ -26,7 +24,7 @@ public class ActivityController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("complete", CompleteActivityAsync)
|
||||
.WithDisplayName("DoneActivity")
|
||||
.WithDisplayName("CompleteActivity")
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ChangeActivityStatus))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
@ -34,36 +32,35 @@ public class ActivityController : ICarterModule
|
|||
.WithDisplayName("UnDoneActivity")
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ChangeActivityStatus))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
//group.MapPost("", Post)
|
||||
// .AllowAnonymous()
|
||||
// .HasApiVersion(1.0);
|
||||
|
||||
//group.MapPut("", Put)
|
||||
// .HasApiVersion(1.0);
|
||||
|
||||
//group.MapDelete("{id:guid}", Delete)
|
||||
// .HasApiVersion(1.0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// GET:Get All Entity
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery] DateQueryFilter? dateQueryFilter, [FromQuery] long? selectedDate, [FromQuery] Guid? selectedShiftPlanId, ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetActivitiesQuery(Page: page, SelectedDate: selectedDate ?? 0 , SelectedShiftPlanId: selectedShiftPlanId ?? default , DateQueryFilter: dateQueryFilter ?? null), cancellationToken));
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int page,
|
||||
[FromQuery] DateTimeQueryFilter? dateQueryFilter,
|
||||
[FromQuery] long? selectedDate,
|
||||
[FromQuery] Guid? selectedShiftPlanId,
|
||||
[FromQuery] Guid? userId,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetActivitiesQuery(UserId: userId,
|
||||
Page: page,
|
||||
SelectedDate: selectedDate ?? 0,
|
||||
SelectedShiftPlanId: selectedShiftPlanId,
|
||||
DateQueryFilter: dateQueryFilter), cancellationToken));
|
||||
|
||||
// GET:Get An Entity By Id
|
||||
public async Task<IResult> GetAsync(Guid id, IActivityService activityService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await activityService.DoneActivityAsync(id,cancellationToken));
|
||||
=> TypedResults.Ok(await activityService.DoneActivityAsync(id, cancellationToken));
|
||||
|
||||
public async Task<IResult> CompleteActivityAsync([FromBody]List<CompleteActivityRequestDto> requestDtos, [FromServices] IActivityService activityService, CancellationToken cancellationToken)
|
||||
public async Task<IResult> CompleteActivityAsync([FromBody] List<CompleteActivityRequestDto> requestDtos, [FromServices] IActivityService activityService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await activityService.CompleteActivitiesAsync(requestDtos, cancellationToken));
|
||||
|
||||
public async Task<IResult> DoneActivityAsync(Guid id, [FromServices] IActivityService activityService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await activityService.DoneActivityAsync(id, cancellationToken));
|
||||
|
||||
public async Task<IResult> UnDoneActivityAsync(Guid id,[FromQuery]string undoneReason, [FromServices]IActivityService activityService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await activityService.UnDoneActivityAsync(id,undoneReason, cancellationToken));
|
||||
public async Task<IResult> UnDoneActivityAsync(Guid id, [FromQuery] string undoneReason, [FromServices] IActivityService activityService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await activityService.UnDoneActivityAsync(id, undoneReason, cancellationToken));
|
||||
|
||||
//// POST:Create Entity
|
||||
//public async Task<IResult> Post([FromQuery]Guid shiftPlanId,IActivityService activityService, CancellationToken cancellationToken)
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
namespace Brizco.Api.Controllers;
|
||||
|
||||
public class NewsFeedController : ICarterModule
|
||||
{
|
||||
public void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("News")
|
||||
.MapGroup("api/news");
|
||||
|
||||
group.MapGet("", GetEntitiesAsync)
|
||||
.WithDisplayName("Get News Feed")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", PostEntitiesAsync)
|
||||
.WithDisplayName("Create News Feed")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPut("{id}/pin", ChangePinAsync)
|
||||
.WithDisplayName("Change NewsFeed Pin")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapDelete("{id}", DeleteEntitiesAsync)
|
||||
.WithDisplayName("Delete News Feed")
|
||||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
private async Task GetEntitiesAsync([FromQuery] int page, [FromQuery] int? count, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetNewsFeedsQuery(page, count), cancellationToken));
|
||||
|
||||
private async Task PostEntitiesAsync([FromBody]CreateNewsFeedCommand request, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(request, cancellationToken));
|
||||
|
||||
private async Task ChangePinAsync([FromRoute] Guid id, [FromQuery]bool isPin, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new ChangeNewsFeedPinCommand(id,isPin), cancellationToken));
|
||||
|
||||
private async Task DeleteEntitiesAsync([FromRoute] Guid id, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new DeleteNewsFeedCommand(id), cancellationToken));
|
||||
}
|
|
@ -13,6 +13,12 @@ public class NotificationController : ICarterModule
|
|||
.RequireAuthorization(builder=>builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("/unread/count", GetUserNotificationsCountAsync)
|
||||
.WithDisplayName("Get Unread Notifications Count")
|
||||
.WithDescription("Get user notifications , by JWT user id")
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser())
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("{id}/read",ReadNotificationAsync)
|
||||
.WithDisplayName("Read Notification")
|
||||
.WithDescription("Read notification , by JWT user id")
|
||||
|
@ -24,7 +30,10 @@ public class NotificationController : ICarterModule
|
|||
private async Task<IResult> ReadNotificationAsync([FromRoute] Guid id, [FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new ReadNotificationCommand(id), cancellationToken));
|
||||
|
||||
private async Task<IResult> GetUserNotificationsAsync([FromQuery] int page, [FromQuery] int count,
|
||||
private async Task<IResult> GetUserNotificationsAsync([FromQuery] int page, [FromQuery] int? count,
|
||||
[FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetNotificationsQuery(page, count), cancellationToken));
|
||||
|
||||
private async Task<IResult> GetUserNotificationsCountAsync([FromServices] IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetNotificationsCountQuery(), cancellationToken));
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
using Brizco.Domain.Enums;
|
||||
|
||||
namespace Brizco.Api.Controllers;
|
||||
namespace Brizco.Api.Controllers;
|
||||
|
||||
public class ShiftPlanController : ICarterModule
|
||||
{
|
||||
|
@ -32,6 +30,7 @@ public class ShiftPlanController : ICarterModule
|
|||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageShiftPlans))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
||||
group.MapPost("", Post)
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageShiftPlans))
|
||||
.HasApiVersion(1.0);
|
||||
|
@ -54,7 +53,10 @@ public class ShiftPlanController : ICarterModule
|
|||
|
||||
|
||||
// GET:Get All Entity
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery] long? selectedDate, [FromQuery] DateTimeQueryFilter? dateFilter , ISender sender, CancellationToken cancellationToken)
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int page,
|
||||
[FromQuery] long? selectedDate,
|
||||
[FromQuery] DateTimeQueryFilter? dateFilter ,
|
||||
[FromServices]ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetShiftPlansQuery(page , selectedDate ?? 0 , DateTimeQueryFilter: dateFilter), cancellationToken));
|
||||
|
||||
// GET:Get An Entity By Id
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
public class TaskController : ICarterModule
|
||||
{
|
||||
public TaskController()
|
||||
{
|
||||
}
|
||||
public virtual void AddRoutes(IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.NewVersionedApi("Task")
|
||||
|
@ -13,12 +10,12 @@ public class TaskController : ICarterModule
|
|||
|
||||
group.MapGet("", GetAllAsync)
|
||||
.WithDisplayName("GetAllTask")
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageTasks,ApplicationPermission.ViewTasks))
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageTasks, ApplicationPermission.ViewTasks))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetOneTask")
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageTasks,ApplicationPermission.ViewTasks))
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageTasks, ApplicationPermission.ViewTasks))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("", Post)
|
||||
|
@ -35,12 +32,15 @@ public class TaskController : ICarterModule
|
|||
}
|
||||
|
||||
// GET:Get All Entity
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int page,ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetTasksQuery(page), cancellationToken));
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int page,
|
||||
[FromQuery] int? count,
|
||||
[FromQuery] Guid? shiftId,
|
||||
ISender sender, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await sender.Send(new GetTasksQuery(page, ShiftId: shiftId, Count: count), 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),cancellationToken));
|
||||
=> TypedResults.Ok(await sender.Send(new GetTaskQuery(id), cancellationToken));
|
||||
|
||||
// POST:Create Entity
|
||||
public async Task<IResult> Post([FromBody] CreateTaskCommand ent, ISender mediator, CancellationToken cancellationToken)
|
||||
|
|
|
@ -16,6 +16,11 @@ public class UserController : ICarterModule
|
|||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewUsers,ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("/staff", GetAllStaffAsync)
|
||||
.WithDisplayName("GetAllStaff")
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewUsers, ApplicationPermission.ManageUsers))
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapGet("{id}", GetAsync)
|
||||
.WithDisplayName("GetOneUser")
|
||||
.RequireAuthorization(builder => builder.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewUsers, ApplicationPermission.ManageUsers))
|
||||
|
@ -42,6 +47,12 @@ public class UserController : ICarterModule
|
|||
.HasApiVersion(1.0);
|
||||
}
|
||||
|
||||
private async Task<IResult> GetAllStaffAsync([FromQuery] DateTimeQueryFilter filter,
|
||||
[FromQuery] int page,
|
||||
[FromQuery] int? count,
|
||||
IMediator mediator,
|
||||
CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetStaffQuery(page, filter, count), cancellationToken));
|
||||
|
||||
public async Task<IResult> ChangeUserRoleAsync(Guid roleId,IUserService userService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await userService.ChangeUserRoleAsync(roleId,cancellationToken));
|
||||
|
|
|
@ -83,6 +83,7 @@ builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
|
|||
.Create(typeof(CoreConfig).Assembly)
|
||||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
.Build());
|
||||
builder.AddSchedulerToAutoFac();
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/scalar/v1",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_URLS": "http://+:80"
|
||||
"ASPNETCORE_URLS": "http://+:80",
|
||||
"TZ": "Asia/Tehran"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"DockerfileRunArguments": " --network=mother -p 32767:80"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
7bec0081-0f19-4cf7-84a9-7deed79e4f61
|
|
@ -10,11 +10,6 @@ public static class LoggerConfig
|
|||
Log.Logger = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Console(theme: AnsiConsoleTheme.Literate)
|
||||
.WriteTo.Sentry(o =>
|
||||
{
|
||||
o.MinimumEventLevel = LogEventLevel.Error;
|
||||
o.Dsn = "https://592b7fbb29464442a8e996247abe857f@watcher.igarson.app/7";
|
||||
})
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore.Database.Command", LogEventLevel.Warning)
|
||||
.CreateLogger();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System.IO.Compression;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO.Compression;
|
||||
using Asp.Versioning;
|
||||
using AspNetCoreRateLimit;
|
||||
using AspNetCoreRateLimit.Redis;
|
||||
using Brizco.Domain.Entities.Users;
|
||||
using Autofac.Extras.Quartz;
|
||||
using Brizco.Core.QuartzServices;
|
||||
using Marten;
|
||||
using Microsoft.AspNetCore.ResponseCompression;
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
|
@ -14,6 +16,22 @@ namespace Brizco.Api.WebFramework.Configurations;
|
|||
|
||||
public static class ServiceExtensions
|
||||
{
|
||||
public static void AddSchedulerToAutoFac(this ContainerBuilder builder)
|
||||
{
|
||||
// configure and register Quartz
|
||||
var schedulerConfig = new NameValueCollection {
|
||||
{"quartz.threadPool.threadCount", "3"},
|
||||
{"quartz.scheduler.threadName", "MyScheduler"},
|
||||
};
|
||||
|
||||
builder.RegisterModule(new QuartzAutofacFactoryModule
|
||||
{
|
||||
ConfigurationProvider = c => schedulerConfig
|
||||
});
|
||||
|
||||
builder.RegisterModule(new QuartzAutofacJobsModule(typeof(JobScheduler).Assembly));
|
||||
builder.RegisterType<JobScheduler>().AsSelf();
|
||||
}
|
||||
public static void AddIpRateLimit(this IServiceCollection services, IConfigurationRoot configuration)
|
||||
{
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace Brizco.Common.Extensions
|
|||
|
||||
public static long DateTimeToUnixTimeStamp(DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
return 0;
|
||||
return ((DateTimeOffset)dateTime).ToUnixTimeMilliseconds();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,9 +63,11 @@
|
|||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||
<Using Include="Microsoft.IdentityModel.Tokens" />
|
||||
<Using Include="Newtonsoft.Json" />
|
||||
<Using Include="NPOI.SS.UserModel" />
|
||||
<Using Include="NPOI.SS.Util" />
|
||||
<Using Include="NPOI.XSSF.UserModel" />
|
||||
<Using Include="System.Reflection" />
|
||||
<Using Include="System.Security.Claims" />
|
||||
<Using Include="System.Text.Json" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -3,29 +3,21 @@ using Task = Brizco.Domain.Entities.Tasks.Task;
|
|||
|
||||
namespace Brizco.Core.EntityServices;
|
||||
|
||||
public class ActivityService : IActivityService
|
||||
public class ActivityService(IMediator mediator, IRepositoryWrapper repositoryWrapper) : IActivityService
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
public ActivityService(IMediator mediator, IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_mediator = mediator;
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> DoneActivityAsync(Guid activityId, CancellationToken cancellationToken)
|
||||
{
|
||||
var activity = await _repositoryWrapper.SetRepository<Activity>()
|
||||
var activity = await repositoryWrapper.SetRepository<Activity>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(a => a.Id == activityId, cancellationToken);
|
||||
if (activity == null)
|
||||
throw new AppException("Activity not found", ApiResultStatusCode.NotFound);
|
||||
activity.DoneActivity();
|
||||
_repositoryWrapper.SetRepository<Activity>()
|
||||
repositoryWrapper.SetRepository<Activity>()
|
||||
.Update(activity);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -33,14 +25,14 @@ public class ActivityService : IActivityService
|
|||
{
|
||||
foreach (var activityRequestDto in requestDtos)
|
||||
{
|
||||
var activity = await _repositoryWrapper.SetRepository<Activity>().TableNoTracking
|
||||
var activity = await repositoryWrapper.SetRepository<Activity>().TableNoTracking
|
||||
.FirstOrDefaultAsync(a => a.Id == activityRequestDto.ActivityId, cancellationToken);
|
||||
if (activity == null)
|
||||
continue;
|
||||
|
||||
activity.CompleteActivity(activityRequestDto.IsCompleted, activityRequestDto.PerformanceDescription);
|
||||
_repositoryWrapper.SetRepository<Activity>().Update(activity);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
repositoryWrapper.SetRepository<Activity>().Update(activity);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -49,44 +41,44 @@ public class ActivityService : IActivityService
|
|||
|
||||
public async Task<bool> UnDoneActivityAsync(Guid activityId, string undoneReason, CancellationToken cancellationToken)
|
||||
{
|
||||
var activity = await _repositoryWrapper.SetRepository<Activity>()
|
||||
var activity = await repositoryWrapper.SetRepository<Activity>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(a => a.Id == activityId, cancellationToken);
|
||||
if (activity == null)
|
||||
throw new AppException("Activity not found ", ApiResultStatusCode.NotFound);
|
||||
activity.UnDoneActivity(undoneReason);
|
||||
_repositoryWrapper.SetRepository<Activity>()
|
||||
repositoryWrapper.SetRepository<Activity>()
|
||||
.Update(activity);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateActivitiesByShiftPlan(Guid shiftPlanId, CancellationToken cancellationToken)
|
||||
{
|
||||
var shiftPlan = await _mediator.Send(new GetShiftPlanQuery(shiftPlanId), cancellationToken);
|
||||
var shiftPlan = await mediator.Send(new GetShiftPlanQuery(shiftPlanId), cancellationToken);
|
||||
if (shiftPlan.Id == Guid.Empty)
|
||||
return false;
|
||||
|
||||
var dailyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
var dailyTasks = await (from task in repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId && task.ScheduleType == TaskScheduleType.Daily
|
||||
select task).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var weeklyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskDay in _repositoryWrapper.SetRepository<TaskDay>().Entities on task.Id equals taskDay.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
var weeklyTasks = await (from task in repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskDay in repositoryWrapper.SetRepository<TaskDay>().Entities on task.Id equals taskDay.TaskId
|
||||
join taskRoutine in repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
taskDay.DayOfWeek == shiftPlan.PlanFor.DayOfWeek && task.ScheduleType == TaskScheduleType.Weekly
|
||||
group task by task.Id into groupedTask
|
||||
select groupedTask.FirstOrDefault()).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var customTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
var customTasks = await (from task in repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
task.ScheduleType == TaskScheduleType.Custom && task.SetFor.Date == shiftPlan.PlanFor.Date
|
||||
|
@ -98,13 +90,13 @@ public class ActivityService : IActivityService
|
|||
tasks.AddRange(dailyTasks);
|
||||
tasks.AddRange(customTasks);
|
||||
|
||||
var shiftPlanPositions = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
var shiftPlanPositions = await repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
.Where(spu => spu.ShiftPlanId == shiftPlan.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
|
||||
var activities = await _repositoryWrapper.SetRepository<Activity>()
|
||||
var activities = await repositoryWrapper.SetRepository<Activity>()
|
||||
.TableNoTracking
|
||||
.Where(a => a.ShiftPlanId == shiftPlan.ShiftId && a.SetFor.Date == shiftPlan.PlanFor.Date)
|
||||
.Select(ActivityMapper.ProjectToLDto)
|
||||
|
@ -115,7 +107,7 @@ public class ActivityService : IActivityService
|
|||
if (foundedTask == null)
|
||||
continue;
|
||||
|
||||
var taskPositions = await _repositoryWrapper.SetRepository<TaskPosition>()
|
||||
var taskPositions = await repositoryWrapper.SetRepository<TaskPosition>()
|
||||
.TableNoTracking
|
||||
.Where(tp => tp.TaskId == foundedTask.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
@ -128,7 +120,7 @@ public class ActivityService : IActivityService
|
|||
if (activity.UserId != foundedUser.UserId)
|
||||
{
|
||||
|
||||
await _mediator.Send(new UpdateActivityCommand(activity.Id, activity.Status, activity.DoneAt, activity.PerformanceDescription,
|
||||
await mediator.Send(new UpdateActivityCommand(activity.Id, activity.Status, activity.DoneAt, activity.PerformanceDescription,
|
||||
activity.Type, activity.Title, activity.Description, activity.IsDisposable, activity.SetFor, activity.HasDisposed, activity.Amount
|
||||
, activity.AmountType, activity.ScheduleType, shiftPlan.Id, foundedUser.UserId), cancellationToken);
|
||||
}
|
||||
|
@ -138,30 +130,30 @@ public class ActivityService : IActivityService
|
|||
}
|
||||
|
||||
public async Task<bool> CreateActivitiesByShiftPlan(Guid shiftPlanId, CancellationToken cancellationToken) {
|
||||
var shiftPlan = await _mediator.Send(new GetShiftPlanQuery(shiftPlanId), cancellationToken);
|
||||
var shiftPlan = await mediator.Send(new GetShiftPlanQuery(shiftPlanId), cancellationToken);
|
||||
if (shiftPlan.Id == Guid.Empty)
|
||||
return false;
|
||||
|
||||
var dailyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
var dailyTasks = await (from task in repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where task.IsActivity == false && taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId && task.ScheduleType == TaskScheduleType.Daily
|
||||
select task).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var weeklyTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskDay in _repositoryWrapper.SetRepository<TaskDay>().Entities on task.Id equals taskDay.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
var weeklyTasks = await (from task in repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskDay in repositoryWrapper.SetRepository<TaskDay>().Entities on task.Id equals taskDay.TaskId
|
||||
join taskRoutine in repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where task.IsActivity == false && taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
taskDay.DayOfWeek == shiftPlan.PlanFor.DayOfWeek && task.ScheduleType == TaskScheduleType.Weekly
|
||||
group task by task.Id into groupedTask
|
||||
select groupedTask.FirstOrDefault()).AsNoTracking().ToListAsync(cancellationToken);
|
||||
|
||||
var customTasks = await (from task in _repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in _repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in _repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
var customTasks = await (from task in repositoryWrapper.SetRepository<Task>().Entities
|
||||
join taskShift in repositoryWrapper.SetRepository<TaskShift>().Entities on task.Id equals taskShift.TaskId
|
||||
join taskRoutine in repositoryWrapper.SetRepository<TaskRoutine>().Entities on task.Id equals taskRoutine
|
||||
.TaskId
|
||||
where task.IsActivity == false && taskShift.ShiftId == shiftPlan.ShiftId && taskRoutine.RoutineId == shiftPlan.RoutineId &&
|
||||
task.ScheduleType == TaskScheduleType.Custom && task.SetFor.Date == shiftPlan.PlanFor.Date
|
||||
|
@ -173,14 +165,14 @@ public class ActivityService : IActivityService
|
|||
tasks.AddRange(customTasks);
|
||||
|
||||
|
||||
var shiftPlanPositions = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
var shiftPlanPositions = await repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
.Where(spu => spu.ShiftPlanId == shiftPlan.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
var taskPositions = await _repositoryWrapper.SetRepository<TaskPosition>()
|
||||
var taskPositions = await repositoryWrapper.SetRepository<TaskPosition>()
|
||||
.TableNoTracking
|
||||
.Where(tp => tp.TaskId == task.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
@ -190,7 +182,7 @@ public class ActivityService : IActivityService
|
|||
var fundedUser = shiftPlanPositions.FirstOrDefault(spu => spu.PositionId == taskPosition.PositionId);
|
||||
if (fundedUser != null)
|
||||
{
|
||||
await _mediator.Send(new CreateActivityCommand(task.Type, task.Title, task.Description, task.IsDisposable,
|
||||
await mediator.Send(new CreateActivityCommand(task.Type, task.Title, task.Description, task.IsDisposable,
|
||||
shiftPlan.PlanFor, task.HasDisposed, task.Amount, task.AmountType,
|
||||
task.ScheduleType, shiftPlan.Id, fundedUser.UserId), cancellationToken);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,17 @@ public class ShiftPlanService(IMediator mediator, IActivityService activityServi
|
|||
repositoryWrapper.SetRepository<ShiftPlan>().Update(shiftPlan);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
await activityService.CompleteActivitiesAsync(requestDtos.CompleteActivities, cancellationToken);
|
||||
|
||||
var shiftPlanUsers = await repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking.Where(s => s.ShiftPlanId == id)
|
||||
.Select(ShiftPlanUserMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var shiftPlanUser in shiftPlanUsers)
|
||||
{
|
||||
var message = $"{shiftPlanUser.UserFullName}";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,4 @@
|
|||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Brizco.Core.MartenServices;
|
||||
namespace Brizco.Core.MartenServices;
|
||||
|
||||
public class BrewService : IBrewService
|
||||
{
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using Brizco.Domain.Entities.ShiftPlans;
|
||||
namespace Brizco.Core.QuartzServices.Handlers;
|
||||
|
||||
namespace Brizco.Core.QuartzServices.Handlers;
|
||||
|
||||
public class CreateShiftPlanNotificationsCommandHandler(IMediator mediator,IRepositoryWrapper repositoryWrapper)
|
||||
: IRequestHandler<CreateShiftPlanNotificationsCommand,bool>
|
||||
public class CreateShiftPlanNotificationsCommandHandler(IMediator mediator, IRepositoryWrapper repositoryWrapper)
|
||||
: IRequestHandler<CreateShiftPlanNotificationsCommand, bool>
|
||||
{
|
||||
public async Task<bool> Handle(CreateShiftPlanNotificationsCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -28,8 +26,8 @@ public class CreateShiftPlanNotificationsCommandHandler(IMediator mediator,IRepo
|
|||
|
||||
foreach (var shiftPlanUser in shiftPlanUsers)
|
||||
{
|
||||
var completeShiftMessageForUser = $"";
|
||||
await mediator.Send( new CreateNotificationCommand(completeShiftMessageForUser, shiftPlanUser.UserId, shiftPlan.ComplexId), cancellationToken);
|
||||
var completeShiftMessageForUser = $"شیفتهای هفته بعد بسته شد، دیگه کار، کار، کار.";
|
||||
await mediator.Send(new CreateNotificationCommand(completeShiftMessageForUser, shiftPlanUser.UserId, shiftPlan.ComplexId), cancellationToken);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using Brizco.Core.QuartzServices.Commands;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Quartz;
|
||||
|
||||
namespace Brizco.Core.QuartzServices.Handlers;
|
||||
|
||||
public class SetShiftPlanNotificationScheduleCommandHandler(IRepositoryWrapper repositoryWrapper,IScheduler scheduler) : IRequestHandler<SetShiftPlanNotificationScheduleCommand,bool>
|
||||
public class SetShiftPlanNotificationScheduleCommandHandler(IRepositoryWrapper repositoryWrapper,IScheduler scheduler,IMediator mediator,ILogger<SetShiftPlanNotificationScheduleCommand> logger)
|
||||
: IRequestHandler<SetShiftPlanNotificationScheduleCommand,bool>
|
||||
{
|
||||
public async Task<bool> Handle(SetShiftPlanNotificationScheduleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -20,9 +22,22 @@ public class SetShiftPlanNotificationScheduleCommandHandler(IRepositoryWrapper r
|
|||
if(shift == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.NotFound, "Shift not found in set schedule");
|
||||
|
||||
var shiftPlanStartAt = (new DateTime(shiftPlan.PlanFor.Year, shiftPlan.PlanFor.Month, shiftPlan.PlanFor.Day, shift.StartAt.Hours,shift.StartAt.Minutes,shift.StartAt.Seconds)).ToUniversalTime();
|
||||
var shiftPlanUsers = await repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
.Where(f => f.ShiftPlanId == request.ShiftPlanId)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var shiftPlanUser in shiftPlanUsers)
|
||||
{
|
||||
var completeShiftMessageForUser = $"شیفتهای هفته بعد بسته شد، دیگه کار، کار، کار.";
|
||||
await mediator.Send(new CreateNotificationCommand(completeShiftMessageForUser, shiftPlanUser.UserId, shiftPlan.ComplexId), cancellationToken);
|
||||
}
|
||||
|
||||
var shiftPlanStartAt = (new DateTime(shiftPlan.PlanFor.Year, shiftPlan.PlanFor.Month, shiftPlan.PlanFor.Day, shift.StartAt.Hours, shift.StartAt.Minutes, shift.StartAt.Seconds)).ToUniversalTime();
|
||||
var shiftPlanEndAt = (new DateTime(shiftPlan.PlanFor.Year, shiftPlan.PlanFor.Month, shiftPlan.PlanFor.Day, shift.EndAt.Hours, shift.EndAt.Minutes, shift.EndAt.Seconds)).ToUniversalTime();
|
||||
|
||||
var currentDate = DateTime.UtcNow;
|
||||
|
||||
var startTimeOffset = new DateTimeOffset(shiftPlanStartAt.Year, shiftPlanStartAt.Month, shiftPlanStartAt.Day, shiftPlanStartAt.Hour,
|
||||
shiftPlanStartAt.Minute, shiftPlanStartAt.Second, TimeSpan.Zero);
|
||||
var endTimeOffset = new DateTimeOffset(shiftPlanEndAt.Year, shiftPlanEndAt.Month, shiftPlanEndAt.Day, shiftPlanEndAt.Hour,
|
||||
|
@ -36,10 +51,9 @@ public class SetShiftPlanNotificationScheduleCommandHandler(IRepositoryWrapper r
|
|||
ITrigger beforeEndShift30MinTrigger = TriggerBuilder.Create()
|
||||
.WithIdentity(StringExtensions.GetId(9), shift.ComplexId.ToString())
|
||||
.WithSimpleSchedule(x => x.WithRepeatCount(0))
|
||||
.StartAt(endTimeOffset.AddMinutes(-40))
|
||||
.StartAt(endTimeOffset.AddMinutes(-35))
|
||||
.Build();
|
||||
|
||||
|
||||
IJobDetail endOfShift = JobBuilder.Create<ShiftPlanNotificationScheduledJob>()
|
||||
.WithIdentity(ShiftPlanNotifyType.EndOfShift.ToString(), shiftPlan.Id.ToString())
|
||||
.Build();
|
||||
|
@ -60,9 +74,10 @@ public class SetShiftPlanNotificationScheduleCommandHandler(IRepositoryWrapper r
|
|||
.Build();
|
||||
|
||||
|
||||
await scheduler.ScheduleJob(beforeEndShift30Min, beforeEndShift30MinTrigger, cancellationToken);
|
||||
await scheduler.ScheduleJob(endOfShift, endOfShiftTrigger, cancellationToken);
|
||||
await scheduler.ScheduleJob(afterStartShift2Hour, afterStartShift2HourTrigger, cancellationToken);
|
||||
var seTimeOffsetA = await scheduler.ScheduleJob(beforeEndShift30Min, beforeEndShift30MinTrigger, cancellationToken);
|
||||
var seTimeOffsetB = await scheduler.ScheduleJob(endOfShift, endOfShiftTrigger, cancellationToken);
|
||||
var seTimeOffsetC = await scheduler.ScheduleJob(afterStartShift2Hour, afterStartShift2HourTrigger, cancellationToken);
|
||||
await scheduler.Start(cancellationToken);
|
||||
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Brizco.Domain.Entities.ShiftPlans;
|
||||
using Brizco.Domain.Entities.Tasks;
|
||||
using Brizco.Domain.Entities.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Quartz;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
@ -26,12 +25,15 @@ public class ShiftPlanNotificationScheduledJob : IJob
|
|||
var notifyType = (ShiftPlanNotifyType)int.Parse(context.JobDetail.Key.Name);
|
||||
var shiftPlanId = Guid.Parse(context.JobDetail.Key.Group);
|
||||
var shiftPlan = await _repositoryWrapper.SetRepository<ShiftPlan>().TableNoTracking
|
||||
.FirstOrDefaultAsync(f => f.Id == shiftPlanId);
|
||||
.Where(f => f.Id == shiftPlanId)
|
||||
.Select(ShiftPlanMapper.ProjectToSDto)
|
||||
.FirstOrDefaultAsync();
|
||||
if (shiftPlan == null)
|
||||
throw new Exception("Shift plan not found");
|
||||
var shiftPlanUsers = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
.Where(f => f.ShiftPlanId == shiftPlanId)
|
||||
.Select(ShiftPlanUserMapper.ProjectToSDto)
|
||||
.ToListAsync();
|
||||
var superVisorId = shiftPlan.SupervisorId;
|
||||
switch (notifyType)
|
||||
|
@ -47,7 +49,7 @@ public class ShiftPlanNotificationScheduledJob : IJob
|
|||
var unDoneCount = activities.Count(a => a.UserId == shiftPlanUser.UserId && a.IsDone == false);
|
||||
if(unDoneCount == 0)
|
||||
continue;
|
||||
string message = $"شما تعداد {unDoneCount} وظیفه انجام نشده در شیفت مورد نظر دارید ، نیم ساعت به پایان شیفت مانده است";
|
||||
string message = $"نیم ساعت مونده تا شیفت تموم شه و {unDoneCount} عدد از تست هات مونده، حالا چه خاکی به سر کنیم!😱";
|
||||
await _mediator.Send(new CreateNotificationCommand(message, shiftPlanUser.UserId, shiftPlan.ComplexId));
|
||||
}
|
||||
break;
|
||||
|
@ -59,14 +61,23 @@ public class ShiftPlanNotificationScheduledJob : IJob
|
|||
var unDoneCount = activitiesEndShift.Count(a => a.UserId == shiftPlanUser.UserId && a.IsDone == false);
|
||||
if (unDoneCount == 0)
|
||||
continue;
|
||||
string message = $"شما تعداد {unDoneCount} وظیفه انجام نشده در شیفت مورد نظر دارید";
|
||||
string message = $"{shiftPlanUser.UserFullName} {shiftPlan.ShiftTitle} {shiftPlan.PlanFor.ToPersianDateTime().ToLongDateTimeString()} تموم شده است و {unDoneCount} - عدد از تسک های شما کاری روشون انجام نشده ، خطر سوپروایزر در کمین است";
|
||||
await _mediator.Send(new CreateNotificationCommand(message, shiftPlanUser.UserId, shiftPlan.ComplexId));
|
||||
}
|
||||
string superVisorAfterShiftMessage = $"سوپر وایزر محترم ، شیفت مورد نظر به پایان رسیده است ، لطفا فعالیت ها را رسیدگی کنید";
|
||||
string superVisorAfterShiftMessage = $"{shiftPlan.SupervisorFullName} محترم {shiftPlan.ShiftTitle} تموم شد. برو به کار بچه ها نمره بده و مو رو از ماست بکش و کامنت یادت نره";
|
||||
await _mediator.Send(new CreateNotificationCommand(superVisorAfterShiftMessage, shiftPlan.SupervisorId, shiftPlan.ComplexId));
|
||||
break;
|
||||
case ShiftPlanNotifyType.AfterStartShift2Hour:
|
||||
|
||||
var activities2AfterStartShift = await _repositoryWrapper.SetRepository<Activity>().TableNoTracking
|
||||
.Where(a => a.ShiftPlanId == shiftPlanId).ToListAsync();
|
||||
foreach (var shiftPlanUser in shiftPlanUsers)
|
||||
{
|
||||
var unDoneCount = activities2AfterStartShift.Count(a => a.UserId == shiftPlanUser.UserId && a.IsDone == false);
|
||||
if (unDoneCount == 0)
|
||||
continue;
|
||||
string message = $"{shiftPlanUser.UserFullName} دوساعت از {shiftPlan.ShiftTitle} گذشته ، اون انگشت و بزن روی تیک تسک ها که وقت طلاس مشتیییییی ";
|
||||
await _mediator.Send(new CreateNotificationCommand(message, shiftPlanUser.UserId, shiftPlan.ComplexId));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
<Using Include="Brizco.Domain.Entities.Shifts" />
|
||||
<Using Include="Brizco.Domain.Entities.Users" />
|
||||
<Using Include="Brizco.Domain.Enums" />
|
||||
<Using Include="Brizco.Domain.MartenEntities.NewFeeds" />
|
||||
<Using Include="Mapster" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="System.ComponentModel" />
|
||||
|
@ -70,4 +71,10 @@
|
|||
<Using Include="MediatR" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="MartenEntities\NewFeeds\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
namespace Brizco.Domain.CommandQueries.Commands;
|
||||
|
||||
public record CreateNewsFeedCommand(string Title,string Content,bool IsPin) : IRequest<Guid>;
|
||||
public record DeleteNewsFeedCommand(Guid Id) : IRequest<bool>;
|
||||
public record ChangeNewsFeedPinCommand(Guid Id , bool IsPin) : IRequest<bool>;
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public sealed record GetActivitiesQuery(int Page = 0 , long SelectedDate = 0 , Guid SelectedShiftPlanId = default , DateQueryFilter? DateQueryFilter = null) : IRequest<List<ActivitySDto>>;
|
||||
public sealed record GetActivitiesQuery(int Page = 0 ,
|
||||
long SelectedDate = 0 ,
|
||||
Guid? SelectedShiftPlanId = null ,
|
||||
DateTimeQueryFilter? DateQueryFilter = null,
|
||||
Guid? UserId = null) : IRequest<List<ActivitySDto>>;
|
||||
|
||||
public sealed record GetActivityQuery(Guid Id) : IRequest<ActivityLDto>;
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public record GetNewsFeedsQuery(int Page , int? Count = 0) : IRequest<List<NewsFeed>>;
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public record GetNotificationsQuery(int Page,int Count, Guid? UserId=null) : IRequest<List<Notification>>;
|
||||
public record GetNotificationsQuery(int Page,int? Count=null, Guid? UserId=null) : IRequest<List<Notification>>;
|
||||
public record GetNotificationsCountQuery() : IRequest<int>;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public sealed record GetTasksQuery(int Page = 0) :
|
||||
public sealed record GetTasksQuery(int Page = 0 , int? Count = null,Guid? ShiftId = null) :
|
||||
IRequest<List<TaskSDto>>;
|
||||
|
||||
public sealed record GetTaskQuery(Guid Id) :
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
namespace Brizco.Domain.CommandQueries.Queries;
|
||||
|
||||
public record GetStaffQuery(int Page , DateTimeQueryFilter DateTimeQuery , int? Count = null) : IRequest<List<StaffResponseSDto>>;
|
|
@ -0,0 +1,8 @@
|
|||
namespace Brizco.Domain.Dtos.ResponseDto;
|
||||
|
||||
public class StaffResponseSDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
}
|
|
@ -20,6 +20,7 @@ public class ActivitySDto : BaseDto<ActivitySDto , Activity>
|
|||
public string UserFirstName { get; set; } = string.Empty;
|
||||
public string UserLastName { get; set; } = string.Empty;
|
||||
public string UserFullName => UserFirstName + " " + UserLastName;
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
|
||||
public int Amount { get; set; }
|
||||
|
|
|
@ -18,6 +18,7 @@ public class ShiftPlanSDto : BaseDto<ShiftPlanSDto,ShiftPlan>
|
|||
public string ShiftTitle { get; set; } = string.Empty;
|
||||
public TimeSpan StartAt { get; set; }
|
||||
public TimeSpan EndAt { get; set; }
|
||||
public Guid SupervisorId { get; set; }
|
||||
|
||||
public List<ShiftPlanUserSDto> Users { get; set; } = new();
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
namespace Brizco.Domain.Enums;
|
||||
|
||||
public enum DateQueryFilter
|
||||
{
|
||||
Today = 0,
|
||||
Tomorrow = 1,
|
||||
ThisWeek = 2,
|
||||
Yesterday = 3,
|
||||
}
|
|
@ -5,6 +5,7 @@ public enum DateTimeQueryFilter
|
|||
CustomDate = 0,
|
||||
Today = 1,
|
||||
Yesterday = 2,
|
||||
Tomorrow = 3,
|
||||
PastWeek = 10,
|
||||
NextWeek = 11,
|
||||
ThisWeek = 12,
|
||||
|
|
|
@ -20,10 +20,12 @@ namespace Brizco.Domain.Mappers
|
|||
IsDone = p1.IsDone,
|
||||
UnDoneReason = p1.UnDoneReason,
|
||||
PerformanceDescription = p1.PerformanceDescription,
|
||||
UserId = p1.UserId,
|
||||
User = new ApplicationUser()
|
||||
{
|
||||
FirstName = p1.UserFirstName,
|
||||
LastName = p1.UserLastName
|
||||
LastName = p1.UserLastName,
|
||||
Id = p1.UserId
|
||||
},
|
||||
ShiftPlanId = p1.ShiftPlanId,
|
||||
ShiftPlan = new ShiftPlan() {Id = p1.ShiftPlanId},
|
||||
|
@ -52,6 +54,7 @@ namespace Brizco.Domain.Mappers
|
|||
result.IsDone = p2.IsDone;
|
||||
result.UnDoneReason = p2.UnDoneReason;
|
||||
result.PerformanceDescription = p2.PerformanceDescription;
|
||||
result.UserId = p2.UserId;
|
||||
result.User = funcMain1(new Never(), result.User, p2);
|
||||
result.ShiftPlanId = p2.ShiftPlanId;
|
||||
result.ShiftPlan = funcMain2(new Never(), result.ShiftPlan, p2);
|
||||
|
@ -75,10 +78,12 @@ namespace Brizco.Domain.Mappers
|
|||
IsDone = p8.IsDone,
|
||||
UnDoneReason = p8.UnDoneReason,
|
||||
PerformanceDescription = p8.PerformanceDescription,
|
||||
UserId = p8.UserId,
|
||||
User = new ApplicationUser()
|
||||
{
|
||||
FirstName = p8.UserFirstName,
|
||||
LastName = p8.UserLastName
|
||||
LastName = p8.UserLastName,
|
||||
Id = p8.UserId
|
||||
},
|
||||
ShiftPlanId = p8.ShiftPlanId,
|
||||
ShiftPlan = new ShiftPlan() {Id = p8.ShiftPlanId},
|
||||
|
@ -112,6 +117,7 @@ namespace Brizco.Domain.Mappers
|
|||
PerformanceDescription = p9.PerformanceDescription,
|
||||
UserFirstName = p9.User != null ? p9.User.FirstName : string.Empty,
|
||||
UserLastName = p9.User != null ? p9.User.LastName : string.Empty,
|
||||
UserId = p9.UserId,
|
||||
Amount = p9.Amount,
|
||||
ShiftPlanId = p9.ShiftPlanId,
|
||||
AmountType = p9.AmountType,
|
||||
|
@ -141,6 +147,7 @@ namespace Brizco.Domain.Mappers
|
|||
result.PerformanceDescription = p10.PerformanceDescription;
|
||||
result.UserFirstName = p10.User != null ? p10.User.FirstName : string.Empty;
|
||||
result.UserLastName = p10.User != null ? p10.User.LastName : string.Empty;
|
||||
result.UserId = p10.UserId;
|
||||
result.Amount = p10.Amount;
|
||||
result.ShiftPlanId = p10.ShiftPlanId;
|
||||
result.AmountType = p10.AmountType;
|
||||
|
@ -165,6 +172,7 @@ namespace Brizco.Domain.Mappers
|
|||
PerformanceDescription = p12.PerformanceDescription,
|
||||
UserFirstName = p12.User != null ? p12.User.FirstName : string.Empty,
|
||||
UserLastName = p12.User != null ? p12.User.LastName : string.Empty,
|
||||
UserId = p12.UserId,
|
||||
Amount = p12.Amount,
|
||||
ShiftPlanId = p12.ShiftPlanId,
|
||||
AmountType = p12.AmountType,
|
||||
|
@ -289,6 +297,7 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
result.FirstName = p2.UserFirstName;
|
||||
result.LastName = p2.UserLastName;
|
||||
result.Id = p2.UserId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ namespace Brizco.Domain.Mappers
|
|||
Title = p1.ShiftTitle,
|
||||
Id = p1.ShiftId
|
||||
},
|
||||
ComplexId = p1.ComplexId,
|
||||
Complex = new Complex() {Id = p1.ComplexId},
|
||||
SupervisorId = p1.SupervisorId,
|
||||
Supervisor = new ApplicationUser() {Id = p1.SupervisorId},
|
||||
Users = funcMain1(p1.Users),
|
||||
Id = p1.Id
|
||||
};
|
||||
|
@ -47,198 +51,212 @@ namespace Brizco.Domain.Mappers
|
|||
result.CompleteDescription = p3.CompleteDescription;
|
||||
result.ShiftId = p3.ShiftId;
|
||||
result.Shift = funcMain2(new Never(), result.Shift, p3);
|
||||
result.Users = funcMain3(p3.Users, result.Users);
|
||||
result.ComplexId = p3.ComplexId;
|
||||
result.Complex = funcMain3(new Never(), result.Complex, p3);
|
||||
result.SupervisorId = p3.SupervisorId;
|
||||
result.Supervisor = funcMain4(new Never(), result.Supervisor, p3);
|
||||
result.Users = funcMain5(p3.Users, result.Users);
|
||||
result.Id = p3.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p9 => new ShiftPlan()
|
||||
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p13 => new ShiftPlan()
|
||||
{
|
||||
PlanFor = p9.PlanFor,
|
||||
IsCompleted = p9.IsCompleted,
|
||||
CompletePercent = p9.CompletePercent,
|
||||
CompleteDescription = p9.CompleteDescription,
|
||||
ShiftId = p9.ShiftId,
|
||||
PlanFor = p13.PlanFor,
|
||||
IsCompleted = p13.IsCompleted,
|
||||
CompletePercent = p13.CompletePercent,
|
||||
CompleteDescription = p13.CompleteDescription,
|
||||
ShiftId = p13.ShiftId,
|
||||
Shift = new Shift()
|
||||
{
|
||||
Title = p9.ShiftTitle,
|
||||
Id = p9.ShiftId
|
||||
Title = p13.ShiftTitle,
|
||||
Id = p13.ShiftId
|
||||
},
|
||||
Users = p9.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p10 => new ShiftPlanUser()
|
||||
ComplexId = p13.ComplexId,
|
||||
Complex = new Complex() {Id = p13.ComplexId},
|
||||
SupervisorId = p13.SupervisorId,
|
||||
Supervisor = new ApplicationUser() {Id = p13.SupervisorId},
|
||||
Users = p13.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p14 => new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = p10.ShiftPlanId,
|
||||
ShiftPlan = new ShiftPlan() {Id = p10.ShiftPlanId},
|
||||
PositionId = p10.PositionId,
|
||||
ShiftPlanId = p14.ShiftPlanId,
|
||||
ShiftPlan = new ShiftPlan() {Id = p14.ShiftPlanId},
|
||||
PositionId = p14.PositionId,
|
||||
Position = new Position()
|
||||
{
|
||||
Name = p10.PositionName,
|
||||
Id = p10.PositionId
|
||||
Name = p14.PositionName,
|
||||
Id = p14.PositionId
|
||||
},
|
||||
UserId = p10.UserId,
|
||||
User = new ApplicationUser() {Id = p10.UserId},
|
||||
Id = p10.Id
|
||||
UserId = p14.UserId,
|
||||
User = new ApplicationUser() {Id = p14.UserId},
|
||||
Id = p14.Id
|
||||
}).ToList<ShiftPlanUser>(),
|
||||
Id = p9.Id
|
||||
Id = p13.Id
|
||||
};
|
||||
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p11)
|
||||
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p15)
|
||||
{
|
||||
return p11 == null ? null : new ShiftPlanSDto()
|
||||
return p15 == null ? null : new ShiftPlanSDto()
|
||||
{
|
||||
PlanFor = p11.PlanFor,
|
||||
IsCompleted = p11.IsCompleted,
|
||||
CompletePercent = p11.CompletePercent,
|
||||
SupervisorFullName = p11.Supervisor != null ? p11.Supervisor.FirstName + " " + p11.Supervisor.LastName : string.Empty,
|
||||
CompleteDescription = p11.CompleteDescription,
|
||||
ShiftId = p11.ShiftId,
|
||||
ShiftTitle = p11.Shift == null ? null : p11.Shift.Title,
|
||||
StartAt = p11.Shift != null ? p11.Shift.StartAt : TimeSpan.MinValue,
|
||||
EndAt = p11.Shift != null ? p11.Shift.EndAt : TimeSpan.MinValue,
|
||||
Users = funcMain4(p11.Users),
|
||||
Id = p11.Id
|
||||
PlanFor = p15.PlanFor,
|
||||
IsCompleted = p15.IsCompleted,
|
||||
CompletePercent = p15.CompletePercent,
|
||||
SupervisorFullName = p15.Supervisor != null ? p15.Supervisor.FirstName + " " + p15.Supervisor.LastName : string.Empty,
|
||||
CompleteDescription = p15.CompleteDescription,
|
||||
ComplexId = p15.ComplexId,
|
||||
ShiftId = p15.ShiftId,
|
||||
ShiftTitle = p15.Shift == null ? null : p15.Shift.Title,
|
||||
StartAt = p15.Shift != null ? p15.Shift.StartAt : TimeSpan.MinValue,
|
||||
EndAt = p15.Shift != null ? p15.Shift.EndAt : TimeSpan.MinValue,
|
||||
SupervisorId = p15.SupervisorId,
|
||||
Users = funcMain6(p15.Users),
|
||||
Id = p15.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanSDto AdaptTo(this ShiftPlan p13, ShiftPlanSDto p14)
|
||||
public static ShiftPlanSDto AdaptTo(this ShiftPlan p17, ShiftPlanSDto p18)
|
||||
{
|
||||
if (p13 == null)
|
||||
if (p17 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanSDto result = p14 ?? new ShiftPlanSDto();
|
||||
ShiftPlanSDto result = p18 ?? new ShiftPlanSDto();
|
||||
|
||||
result.PlanFor = p13.PlanFor;
|
||||
result.IsCompleted = p13.IsCompleted;
|
||||
result.CompletePercent = p13.CompletePercent;
|
||||
result.SupervisorFullName = p13.Supervisor != null ? p13.Supervisor.FirstName + " " + p13.Supervisor.LastName : string.Empty;
|
||||
result.CompleteDescription = p13.CompleteDescription;
|
||||
result.ShiftId = p13.ShiftId;
|
||||
result.ShiftTitle = p13.Shift == null ? null : p13.Shift.Title;
|
||||
result.StartAt = p13.Shift != null ? p13.Shift.StartAt : TimeSpan.MinValue;
|
||||
result.EndAt = p13.Shift != null ? p13.Shift.EndAt : TimeSpan.MinValue;
|
||||
result.Users = funcMain5(p13.Users, result.Users);
|
||||
result.Id = p13.Id;
|
||||
result.PlanFor = p17.PlanFor;
|
||||
result.IsCompleted = p17.IsCompleted;
|
||||
result.CompletePercent = p17.CompletePercent;
|
||||
result.SupervisorFullName = p17.Supervisor != null ? p17.Supervisor.FirstName + " " + p17.Supervisor.LastName : string.Empty;
|
||||
result.CompleteDescription = p17.CompleteDescription;
|
||||
result.ComplexId = p17.ComplexId;
|
||||
result.ShiftId = p17.ShiftId;
|
||||
result.ShiftTitle = p17.Shift == null ? null : p17.Shift.Title;
|
||||
result.StartAt = p17.Shift != null ? p17.Shift.StartAt : TimeSpan.MinValue;
|
||||
result.EndAt = p17.Shift != null ? p17.Shift.EndAt : TimeSpan.MinValue;
|
||||
result.SupervisorId = p17.SupervisorId;
|
||||
result.Users = funcMain7(p17.Users, result.Users);
|
||||
result.Id = p17.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p17 => new ShiftPlanSDto()
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p21 => new ShiftPlanSDto()
|
||||
{
|
||||
PlanFor = p17.PlanFor,
|
||||
IsCompleted = p17.IsCompleted,
|
||||
CompletePercent = p17.CompletePercent,
|
||||
SupervisorFullName = p17.Supervisor != null ? p17.Supervisor.FirstName + " " + p17.Supervisor.LastName : string.Empty,
|
||||
CompleteDescription = p17.CompleteDescription,
|
||||
ShiftId = p17.ShiftId,
|
||||
ShiftTitle = p17.Shift.Title,
|
||||
StartAt = p17.Shift != null ? p17.Shift.StartAt : TimeSpan.MinValue,
|
||||
EndAt = p17.Shift != null ? p17.Shift.EndAt : TimeSpan.MinValue,
|
||||
Users = p17.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p18 => new ShiftPlanUserSDto()
|
||||
PlanFor = p21.PlanFor,
|
||||
IsCompleted = p21.IsCompleted,
|
||||
CompletePercent = p21.CompletePercent,
|
||||
SupervisorFullName = p21.Supervisor != null ? p21.Supervisor.FirstName + " " + p21.Supervisor.LastName : string.Empty,
|
||||
CompleteDescription = p21.CompleteDescription,
|
||||
ComplexId = p21.ComplexId,
|
||||
ShiftId = p21.ShiftId,
|
||||
ShiftTitle = p21.Shift.Title,
|
||||
StartAt = p21.Shift != null ? p21.Shift.StartAt : TimeSpan.MinValue,
|
||||
EndAt = p21.Shift != null ? p21.Shift.EndAt : TimeSpan.MinValue,
|
||||
SupervisorId = p21.SupervisorId,
|
||||
Users = p21.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p22 => new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = p18.ShiftPlanId,
|
||||
UserId = p18.UserId,
|
||||
UserFullName = p18.User != null ? p18.User.FirstName + " " + p18.User.LastName : string.Empty,
|
||||
PositionId = p18.PositionId,
|
||||
PositionName = p18.Position != null ? p18.Position.Name : string.Empty,
|
||||
Id = p18.Id
|
||||
ShiftPlanId = p22.ShiftPlanId,
|
||||
UserId = p22.UserId,
|
||||
UserFullName = p22.User != null ? p22.User.FirstName + " " + p22.User.LastName : string.Empty,
|
||||
PositionId = p22.PositionId,
|
||||
PositionName = p22.Position != null ? p22.Position.Name : string.Empty,
|
||||
Id = p22.Id
|
||||
}).ToList<ShiftPlanUserSDto>(),
|
||||
Id = p17.Id
|
||||
Id = p21.Id
|
||||
};
|
||||
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p19)
|
||||
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p23)
|
||||
{
|
||||
return p19 == null ? null : new ShiftPlan()
|
||||
return p23 == null ? null : new ShiftPlan()
|
||||
{
|
||||
PlanFor = p19.PlanFor,
|
||||
IsCompleted = p19.IsCompleted,
|
||||
CompletePercent = p19.CompletePercent,
|
||||
CompleteDescription = p19.CompleteDescription,
|
||||
ShiftId = p19.ShiftId,
|
||||
Shift = new Shift() {Id = p19.ShiftId},
|
||||
RoutineId = p19.RoutineId,
|
||||
Routine = new Routine() {Id = p19.RoutineId},
|
||||
SupervisorId = p19.SupervisorId,
|
||||
Supervisor = new ApplicationUser() {Id = p19.SupervisorId},
|
||||
Users = funcMain6(p19.Users),
|
||||
Id = p19.Id
|
||||
PlanFor = p23.PlanFor,
|
||||
IsCompleted = p23.IsCompleted,
|
||||
CompletePercent = p23.CompletePercent,
|
||||
CompleteDescription = p23.CompleteDescription,
|
||||
ShiftId = p23.ShiftId,
|
||||
Shift = new Shift() {Id = p23.ShiftId},
|
||||
RoutineId = p23.RoutineId,
|
||||
Routine = new Routine() {Id = p23.RoutineId},
|
||||
SupervisorId = p23.SupervisorId,
|
||||
Supervisor = new ApplicationUser() {Id = p23.SupervisorId},
|
||||
Users = funcMain8(p23.Users),
|
||||
Id = p23.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlan AdaptTo(this ShiftPlanLDto p21, ShiftPlan p22)
|
||||
public static ShiftPlan AdaptTo(this ShiftPlanLDto p25, ShiftPlan p26)
|
||||
{
|
||||
if (p21 == null)
|
||||
if (p25 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlan result = p22 ?? new ShiftPlan();
|
||||
ShiftPlan result = p26 ?? new ShiftPlan();
|
||||
|
||||
result.PlanFor = p21.PlanFor;
|
||||
result.IsCompleted = p21.IsCompleted;
|
||||
result.CompletePercent = p21.CompletePercent;
|
||||
result.CompleteDescription = p21.CompleteDescription;
|
||||
result.ShiftId = p21.ShiftId;
|
||||
result.Shift = funcMain7(new Never(), result.Shift, p21);
|
||||
result.RoutineId = p21.RoutineId;
|
||||
result.Routine = funcMain8(new Never(), result.Routine, p21);
|
||||
result.SupervisorId = p21.SupervisorId;
|
||||
result.Supervisor = funcMain9(new Never(), result.Supervisor, p21);
|
||||
result.Users = funcMain10(p21.Users, result.Users);
|
||||
result.Id = p21.Id;
|
||||
result.PlanFor = p25.PlanFor;
|
||||
result.IsCompleted = p25.IsCompleted;
|
||||
result.CompletePercent = p25.CompletePercent;
|
||||
result.CompleteDescription = p25.CompleteDescription;
|
||||
result.ShiftId = p25.ShiftId;
|
||||
result.Shift = funcMain9(new Never(), result.Shift, p25);
|
||||
result.RoutineId = p25.RoutineId;
|
||||
result.Routine = funcMain10(new Never(), result.Routine, p25);
|
||||
result.SupervisorId = p25.SupervisorId;
|
||||
result.Supervisor = funcMain11(new Never(), result.Supervisor, p25);
|
||||
result.Users = funcMain12(p25.Users, result.Users);
|
||||
result.Id = p25.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p31)
|
||||
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p35)
|
||||
{
|
||||
return p31 == null ? null : new ShiftPlanLDto()
|
||||
return p35 == null ? null : new ShiftPlanLDto()
|
||||
{
|
||||
PlanFor = p31.PlanFor,
|
||||
RoutineId = p31.RoutineId,
|
||||
IsCompleted = p31.IsCompleted,
|
||||
CompletePercent = p31.CompletePercent,
|
||||
CompleteDescription = p31.CompleteDescription,
|
||||
ShiftId = p31.ShiftId,
|
||||
Users = funcMain11(p31.Users),
|
||||
SupervisorId = p31.SupervisorId,
|
||||
SupervisorFullName = p31.Supervisor != null ? p31.Supervisor.FirstName + " " + p31.Supervisor.LastName : string.Empty,
|
||||
Id = p31.Id
|
||||
PlanFor = p35.PlanFor,
|
||||
RoutineId = p35.RoutineId,
|
||||
IsCompleted = p35.IsCompleted,
|
||||
CompletePercent = p35.CompletePercent,
|
||||
CompleteDescription = p35.CompleteDescription,
|
||||
ShiftId = p35.ShiftId,
|
||||
Users = funcMain13(p35.Users),
|
||||
SupervisorId = p35.SupervisorId,
|
||||
SupervisorFullName = p35.Supervisor != null ? p35.Supervisor.FirstName + " " + p35.Supervisor.LastName : string.Empty,
|
||||
Id = p35.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanLDto AdaptTo(this ShiftPlan p33, ShiftPlanLDto p34)
|
||||
public static ShiftPlanLDto AdaptTo(this ShiftPlan p37, ShiftPlanLDto p38)
|
||||
{
|
||||
if (p33 == null)
|
||||
if (p37 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanLDto result = p34 ?? new ShiftPlanLDto();
|
||||
ShiftPlanLDto result = p38 ?? new ShiftPlanLDto();
|
||||
|
||||
result.PlanFor = p33.PlanFor;
|
||||
result.RoutineId = p33.RoutineId;
|
||||
result.IsCompleted = p33.IsCompleted;
|
||||
result.CompletePercent = p33.CompletePercent;
|
||||
result.CompleteDescription = p33.CompleteDescription;
|
||||
result.ShiftId = p33.ShiftId;
|
||||
result.Users = funcMain12(p33.Users, result.Users);
|
||||
result.SupervisorId = p33.SupervisorId;
|
||||
result.SupervisorFullName = p33.Supervisor != null ? p33.Supervisor.FirstName + " " + p33.Supervisor.LastName : string.Empty;
|
||||
result.Id = p33.Id;
|
||||
result.PlanFor = p37.PlanFor;
|
||||
result.RoutineId = p37.RoutineId;
|
||||
result.IsCompleted = p37.IsCompleted;
|
||||
result.CompletePercent = p37.CompletePercent;
|
||||
result.CompleteDescription = p37.CompleteDescription;
|
||||
result.ShiftId = p37.ShiftId;
|
||||
result.Users = funcMain14(p37.Users, result.Users);
|
||||
result.SupervisorId = p37.SupervisorId;
|
||||
result.SupervisorFullName = p37.Supervisor != null ? p37.Supervisor.FirstName + " " + p37.Supervisor.LastName : string.Empty;
|
||||
result.Id = p37.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p37 => new ShiftPlanLDto()
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p41 => new ShiftPlanLDto()
|
||||
{
|
||||
PlanFor = p37.PlanFor,
|
||||
RoutineId = p37.RoutineId,
|
||||
IsCompleted = p37.IsCompleted,
|
||||
CompletePercent = p37.CompletePercent,
|
||||
CompleteDescription = p37.CompleteDescription,
|
||||
ShiftId = p37.ShiftId,
|
||||
Users = p37.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p38 => new ShiftPlanUserSDto()
|
||||
PlanFor = p41.PlanFor,
|
||||
RoutineId = p41.RoutineId,
|
||||
IsCompleted = p41.IsCompleted,
|
||||
CompletePercent = p41.CompletePercent,
|
||||
CompleteDescription = p41.CompleteDescription,
|
||||
ShiftId = p41.ShiftId,
|
||||
Users = p41.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p42 => new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = p38.ShiftPlanId,
|
||||
UserId = p38.UserId,
|
||||
UserFullName = p38.User != null ? p38.User.FirstName + " " + p38.User.LastName : string.Empty,
|
||||
PositionId = p38.PositionId,
|
||||
PositionName = p38.Position != null ? p38.Position.Name : string.Empty,
|
||||
Id = p38.Id
|
||||
ShiftPlanId = p42.ShiftPlanId,
|
||||
UserId = p42.UserId,
|
||||
UserFullName = p42.User != null ? p42.User.FirstName + " " + p42.User.LastName : string.Empty,
|
||||
PositionId = p42.PositionId,
|
||||
PositionName = p42.Position != null ? p42.Position.Name : string.Empty,
|
||||
Id = p42.Id
|
||||
}).ToList<ShiftPlanUserSDto>(),
|
||||
SupervisorId = p37.SupervisorId,
|
||||
SupervisorFullName = p37.Supervisor != null ? p37.Supervisor.FirstName + " " + p37.Supervisor.LastName : string.Empty,
|
||||
Id = p37.Id
|
||||
SupervisorId = p41.SupervisorId,
|
||||
SupervisorFullName = p41.Supervisor != null ? p41.Supervisor.FirstName + " " + p41.Supervisor.LastName : string.Empty,
|
||||
Id = p41.Id
|
||||
};
|
||||
|
||||
private static List<ShiftPlanUser> funcMain1(List<ShiftPlanUserSDto> p2)
|
||||
|
@ -285,20 +303,38 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain3(List<ShiftPlanUserSDto> p7, List<ShiftPlanUser> p8)
|
||||
private static Complex funcMain3(Never p7, Complex p8, ShiftPlanSDto p3)
|
||||
{
|
||||
if (p7 == null)
|
||||
Complex result = p8 ?? new Complex();
|
||||
|
||||
result.Id = p3.ComplexId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static ApplicationUser funcMain4(Never p9, ApplicationUser p10, ShiftPlanSDto p3)
|
||||
{
|
||||
ApplicationUser result = p10 ?? new ApplicationUser();
|
||||
|
||||
result.Id = p3.SupervisorId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain5(List<ShiftPlanUserSDto> p11, List<ShiftPlanUser> p12)
|
||||
{
|
||||
if (p11 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p7.Count);
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p11.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p7.Count;
|
||||
int len = p11.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p7[i];
|
||||
ShiftPlanUserSDto item = p11[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -319,20 +355,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain4(List<ShiftPlanUser> p12)
|
||||
private static List<ShiftPlanUserSDto> funcMain6(List<ShiftPlanUser> p16)
|
||||
{
|
||||
if (p12 == null)
|
||||
if (p16 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p12.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p16.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p12.Count;
|
||||
int len = p16.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p12[i];
|
||||
ShiftPlanUser item = p16[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -348,20 +384,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain5(List<ShiftPlanUser> p15, List<ShiftPlanUserSDto> p16)
|
||||
private static List<ShiftPlanUserSDto> funcMain7(List<ShiftPlanUser> p19, List<ShiftPlanUserSDto> p20)
|
||||
{
|
||||
if (p15 == null)
|
||||
if (p19 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p15.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p19.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p15.Count;
|
||||
int len = p19.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p15[i];
|
||||
ShiftPlanUser item = p19[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -377,20 +413,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain6(List<ShiftPlanUserSDto> p20)
|
||||
private static List<ShiftPlanUser> funcMain8(List<ShiftPlanUserSDto> p24)
|
||||
{
|
||||
if (p20 == null)
|
||||
if (p24 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p20.Count);
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p24.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p20.Count;
|
||||
int len = p24.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p20[i];
|
||||
ShiftPlanUserSDto item = p24[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -411,47 +447,47 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static Shift funcMain7(Never p23, Shift p24, ShiftPlanLDto p21)
|
||||
private static Shift funcMain9(Never p27, Shift p28, ShiftPlanLDto p25)
|
||||
{
|
||||
Shift result = p24 ?? new Shift();
|
||||
Shift result = p28 ?? new Shift();
|
||||
|
||||
result.Id = p21.ShiftId;
|
||||
result.Id = p25.ShiftId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static Routine funcMain8(Never p25, Routine p26, ShiftPlanLDto p21)
|
||||
private static Routine funcMain10(Never p29, Routine p30, ShiftPlanLDto p25)
|
||||
{
|
||||
Routine result = p26 ?? new Routine();
|
||||
Routine result = p30 ?? new Routine();
|
||||
|
||||
result.Id = p21.RoutineId;
|
||||
result.Id = p25.RoutineId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static ApplicationUser funcMain9(Never p27, ApplicationUser p28, ShiftPlanLDto p21)
|
||||
private static ApplicationUser funcMain11(Never p31, ApplicationUser p32, ShiftPlanLDto p25)
|
||||
{
|
||||
ApplicationUser result = p28 ?? new ApplicationUser();
|
||||
ApplicationUser result = p32 ?? new ApplicationUser();
|
||||
|
||||
result.Id = p21.SupervisorId;
|
||||
result.Id = p25.SupervisorId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain10(List<ShiftPlanUserSDto> p29, List<ShiftPlanUser> p30)
|
||||
private static List<ShiftPlanUser> funcMain12(List<ShiftPlanUserSDto> p33, List<ShiftPlanUser> p34)
|
||||
{
|
||||
if (p29 == null)
|
||||
if (p33 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p29.Count);
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p33.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p29.Count;
|
||||
int len = p33.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p29[i];
|
||||
ShiftPlanUserSDto item = p33[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -472,20 +508,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain11(List<ShiftPlanUser> p32)
|
||||
private static List<ShiftPlanUserSDto> funcMain13(List<ShiftPlanUser> p36)
|
||||
{
|
||||
if (p32 == null)
|
||||
if (p36 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p32.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p36.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p32.Count;
|
||||
int len = p36.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p32[i];
|
||||
ShiftPlanUser item = p36[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -501,20 +537,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain12(List<ShiftPlanUser> p35, List<ShiftPlanUserSDto> p36)
|
||||
private static List<ShiftPlanUserSDto> funcMain14(List<ShiftPlanUser> p39, List<ShiftPlanUserSDto> p40)
|
||||
{
|
||||
if (p35 == null)
|
||||
if (p39 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p35.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p39.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p35.Count;
|
||||
int len = p39.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p35[i];
|
||||
ShiftPlanUser item = p39[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
namespace Brizco.Domain.MartenEntities.NewFeeds;
|
||||
|
||||
public class NewsFeed : MartenEntity
|
||||
{
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public bool IsPin { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
|
@ -36,7 +36,7 @@ public class MartenRepository<TMartenEntity> : IMartenRepository<TMartenEntity>
|
|||
await using var session = _documentStore.QuerySession();
|
||||
var setting = await session.LoadAsync<TMartenEntity>(id, cancellation);
|
||||
if (setting == null)
|
||||
throw new AppException($"{nameof(setting)} not found", ApiResultStatusCode.NotFound);
|
||||
throw new AppException($"{nameof(TMartenEntity)} not found", ApiResultStatusCode.NotFound);
|
||||
return setting;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="MartenHandlers\Notifications\" />
|
||||
<Folder Include="Handlers\Users\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Extensions\" />
|
||||
<Folder Include="Services\Contracts\" />
|
||||
|
@ -50,6 +50,7 @@
|
|||
<Using Include="Brizco.Domain.Entities.ShiftPlans" />
|
||||
<Using Include="Brizco.Domain.Entities.Shifts" />
|
||||
<Using Include="Brizco.Domain.Entities.Users" />
|
||||
<Using Include="Brizco.Domain.MartenEntities.NewFeeds" />
|
||||
<Using Include="Brizco.Domain.MartenEntities.Notifications" />
|
||||
<Using Include="Brizco.Repository.Abstracts" />
|
||||
<Using Include="Brizco.Repository.Extensions" />
|
||||
|
|
|
@ -1,51 +1,52 @@
|
|||
namespace Brizco.Repository.Handlers.Activities;
|
||||
|
||||
public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, List<ActivitySDto>>
|
||||
public class GetActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService)
|
||||
: IRequestHandler<GetActivitiesQuery, List<ActivitySDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<List<ActivitySDto>> Handle(GetActivitiesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
if (_currentUserService.UserId == null)
|
||||
if (currentUserService.UserId == null)
|
||||
throw new AppException("UserId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("UserId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
|
||||
IQueryable<Domain.Entities.Tasks.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>().TableNoTracking
|
||||
IQueryable<Domain.Entities.Tasks.Activity> activities = repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>().TableNoTracking
|
||||
.Where(a=>a.IsActivity && a.ComplexId == complexId);
|
||||
if (_currentUserService is { Permissions: not null, RoleName: not null })
|
||||
if (currentUserService is { Permissions: not null, RoleName: not null })
|
||||
{
|
||||
if (_currentUserService.Permissions.Contains(ApplicationPermission.ViewMineActivities) && _currentUserService.RoleName == ApplicationRoles.Staff)
|
||||
if (currentUserService.Permissions.Contains(ApplicationPermission.ViewMineActivities) && currentUserService.RoleName == ApplicationRoles.Staff)
|
||||
activities = activities.Where(a => a.UserId == userId);
|
||||
else
|
||||
activities = activities.Where(c => c.UserId == request.UserId);
|
||||
}
|
||||
|
||||
if (request.DateQueryFilter != null)
|
||||
{
|
||||
var date = DateTime.Now;
|
||||
switch (request.DateQueryFilter)
|
||||
{
|
||||
case DateQueryFilter.Yesterday:
|
||||
case DateTimeQueryFilter.Yesterday:
|
||||
activities = activities.Where(a => a.SetFor.Date == DateTime.Today.Date.AddDays(-1).Date);
|
||||
break;
|
||||
case DateQueryFilter.Today:
|
||||
case DateTimeQueryFilter.Today:
|
||||
activities = activities.Where(a => a.SetFor.Date == DateTime.Today.Date);
|
||||
break;
|
||||
case DateQueryFilter.Tomorrow:
|
||||
case DateTimeQueryFilter.Tomorrow:
|
||||
activities = activities.Where(a => a.SetFor.Date == DateTime.Today.AddDays(1).Date);
|
||||
break;
|
||||
case DateQueryFilter.ThisWeek:
|
||||
activities = activities.Where(a => a.SetFor.Date >= DateTime.Today.AddDays(-1).Date && a.SetFor.Date <= DateTime.Today.AddDays(+6).Date);
|
||||
case DateTimeQueryFilter.ThisWeek:
|
||||
DateTime today = DateTime.Today;
|
||||
int delta = DayOfWeek.Saturday - today.DayOfWeek;
|
||||
if (delta > 0) delta -= 7;
|
||||
DateTime startOfWeek = today.AddDays(delta);
|
||||
DateTime endOfWeek = startOfWeek.AddDays(6);
|
||||
activities = activities.Where(a => a.SetFor.Date >= startOfWeek.Date && a.SetFor.Date <= endOfWeek.Date);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
namespace Brizco.Repository.Handlers.Activities;
|
||||
|
||||
public class GetShiftPlanActivitiesQueryHandler : IRequestHandler<GetShiftPlanActivitiesQuery, List<ActivitySDto>>
|
||||
public class GetShiftPlanActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper) : IRequestHandler<GetShiftPlanActivitiesQuery, List<ActivitySDto>>
|
||||
{
|
||||
private IRepositoryWrapper _repositoryWrapper;
|
||||
public GetShiftPlanActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
}
|
||||
|
||||
public async Task<List<ActivitySDto>> Handle(GetShiftPlanActivitiesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var activities = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var activities = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.Where(a => a.ShiftPlanId == request.ShiftPlanId)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
|
|
|
@ -2,24 +2,16 @@
|
|||
|
||||
namespace Brizco.Repository.Handlers.ShiftPlans;
|
||||
|
||||
public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftPlansQuery, List<ShiftPlanSDto>>
|
||||
public class GetShiftPlansQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService) : IRequestHandler<GetShiftPlansQuery, List<ShiftPlanSDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetShiftPlansQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<List<ShiftPlanSDto>> Handle(GetShiftPlansQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
IQueryable<ShiftPlan> baseQuery = _repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
IQueryable<ShiftPlan> baseQuery = repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Where(s => s.ComplexId == complexId);
|
||||
|
@ -77,7 +69,7 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftPlansQuery, Lis
|
|||
break;
|
||||
case DateTimeQueryFilter.NextWeek:
|
||||
DateTime startOfNextWeek = DateTime.Today.AddDays(7 - (int)DateTime.Today.DayOfWeek + 1);
|
||||
DateTime endOfNextWeek = startOfNextWeek.AddDays(5);
|
||||
DateTime endOfNextWeek = startOfNextWeek.AddDays(6);
|
||||
shiftPlans = await baseQuery.Where(s => s.PlanFor.Date >= startOfNextWeek.Date && s.PlanFor.Date <= endOfNextWeek.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Skip(request.Page * 15).Take(15)
|
||||
|
@ -138,13 +130,13 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftPlansQuery, Lis
|
|||
|
||||
foreach (var shiftPlan in shiftPlans)
|
||||
{
|
||||
var activitiesCount = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var activitiesCount = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.CountAsync(a => a.SetFor.Date == shiftPlan.PlanFor.Date && a.ShiftPlanId == shiftPlan.Id, cancellationToken);
|
||||
var doneActivitiesCount = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var doneActivitiesCount = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.CountAsync(a => a.Status == ActivityStatus.Done && a.SetFor.Date == shiftPlan.PlanFor.Date && a.ShiftPlanId == shiftPlan.Id, cancellationToken);
|
||||
var undoneActivitiesCount = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var undoneActivitiesCount = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.CountAsync(a => a.Status == ActivityStatus.UnDone && a.SetFor.Date == shiftPlan.PlanFor.Date && a.ShiftPlanId == shiftPlan.Id, cancellationToken);
|
||||
shiftPlan.UndoneActivitiesCount = undoneActivitiesCount;
|
||||
|
@ -155,7 +147,7 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftPlansQuery, Lis
|
|||
|
||||
foreach (var shiftPlan in shiftPlans)
|
||||
{
|
||||
shiftPlan.StaffCount = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
shiftPlan.StaffCount = await repositoryWrapper.SetRepository<ShiftPlanUser>()
|
||||
.TableNoTracking
|
||||
.CountAsync(spu => spu.ShiftPlanId == shiftPlan.Id, cancellationToken);
|
||||
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
namespace Brizco.Repository.Handlers.Shifts;
|
||||
|
||||
public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<ShiftSDto>>
|
||||
public class GetShiftPlansQueryHandler(IRepositoryWrapper repositoryWrapper, UserManager<ApplicationUser> userManager, ICurrentUserService currentUserService)
|
||||
: IRequestHandler<GetShiftsQuery, List<ShiftSDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetShiftPlansQueryHandler(IRepositoryWrapper repositoryWrapper,UserManager<ApplicationUser> userManager, ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_userManager = userManager;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<List<ShiftSDto>> Handle(GetShiftsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
List<ShiftSDto> shifts;
|
||||
|
||||
|
@ -24,46 +15,46 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
|
|||
{
|
||||
var selectedDate = DateTimeExtensions.UnixTimeStampToDateTime(request.SelectedDate);
|
||||
|
||||
var originalShifts = from shiftDay in _repositoryWrapper.SetRepository<ShiftDay>().Entities
|
||||
join shift in _repositoryWrapper.SetRepository<Shift>().Entities on shiftDay.ShiftId equals shift.Id
|
||||
var originalShifts = from shiftDay in repositoryWrapper.SetRepository<ShiftDay>().Entities
|
||||
join shift in repositoryWrapper.SetRepository<Shift>().Entities on shiftDay.ShiftId equals shift.Id
|
||||
where shiftDay.DayOfWeek == selectedDate.DayOfWeek && shift.ComplexId == complexId
|
||||
orderby shift.StartAt descending
|
||||
orderby shift.StartAt
|
||||
select shift;
|
||||
|
||||
shifts = await originalShifts.AsNoTracking().Select(ShiftMapper.ProjectToSDto).ToListAsync(cancellationToken);
|
||||
foreach (var shift in shifts)
|
||||
{
|
||||
var existedShiftPlan = await _repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
var existedShiftPlan = await repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.ShiftId == shift.Id && s.PlanFor.Date == selectedDate.Date, cancellationToken);
|
||||
if(existedShiftPlan == null)
|
||||
continue;
|
||||
var supervisor = await _userManager.FindByIdAsync(existedShiftPlan.SupervisorId.ToString());
|
||||
var supervisor = await userManager.FindByIdAsync(existedShiftPlan.SupervisorId.ToString());
|
||||
if (supervisor != null)
|
||||
shift.CurrentSupervisorFullName = supervisor.FirstName + " " + supervisor.LastName;
|
||||
|
||||
var activitiesCount = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var activitiesCount = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.CountAsync(a => a.SetFor.Date == selectedDate.Date && a.ShiftPlanId == existedShiftPlan.Id, cancellationToken);
|
||||
var doneActivitiesCount = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var doneActivitiesCount = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.CountAsync(a => a.Status == ActivityStatus.Done && a.SetFor.Date == selectedDate.Date && a.ShiftPlanId == existedShiftPlan.Id, cancellationToken);
|
||||
var undoneActivitiesCount = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
var undoneActivitiesCount = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
||||
.TableNoTracking
|
||||
.CountAsync(a => a.Status == ActivityStatus.UnDone && a.SetFor.Date == selectedDate.Date && a.ShiftPlanId == existedShiftPlan.Id, cancellationToken);
|
||||
shift.UndoneActivitiesCount = undoneActivitiesCount;
|
||||
shift.DoneActivitiesCount = doneActivitiesCount;
|
||||
shift.TotalActivitiesCount = activitiesCount;
|
||||
|
||||
switch (_currentUserService.RoleName)
|
||||
switch (currentUserService.RoleName)
|
||||
{
|
||||
case null:
|
||||
continue;
|
||||
case ApplicationRoles.SuperVisor:
|
||||
{
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id is wrong");
|
||||
var existedSupervisorShiftPlan = await _repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
var existedSupervisorShiftPlan = await repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.ShiftId == shift.Id && s.PlanFor.Date == selectedDate.Date && s.SupervisorId == userId, cancellationToken);
|
||||
shift.IsCompleted = existedSupervisorShiftPlan?.IsCompleted ?? false;
|
||||
|
@ -84,9 +75,9 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
|
|||
else
|
||||
{
|
||||
|
||||
shifts = await _repositoryWrapper.SetRepository<Shift>().TableNoTracking
|
||||
shifts = await repositoryWrapper.SetRepository<Shift>().TableNoTracking
|
||||
.Where(s => s.ComplexId == complexId)
|
||||
.OrderByDescending(s => s.StartAt)
|
||||
.OrderBy(s => s.StartAt)
|
||||
.Skip(request.Page * 15).Take(15)
|
||||
.Select(ShiftMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
namespace Brizco.Repository.Handlers.Tasks;
|
||||
using Brizco.Domain.Entities.Tasks;
|
||||
|
||||
public class GetActivitiesQueryHandler : IRequestHandler<GetTasksQuery, List<TaskSDto>>
|
||||
namespace Brizco.Repository.Handlers.Tasks;
|
||||
|
||||
public class GetActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService) : IRequestHandler<GetTasksQuery, List<TaskSDto>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetActivitiesQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<List<TaskSDto>> Handle(GetTasksQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
var query = repositoryWrapper.SetRepository<Domain.Entities.Tasks.Task>().TableNoTracking
|
||||
.Where(t => t.ComplexId == complexId && t.IsActivity == false);
|
||||
|
||||
var tasks = await _repositoryWrapper.SetRepository<Domain.Entities.Tasks.Task>().TableNoTracking
|
||||
.Where(t=>t.ComplexId==complexId && t.IsActivity == false)
|
||||
if (request.ShiftId != null)
|
||||
query = from taskShift in repositoryWrapper.SetRepository<TaskShift>().TableNoTracking
|
||||
where taskShift.ShiftId == request.ShiftId
|
||||
join task in query on taskShift.TaskId equals task.Id
|
||||
select task;
|
||||
|
||||
query = query.Distinct();
|
||||
|
||||
var tasks = await query
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Skip(request.Page * 15).Take(15)
|
||||
.Select(TaskMapper.ProjectToSDto)
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
using MD.PersianDateTime.Standard;
|
||||
using Activity = Brizco.Domain.Entities.Tasks.Activity;
|
||||
|
||||
namespace Brizco.Repository.Handlers.Users;
|
||||
|
||||
public class GetStaffQueryHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService) : IRequestHandler<GetStaffQuery,List<StaffResponseSDto>>
|
||||
{
|
||||
public async Task<List<StaffResponseSDto>> Handle(GetStaffQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var count = request.Count ?? 10;
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
|
||||
var baseQuery = repositoryWrapper.SetRepository<Activity>()
|
||||
.TableNoTracking
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Where(s => s.ComplexId == complexId);
|
||||
|
||||
List<ActivitySDto> activities = new List<ActivitySDto>();
|
||||
|
||||
switch (request.DateTimeQuery)
|
||||
{
|
||||
case DateTimeQueryFilter.Today:
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date == DateTime.Now.Date)
|
||||
.Skip(request.Page * count).Take(count)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
case DateTimeQueryFilter.Yesterday:
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date == DateTime.Now.AddDays(-1).Date)
|
||||
.Skip(request.Page * count).Take(count)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
case DateTimeQueryFilter.PastWeek:
|
||||
DateTime pastWeekToday = DateTime.Today;
|
||||
int pastWeekDelta = DayOfWeek.Saturday - pastWeekToday.DayOfWeek;
|
||||
if (pastWeekDelta > 0) pastWeekDelta -= 7;
|
||||
DateTime startOfPastWeek = DateTime.Today.AddDays(pastWeekDelta).AddDays(-7);
|
||||
DateTime endOfPastWeek = startOfPastWeek.AddDays(6);
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date >= startOfPastWeek.Date && s.SetFor.Date <= endOfPastWeek.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
case DateTimeQueryFilter.NextWeek:
|
||||
DateTime startOfNextWeek = DateTime.Today.AddDays(7 - (int)DateTime.Today.DayOfWeek + 1);
|
||||
DateTime endOfNextWeek = startOfNextWeek.AddDays(6);
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date >= startOfNextWeek.Date && s.SetFor.Date <= endOfNextWeek.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
case DateTimeQueryFilter.ThisWeek:
|
||||
DateTime today = DateTime.Today;
|
||||
int delta = DayOfWeek.Saturday - today.DayOfWeek;
|
||||
if (delta > 0) delta -= 7;
|
||||
DateTime startOfWeek = today.AddDays(delta);
|
||||
DateTime endOfWeek = startOfWeek.AddDays(6);
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date >= startOfWeek.Date && s.SetFor.Date <= endOfWeek.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
case DateTimeQueryFilter.PastMonth:
|
||||
|
||||
DateTime startOfPastMonth = new PersianDateTime(PersianDateTime.Today.AddMonths(-1).Year, PersianDateTime.Today.AddMonths(-1).Month, 1).ToDateTime();
|
||||
DateTime endOfPastMonth = startOfPastMonth.AddMonths(1);
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date >= startOfPastMonth.Date && s.SetFor.Date < endOfPastMonth.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
case DateTimeQueryFilter.NextMonth:
|
||||
DateTime startOfNextMonth = new PersianDateTime(PersianDateTime.Today.AddMonths(1).Year, PersianDateTime.Today.AddMonths(1).Month, 1).ToDateTime();
|
||||
DateTime endOfNextMonth = startOfNextMonth.AddMonths(1);
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date >= startOfNextMonth.Date && s.SetFor.Date < endOfNextMonth.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
|
||||
case DateTimeQueryFilter.ThisMonth:
|
||||
DateTime startOfThisMonth = new PersianDateTime(PersianDateTime.Today.Year, PersianDateTime.Today.Month, 1).ToDateTime();
|
||||
DateTime endOfThisMonth = startOfThisMonth.AddMonths(1);
|
||||
activities = await baseQuery.Where(s => s.SetFor.Date >= startOfThisMonth.Date && s.SetFor.Date < endOfThisMonth.Date)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(ActivityMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
||||
}
|
||||
|
||||
var staffs = activities.Select(a => new StaffResponseSDto
|
||||
{
|
||||
FirstName = a.UserFirstName,
|
||||
LastName = a.UserLastName,
|
||||
Id = a.UserId
|
||||
}).ToList();
|
||||
return staffs.DistinctBy(d => d.Id).ToList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
namespace Brizco.Repository.MartenHandlers.NewsFeeds;
|
||||
|
||||
public class ChangeNewsFeedPinCommandHandler(IMartenRepositoryWrapper martenRepositoryWrapper, ICurrentUserService currentUserService)
|
||||
: IRequestHandler<ChangeNewsFeedPinCommand, bool>
|
||||
{
|
||||
public async Task<bool> Handle(ChangeNewsFeedPinCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
var ent = await martenRepositoryWrapper.SetRepository<NewsFeed>().GetEntityAsync(request.Id, cancellationToken);
|
||||
if (ent.ComplexId != complexId)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
ent.IsPin = request.IsPin;
|
||||
await martenRepositoryWrapper.SetRepository<NewsFeed>().AddOrUpdateEntityAsync(ent, cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
namespace Brizco.Repository.MartenHandlers.NewsFeeds;
|
||||
|
||||
public class CreateNewsFeedCommandHandler (IMartenRepositoryWrapper martenRepositoryWrapper , ICurrentUserService currentUserService)
|
||||
: IRequestHandler<CreateNewsFeedCommand,Guid>
|
||||
{
|
||||
public async Task<Guid> Handle(CreateNewsFeedCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
var newsFeed = new NewsFeed
|
||||
{
|
||||
ComplexId = complexId,
|
||||
Content = request.Content,
|
||||
Title = request.Title,
|
||||
IsPin = request.IsPin
|
||||
};
|
||||
await martenRepositoryWrapper.SetRepository<NewsFeed>().AddOrUpdateEntityAsync(newsFeed, cancellationToken);
|
||||
return newsFeed.Id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
namespace Brizco.Repository.MartenHandlers.NewsFeeds;
|
||||
|
||||
public class DeleteNewsFeedCommandHandler(IMartenRepositoryWrapper martenRepositoryWrapper, ICurrentUserService currentUserService)
|
||||
: IRequestHandler<DeleteNewsFeedCommand, bool>
|
||||
{
|
||||
public async Task<bool> Handle(DeleteNewsFeedCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
var ent = await martenRepositoryWrapper.SetRepository<NewsFeed>().GetEntityAsync(request.Id, cancellationToken);
|
||||
if (ent.ComplexId != complexId)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
await martenRepositoryWrapper.SetRepository<NewsFeed>().RemoveEntityAsync(ent, cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
namespace Brizco.Repository.MartenHandlers.NewsFeeds;
|
||||
|
||||
public class GetNewsFeedsQueryHandler (IMartenRepositoryWrapper martenRepositoryWrapper,ICurrentUserService currentUserService) : IRequestHandler<GetNewsFeedsQuery,List<NewsFeed>>
|
||||
{
|
||||
public async Task<List<NewsFeed>> Handle(GetNewsFeedsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
var count = request.Count ?? 5;
|
||||
var query = await martenRepositoryWrapper.SetRepository<NewsFeed>()
|
||||
.GetQueryAsync(q=>q.ComplexId == complexId);
|
||||
|
||||
query = query.Skip(request.Page * count)
|
||||
.Take(count)
|
||||
.OrderByDescending(c=>c.CreatedAt);
|
||||
|
||||
return await query.ToListAsync(cancellationToken);
|
||||
}
|
||||
}
|
|
@ -1,22 +1,13 @@
|
|||
using Brizco.Domain.MartenEntities.Notifications;
|
||||
namespace Brizco.Repository.MartenHandlers.Notifications;
|
||||
|
||||
namespace Brizco.Repository.MartenHandlers.Notifications;
|
||||
|
||||
public class CreateNotificationHandlerCommand : IRequestHandler<CreateNotificationCommand,Guid>
|
||||
public class CreateNotificationHandlerCommand(IMartenRepositoryWrapper martenRepositoryWrapper, ICurrentUserService currentUserService)
|
||||
: IRequestHandler<CreateNotificationCommand,Guid>
|
||||
{
|
||||
private readonly IMartenRepositoryWrapper _martenRepositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public CreateNotificationHandlerCommand(IMartenRepositoryWrapper martenRepositoryWrapper, ICurrentUserService currentUserService)
|
||||
{
|
||||
_martenRepositoryWrapper = martenRepositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
public async Task<Guid> Handle(CreateNotificationCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentUserService.ComplexId == null)
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
var notification = new Notification
|
||||
{
|
||||
|
@ -26,7 +17,7 @@ public class CreateNotificationHandlerCommand : IRequestHandler<CreateNotificati
|
|||
CreatedAt = DateTime.Now
|
||||
};
|
||||
|
||||
await _martenRepositoryWrapper.SetRepository<Notification>()
|
||||
await martenRepositoryWrapper.SetRepository<Notification>()
|
||||
.AddOrUpdateEntityAsync(notification, cancellationToken);
|
||||
return notification.Id;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
namespace Brizco.Repository.MartenHandlers.Notifications;
|
||||
|
||||
public class GetNotificationsCountQueryHandler(IMartenRepositoryWrapper martenRepositoryWrapper,ICurrentUserService currentUserService) : IRequestHandler<GetNotificationsCountQuery,int>
|
||||
{
|
||||
public async Task<int> Handle(GetNotificationsCountQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
Guid userId;
|
||||
if (currentUserService.UserId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is null");
|
||||
if (!Guid.TryParse(currentUserService.UserId, out userId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is wrong");
|
||||
|
||||
|
||||
var notifications = await martenRepositoryWrapper.SetRepository<Notification>()
|
||||
.GetEntitiesAsync(n => n.ComplexId == complexId && n.UserId == userId && !n.IsRead, cancellationToken);
|
||||
|
||||
return notifications.Count;
|
||||
}
|
||||
}
|
|
@ -1,44 +1,37 @@
|
|||
using Brizco.Domain.MartenEntities.Notifications;
|
||||
namespace Brizco.Repository.MartenHandlers.Notifications;
|
||||
|
||||
namespace Brizco.Repository.MartenHandlers.Notifications;
|
||||
|
||||
public class GetNotificationsQueryHandler : IRequestHandler<GetNotificationsQuery,List<Notification>>
|
||||
public class GetNotificationsQueryHandler(IMartenRepositoryWrapper martenRepositoryWrapper, ICurrentUserService currentUserService) : IRequestHandler<GetNotificationsQuery,List<Notification>>
|
||||
{
|
||||
private readonly IMartenRepositoryWrapper _martenRepositoryWrapper;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public GetNotificationsQueryHandler(IMartenRepositoryWrapper martenRepositoryWrapper,ICurrentUserService currentUserService)
|
||||
{
|
||||
_martenRepositoryWrapper = martenRepositoryWrapper;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public async Task<List<Notification>> Handle(GetNotificationsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if (_currentUserService.ComplexId == null)
|
||||
if (currentUserService.ComplexId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is null");
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
if (!Guid.TryParse(currentUserService.ComplexId, out Guid complexId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Complex id is wrong");
|
||||
|
||||
if (request.UserId == default)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is null");
|
||||
Guid userId;
|
||||
if (request.UserId == null)
|
||||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
if (currentUserService.UserId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is null");
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out userId))
|
||||
if (!Guid.TryParse(currentUserService.UserId, out userId))
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is wrong");
|
||||
}
|
||||
else
|
||||
userId = request.UserId.Value;
|
||||
|
||||
var notifications = await _martenRepositoryWrapper.SetRepository<Notification>()
|
||||
.GetQueryAsync(n => n.ComplexId == complexId && n.UserId == userId);
|
||||
var response = await notifications.Take(new Range(request.Page * request.Count, (request.Page * request.Count) + request.Count))
|
||||
.ToListAsync(cancellationToken);
|
||||
if (userId == default)
|
||||
throw new BaseApiException(ApiResultStatusCode.BadRequest, "User id is null");
|
||||
|
||||
var count = request.Count ?? 10;
|
||||
|
||||
var notifications = await martenRepositoryWrapper.SetRepository<Notification>()
|
||||
.GetEntitiesAsync(n => n.ComplexId == complexId && n.UserId == userId,cancellationToken);
|
||||
var response = notifications.OrderByDescending(n=>n.CreatedAt)
|
||||
.Take(new Range(request.Page * count, (request.Page * count) + count))
|
||||
.ToList();
|
||||
return response;
|
||||
}
|
||||
}
|
1526
Brizco.Repository/Migrations/20240726144318_EditShiftPlanAddIsScheduled.Designer.cs
generated
100644
1526
Brizco.Repository/Migrations/20240726144318_EditShiftPlanAddIsScheduled.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,31 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Brizco.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EditShiftPlanAddIsScheduled : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsScheduled",
|
||||
schema: "public",
|
||||
table: "ShiftPlans",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsScheduled",
|
||||
schema: "public",
|
||||
table: "ShiftPlans");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,12 +18,12 @@ namespace Brizco.Repository.Migrations
|
|||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("public")
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Complex", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -70,7 +70,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Complexes", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.ComplexUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -115,7 +115,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("ComplexUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.ComplexUserRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -160,7 +160,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("ComplexUserRoles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Position", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -213,7 +213,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Positions", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.PositionPermission", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.PositionPermission", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -257,7 +257,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("PositionPermissions", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Section", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -305,7 +305,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Sections", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Routines.Routine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -353,7 +353,128 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Routines", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlans.ShiftPlan", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CompleteDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("CompletePercent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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>("IsCompleted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsScheduled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("PlanFor")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoutineId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SupervisorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.HasIndex("RoutineId");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.HasIndex("SupervisorId");
|
||||
|
||||
b.ToTable("ShiftPlans", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlans.ShiftPlanUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("PositionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftPlanId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PositionId");
|
||||
|
||||
b.HasIndex("ShiftPlanId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ShiftPlanUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.Shift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -407,7 +528,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Shifts", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.ShiftDay", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -450,125 +571,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("ShiftDays", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CompleteDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("CompletePercent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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>("IsCompleted")
|
||||
.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>("PlanFor")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoutineId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ShiftId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SupervisorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplexId");
|
||||
|
||||
b.HasIndex("RoutineId");
|
||||
|
||||
b.HasIndex("ShiftId");
|
||||
|
||||
b.HasIndex("SupervisorId");
|
||||
|
||||
b.ToTable("ShiftPlans", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("ModifiedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("PositionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShiftPlanId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PositionId");
|
||||
|
||||
b.HasIndex("ShiftPlanId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ShiftPlanUsers", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.ShiftRoutine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -613,7 +616,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("ShiftRoutines", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.Task", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -694,7 +697,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskDay", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -737,7 +740,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("TaskDays", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskPosition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -782,7 +785,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("TaskPositions", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskRoutine", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -827,7 +830,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("TaskRoutines", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskShift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -872,7 +875,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("TaskShifts", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Users.ApplicationRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -916,7 +919,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Roles", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Users.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
@ -1108,9 +1111,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.ToTable("Tokens", "public");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.Activity", b =>
|
||||
{
|
||||
b.HasBaseType("Brizco.Domain.Entities.Task.Task");
|
||||
b.HasBaseType("Brizco.Domain.Entities.Tasks.Task");
|
||||
|
||||
b.Property<DateTime>("DoneAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
@ -1142,14 +1145,14 @@ namespace Brizco.Repository.Migrations
|
|||
b.HasDiscriminator().HasValue("Activity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.ComplexUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1159,14 +1162,14 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.ComplexUserRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.ComplexUser", "ComplexUser")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("ComplexUserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role")
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationRole", "Role")
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1176,14 +1179,14 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Position", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Section", "Section")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Section", "Section")
|
||||
.WithMany("Positions")
|
||||
.HasForeignKey("SectionId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1193,9 +1196,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Section");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.PositionPermission", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.PositionPermission", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Position", "Position")
|
||||
.WithMany("Permissions")
|
||||
.HasForeignKey("PositionId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1203,9 +1206,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Position");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Section", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1213,9 +1216,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Routines.Routine", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1223,44 +1226,24 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlans.ShiftPlan", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
.WithMany("Shifts")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||
.WithMany("Days")
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine")
|
||||
b.HasOne("Brizco.Domain.Entities.Routines.Routine", "Routine")
|
||||
.WithMany()
|
||||
.HasForeignKey("RoutineId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||
b.HasOne("Brizco.Domain.Entities.Shifts.Shift", "Shift")
|
||||
.WithMany("Plans")
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "Supervisor")
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", "Supervisor")
|
||||
.WithMany()
|
||||
.HasForeignKey("SupervisorId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1274,19 +1257,19 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Supervisor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlans.ShiftPlanUser", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Position", "Position")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
|
||||
b.HasOne("Brizco.Domain.Entities.ShiftPlans.ShiftPlan", "ShiftPlan")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("ShiftPlanId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1298,14 +1281,34 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftRoutine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.Shift", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany("Shifts")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.ShiftDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shifts.Shift", "Shift")
|
||||
.WithMany("Days")
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.ShiftRoutine", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Routines.Routine", "Routine")
|
||||
.WithMany("Shifts")
|
||||
.HasForeignKey("RoutineId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||
b.HasOne("Brizco.Domain.Entities.Shifts.Shift", "Shift")
|
||||
.WithMany("Routines")
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1315,9 +1318,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Shift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.Task", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany("Tasks")
|
||||
.HasForeignKey("ComplexId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1325,9 +1328,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Complex");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskDay", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
|
||||
b.HasOne("Brizco.Domain.Entities.Tasks.Task", "Task")
|
||||
.WithMany("Days")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1335,14 +1338,14 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskPosition", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskPosition", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Position", "Position")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Position", "Position")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
|
||||
b.HasOne("Brizco.Domain.Entities.Tasks.Task", "Task")
|
||||
.WithMany("Positions")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1352,14 +1355,14 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRoutine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskRoutine", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Routine.Routine", "Routine")
|
||||
b.HasOne("Brizco.Domain.Entities.Routines.Routine", "Routine")
|
||||
.WithMany("Tasks")
|
||||
.HasForeignKey("RoutineId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
|
||||
b.HasOne("Brizco.Domain.Entities.Tasks.Task", "Task")
|
||||
.WithMany("Routines")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1369,14 +1372,14 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.TaskShift", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift")
|
||||
b.HasOne("Brizco.Domain.Entities.Shifts.Shift", "Shift")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.Task.Task", "Task")
|
||||
b.HasOne("Brizco.Domain.Entities.Tasks.Task", "Task")
|
||||
.WithMany("Shifts")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1386,9 +1389,9 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Task");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Users.ApplicationRole", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex")
|
||||
b.HasOne("Brizco.Domain.Entities.Complexes.Complex", "Complex")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("ComplexId");
|
||||
|
||||
|
@ -1397,7 +1400,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1405,7 +1408,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1413,7 +1416,7 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1421,12 +1424,12 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null)
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1434,20 +1437,20 @@ namespace Brizco.Repository.Migrations
|
|||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null)
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.Activity", b =>
|
||||
{
|
||||
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
|
||||
b.HasOne("Brizco.Domain.Entities.ShiftPlans.ShiftPlan", "ShiftPlan")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShiftPlanId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
|
||||
b.HasOne("Brizco.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
@ -1457,7 +1460,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Complex", b =>
|
||||
{
|
||||
b.Navigation("Roles");
|
||||
|
||||
|
@ -1468,29 +1471,34 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.ComplexUser", b =>
|
||||
{
|
||||
b.Navigation("Roles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Position", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Position", b =>
|
||||
{
|
||||
b.Navigation("Permissions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Complexes.Section", b =>
|
||||
{
|
||||
b.Navigation("Positions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Routine.Routine", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Routines.Routine", b =>
|
||||
{
|
||||
b.Navigation("Shifts");
|
||||
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.ShiftPlans.ShiftPlan", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shifts.Shift", b =>
|
||||
{
|
||||
b.Navigation("Days");
|
||||
|
||||
|
@ -1499,12 +1507,7 @@ namespace Brizco.Repository.Migrations
|
|||
b.Navigation("Routines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b =>
|
||||
modelBuilder.Entity("Brizco.Domain.Entities.Tasks.Task", b =>
|
||||
{
|
||||
b.Navigation("Days");
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- <configuration>
|
||||
<config>
|
||||
<add key='maxHttpRequestsPerSource' value='10' />
|
||||
</config>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="VnfRepos" value="https://packages.vnfco.ir/repository/nuget-group/index.json" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
|
||||
<packageSourceCredentials>
|
||||
<VnfRepos>
|
||||
<add key="Username" value="runner" />
|
||||
<add key="ClearTextPassword" value="22102210aA" />
|
||||
</VnfRepos>
|
||||
</packageSourceCredentials>
|
||||
</configuration> -->
|
||||
|
||||
|
||||
<configuration>
|
||||
<config>
|
||||
<add key='maxHttpRequestsPerSource' value='10' />
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
</configuration>
|
Loading…
Reference in New Issue