refactor files

master
Amir Hossein Khademi 2024-08-11 19:20:09 +03:30
parent 1f99790b97
commit 39f6320063
59 changed files with 71 additions and 183 deletions

View File

@ -1 +1 @@
1.4.9.4
1.4.11.5

View File

@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<AssemblyVersion>1.4.9.4</AssemblyVersion>
<FileVersion>1.4.9.4</FileVersion>
<AssemblyVersion>1.4.11.5</AssemblyVersion>
<FileVersion>1.4.11.5</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -1,5 +1,4 @@
using Brizco.Common.Models.Api;
using MD.PersianDateTime.Standard;
using MD.PersianDateTime.Standard;
using System.Diagnostics;
namespace Brizco.Api.Controllers;

View File

@ -1,6 +1,4 @@
using Brizco.Core.EntityServices;
namespace Brizco.Api.Controllers;
namespace Brizco.Api.Controllers;
public class RoleController : ICarterModule
{

View File

@ -1,7 +1,4 @@
using Brizco.Common.Models.Api;
using Brizco.Core.Models.Api;
namespace Brizco.Api.WebFramework.Bases;
namespace Brizco.Api.WebFramework.Bases;
public class ApiResultFactory
{

View File

@ -1,8 +1,4 @@
using Carter;
using MediatR;
using Microsoft.AspNetCore.Routing.Patterns;
namespace Brizco.Api.WebFramework.Bases;
namespace Brizco.Api.WebFramework.Bases;
public class CrudEndpoint<TEntity, TGetAllQuery, TGetOneQuery, TCreateCommand, TUpdateCommand, TDeleteCommand>(

View File

@ -80,7 +80,7 @@ public static class ServiceExtensions
serviceCollection.AddDbContextFactory<ApplicationContext>(options =>
{
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
options.UseNpgsql(Configuration.GetConnectionString("PostgresServer"), b => b.MigrationsAssembly("Brizco.Repository"))
options.UseNpgsql(Configuration.GetConnectionString("Postgres"), b => b.MigrationsAssembly("Brizco.Repository"))
.UseProjectAssembly(typeof(ApplicationUser).Assembly);
//options.EnableServiceProviderCaching(true);
}).BuildServiceProvider();
@ -117,7 +117,7 @@ public static class ServiceExtensions
{
var marten = serviceCollection.AddMarten(options =>
{
options.Connection(configuration.GetConnectionString("MartenDBServer")!);
options.Connection(configuration.GetConnectionString("MartenDB")!);
if (environment.IsDevelopment())
options.AutoCreateSchemaObjects = AutoCreate.All;
});

View File

@ -1,6 +1,4 @@
using Brizco.Common.Models.Api;
using Brizco.Core.Models.Api;
using Task = System.Threading.Tasks.Task;
using Task = System.Threading.Tasks.Task;
namespace Brizco.Api.WebFramework.MiddleWares;

View File

@ -1,6 +1,4 @@
using MD.PersianDateTime.Standard;
namespace Brizco.Common.Extensions
namespace Brizco.Common.Extensions
{
public static class DateTimeExtensions
{

View File

@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using System.Reflection;
namespace Brizco.Common.Extensions
{

View File

@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using System.Reflection;
namespace Brizco.Common.Extensions
{

View File

@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Net;
namespace Brizco.Common.Models.Api
{

View File

@ -1,6 +1,4 @@
using Microsoft.VisualBasic.CompilerServices;
namespace Brizco.Common.Models.Entity;
namespace Brizco.Common.Models.Entity;
public abstract class ApiEntity : IApiEntity , IEquatable<ApiEntity>
{
[Key]

View File

@ -17,6 +17,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="EntityServices\Handlers\Complexes\" />
<Folder Include="Models\Api\" />
<Folder Include="QuartzServices\Commands\" />
</ItemGroup>
@ -35,6 +36,7 @@
<Using Include="Brizco.Core.CoreServices.Abstracts" />
<Using Include="Brizco.Core.CoreServices.ReportServices.Commands" />
<Using Include="Brizco.Core.EntityServices.Abstracts" />
<Using Include="Brizco.Core.EntityServices.CommandQueries" />
<Using Include="Brizco.Core.MartenServices.Abstracts" />
<Using Include="Brizco.Core.QuartzServices.Commands" />
<Using Include="Brizco.Domain" />

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Users;
namespace Brizco.Core.CoreServices.Abstracts;
namespace Brizco.Core.CoreServices.Abstracts;
public interface IJwtService : IScopedDependency
{

View File

@ -1,10 +1,4 @@
using System.Threading;
using Brizco.Domain.Entities.Complexes;
using Brizco.Domain.Entities.ShiftPlans;
using Brizco.Domain.Entities.Users;
using NPOI.SS.Formula.Functions;
namespace Brizco.Core.CoreServices;
namespace Brizco.Core.CoreServices;
public class AccountService(
UserManager<ApplicationUser> userManager,

View File

@ -1,7 +1,6 @@
using Microsoft.Extensions.Options;
using System.IdentityModel.Tokens.Jwt;
using System.Text;
using Brizco.Domain.Entities.Users;
namespace Brizco.Core.CoreServices;

View File

@ -1,5 +1,4 @@
using Brizco.Domain.Entities.Shifts;
using Brizco.Domain.Entities.Tasks;
using Brizco.Domain.Entities.Tasks;
using MD.PersianDateTime.Standard;
namespace Brizco.Core.CoreServices.ReportServices;

View File

@ -1,10 +0,0 @@
namespace Brizco.Core.EntityServices.Abstracts;
public interface IComplexService : IScopedDependency
{
Task<ComplexSDto> CreateComplexAsync(string complexName,
string complexAddress,
string complexSuppPhone,
Guid managerUserId,
CancellationToken cancellationToken);
}

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Users;
namespace Brizco.Core.EntityServices.Abstracts;
namespace Brizco.Core.EntityServices.Abstracts;
public interface IUserService : IScopedDependency
{

View File

@ -0,0 +1,7 @@
namespace Brizco.Core.EntityServices.CommandQueries;
public sealed record CreateComplexCoreCommand(
string Name,
string Address,
string SupportPhone,
Guid ManagerUserId ) : IRequest<ComplexSDto>;

View File

@ -1,19 +1,12 @@
using Brizco.Domain.Entities.Users;
namespace Brizco.Core.EntityServices.Handlers.Complexes;
namespace Brizco.Core.EntityServices;
public class ComplexService(ISender sender, RoleManager<ApplicationRole> roleManager) : IComplexService
public class CreateComplexCoreCommandHandler(ISender sender, RoleManager<ApplicationRole> roleManager) : IRequestHandler<CreateComplexCoreCommand , ComplexSDto>
{
public async Task<ComplexSDto> CreateComplexAsync(string complexName,
string complexAddress,
string complexSuppPhone,
Guid managerUserId,
CancellationToken cancellationToken)
public async Task<ComplexSDto> Handle(CreateComplexCoreCommand request, CancellationToken cancellationToken)
{
var complex = await sender.Send(new CreateComplexCommand(complexName,
complexAddress,
complexSuppPhone));
var complex = await sender.Send(new CreateComplexCommand(request.Name,
request.Address,
request.SupportPhone), cancellationToken);
var managerRole = new ApplicationRole
{
@ -79,7 +72,7 @@ public class ComplexService(ISender sender, RoleManager<ApplicationRole> roleMan
await roleManager.AddClaimAsync(staffRole, claim);
var complexUser = await sender.Send(new CreateComplexUserCommand(complex.Id, managerUserId, new List<Guid>{ managerRole.Id }), cancellationToken);
var complexUser = await sender.Send(new CreateComplexUserCommand(complex.Id, request.ManagerUserId, new List<Guid> { managerRole.Id }), cancellationToken);
return complex;
}

View File

@ -1,7 +1,4 @@
using Brizco.Domain.Entities.Complexes;
using Brizco.Domain.Entities.Users;
namespace Brizco.Core.EntityServices;
namespace Brizco.Core.EntityServices;
public class UserService(
ICurrentUserService currentUserService,

View File

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Brizco.Core.Models.Api;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Commands;
namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateActivityCommand(
TaskType Type,

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Commands;
namespace Brizco.Domain.CommandQueries.Commands;
public record CreateShiftPlanCommand(long PlanDate,Guid ShiftId,Guid RoutineId,Guid SupervisionUserId, List<KeyValuePair<Guid,Guid>> UserAndPositionIds)
:IRequest<ShiftPlanLDto>;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Commands;
namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateTaskCommand(TaskType Type,
string Title,

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Queries;
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetActivitiesQuery(int Page = 0 ,
long SelectedDate = 0 ,

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Queries;
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetPositionsQuery(int Page = 0) :
IRequest<List<PositionSDto>>;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Queries;
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetSectionsQuery(int Page = 0) :
IRequest<List<SectionSDto>>;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Queries;
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetShiftPlansQuery(int Page = 0 , long SelectedDate = 0 , DateTimeQueryFilter? DateTimeQueryFilter = DateTimeQueryFilter.CustomDate) :
IRequest<List<ShiftPlanSDto>>;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Queries;
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetShiftsQuery(int Page = 0,long SelectedDate = 0) :
IRequest<List<ShiftSDto>>;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.CommandQueries.Queries;
namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetTasksQuery(int Page = 0 , int? Count = null,Guid? ShiftId = null) :
IRequest<List<TaskSDto>>;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.Dtos.LargeDtos;
public class ComplexLDto : BaseDto<ComplexLDto,Complex>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.Dtos.LargeDtos;
public class PositionLDto : BaseDto<PositionLDto, Position>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.Dtos.LargeDtos;
public class SectionLDto : BaseDto<SectionLDto, Section>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.Dtos.LargeDtos;
public class ShiftLDto : BaseDto<ShiftLDto,Shift>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Dtos.LargeDtos;
namespace Brizco.Domain.Dtos.LargeDtos;
public class ShiftPlanLDto : BaseDto<ShiftPlanLDto , ShiftPlan>
{

View File

@ -1,6 +1,4 @@
using Brizco.Common.Models.Api;
namespace Brizco.Domain.Dtos.ResponseDto;
namespace Brizco.Domain.Dtos.ResponseDto;
public class ProfileResponseDto
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Users;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ApplicationUserSDto : BaseDto<ApplicationUserSDto,ApplicationUser>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ComplexSDto : BaseDto<ComplexSDto, Complex>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ComplexUserRoleSDto : BaseDto<ComplexUserRoleSDto,ComplexUserRole>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ComplexUserSDto : BaseDto<ComplexUserSDto,ComplexUser>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class PositionSDto : BaseDto<PositionSDto, Position>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Routines;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class RoutineSDto : BaseDto<RoutineSDto,Routine>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class SectionSDto : BaseDto<SectionSDto, Section>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ShiftDaySDto : BaseDto<ShiftDaySDto,ShiftDay>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ShiftPlanSDto : BaseDto<ShiftPlanSDto,ShiftPlan>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.ShiftPlans;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ShiftPlanUserSDto : BaseDto<ShiftPlanUserSDto,ShiftPlanUser>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ShiftRoutineSDto : BaseDto<ShiftRoutineSDto, ShiftRoutine>
{

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Dtos.SmallDtos;
namespace Brizco.Domain.Dtos.SmallDtos;
public class ShiftSDto : BaseDto<ShiftSDto,Shift>
{
public string Title { get; set; } = string.Empty;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
using Brizco.Domain.Entities.Users;
using Task = Brizco.Domain.Entities.Tasks.Task;
using Task = Brizco.Domain.Entities.Tasks.Task;
namespace Brizco.Domain.Entities.Complexes;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Users;
namespace Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Entities.Complexes;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public partial class ComplexUser : ApiEntity

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Users;
namespace Brizco.Domain.Entities.Complexes;
namespace Brizco.Domain.Entities.Complexes;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public class ComplexUserRole : ApiEntity

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Entities.Routines;
namespace Brizco.Domain.Entities.Routines;
public partial class Routine
{

View File

@ -1,5 +1,4 @@
using Brizco.Domain.Entities.Shifts;
using Brizco.Domain.Entities.Tasks;
using Brizco.Domain.Entities.Tasks;
namespace Brizco.Domain.Entities.Routines;

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Routines;
namespace Brizco.Domain.Entities.Shifts;
namespace Brizco.Domain.Entities.Shifts;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]

View File

@ -1,6 +1,4 @@
using Brizco.Domain.Entities.Routines;
namespace Brizco.Domain.Entities.Tasks;
namespace Brizco.Domain.Entities.Tasks;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]

View File

@ -1,6 +1,4 @@
using Brizco.Domain.MartenEntities.Notifications;
namespace Brizco.Repository.MartenHandlers.Notifications;
namespace Brizco.Repository.MartenHandlers.Notifications;
public class ReadNotificationCommandHandler(IMartenRepositoryWrapper martenRepositoryWrapper, ICurrentUserService currentUserService) : IRequestHandler<ReadNotificationCommand, bool>
{