diff --git a/MBS_COMMAND.Application/MBS_COMMAND.Application.csproj b/MBS_COMMAND.Application/MBS_COMMAND.Application.csproj index f6240ea..cf2dd1e 100644 --- a/MBS_COMMAND.Application/MBS_COMMAND.Application.csproj +++ b/MBS_COMMAND.Application/MBS_COMMAND.Application.csproj @@ -16,7 +16,7 @@ <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" /> <PackageReference Include="FluentValidation" Version="11.10.0" /> <PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.10.0" /> - <PackageReference Include="MBS_CONTRACT.SHARE" Version="1.1.12" /> + <PackageReference Include="MBS_CONTRACT.SHARE" Version="1.1.14" /> <PackageReference Include="MediatR" Version="12.4.1" /> <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" /> </ItemGroup> diff --git a/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs b/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs index b93767a..6361179 100644 --- a/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs +++ b/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs @@ -7,21 +7,15 @@ namespace MBS_COMMAND.Application.UserCases.Commands.Feedbacks; -public class CreateFeedbackCommandHandler : ICommandHandler<Command.CreateFeedback> +public class CreateFeedbackCommandHandler( + IRepositoryBase<Feedback, Guid> feedbackRepository, + ICurrentUserService currentUserService, + IUnitOfWork unitOfWork) + : ICommandHandler<Command.CreateFeedback> { - private readonly IRepositoryBase<Feedback, Guid> _feedbackRepository; - private readonly ICurrentUserService _currentUserService; - private readonly IUnitOfWork _unitOfWork; - public CreateFeedbackCommandHandler(IRepositoryBase<Feedback, Guid> feedbackRepository, ICurrentUserService currentUserService, IUnitOfWork unitOfWork) - { - _feedbackRepository = feedbackRepository; - _currentUserService = currentUserService; - _unitOfWork = unitOfWork; - } - public async Task<Result> Handle(Command.CreateFeedback request, CancellationToken cancellationToken) { - var role = _currentUserService.Role == "1"; + var role = currentUserService.Role == "1"; var feedback = new Feedback { Content = request.Content, @@ -30,8 +24,8 @@ public async Task<Result> Handle(Command.CreateFeedback request, CancellationTok ScheduleId = request.ScheduleId, IsMentor = role, }; - _feedbackRepository.Add(feedback); - await _unitOfWork.SaveChangesAsync(cancellationToken); + feedbackRepository.Add(feedback); + await unitOfWork.SaveChangesAsync(cancellationToken); return Result.Success(); } } \ No newline at end of file diff --git a/MBS_COMMAND.Domain/Entities/User.cs b/MBS_COMMAND.Domain/Entities/User.cs index 5f87e3d..d11825c 100644 --- a/MBS_COMMAND.Domain/Entities/User.cs +++ b/MBS_COMMAND.Domain/Entities/User.cs @@ -33,6 +33,7 @@ public void CreateSlot(IEnumerable<Slot> slots) { var slot = slots.Select(x => new DomainEvent.Slot { + SlotId = x.Id, MentorId = x.MentorId, StartTime = x.StartTime, EndTime = x.EndTime, @@ -43,7 +44,5 @@ public void CreateSlot(IEnumerable<Slot> slots) IsBook = x.IsBook, }).ToList(); RaiseDomainEvent(new DomainEvent.MentorSlotCreated(Guid.NewGuid(), slot)); - Console.BackgroundColor = ConsoleColor.DarkGreen; - Console.WriteLine("MentorSlotCreatedDomainevent"); } } \ No newline at end of file diff --git a/MBS_COMMAND.Domain/MBS_COMMAND.Domain.csproj b/MBS_COMMAND.Domain/MBS_COMMAND.Domain.csproj index 05cd798..52ff600 100644 --- a/MBS_COMMAND.Domain/MBS_COMMAND.Domain.csproj +++ b/MBS_COMMAND.Domain/MBS_COMMAND.Domain.csproj @@ -11,7 +11,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="MBS_CONTRACT.SHARE" Version="1.1.12" /> + <PackageReference Include="MBS_CONTRACT.SHARE" Version="1.1.14" /> </ItemGroup> </Project>