diff --git a/MBS-COMMAND.API/appsettings.json b/MBS-COMMAND.API/appsettings.json index aa0bede..98cb9d3 100644 --- a/MBS-COMMAND.API/appsettings.json +++ b/MBS-COMMAND.API/appsettings.json @@ -70,5 +70,5 @@ ] }, "AllowedHosts": "*", - "Domain" : "http://103.162.14.116:4000/" + "Domain" : "http://103.162.14.116:4000" } diff --git a/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs b/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs index 67c94ad..6370e2b 100644 --- a/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs +++ b/MBS_COMMAND.Application/UserCases/Commands/Feedbacks/CreateFeedbackCommandHandler.cs @@ -1,6 +1,7 @@ using MBS_COMMAND.Contract.Abstractions.Messages; using MBS_COMMAND.Contract.Abstractions.Shared; using MBS_COMMAND.Contract.Services.Feedbacks; +using MBS_COMMAND.Domain.Abstractions; using MBS_COMMAND.Domain.Abstractions.Repositories; using MBS_COMMAND.Domain.Entities; @@ -10,12 +11,12 @@ public class CreateFeedbackCommandHandler : ICommandHandler _feedbackRepository; private readonly ICurrentUserService _currentUserService; - - public CreateFeedbackCommandHandler(IRepositoryBase feedbackRepository, - ICurrentUserService currentUserService) + private readonly IUnitOfWork _unitOfWork; + public CreateFeedbackCommandHandler(IRepositoryBase feedbackRepository, ICurrentUserService currentUserService, IUnitOfWork unitOfWork) { _feedbackRepository = feedbackRepository; _currentUserService = currentUserService; + _unitOfWork = unitOfWork; } public async Task Handle(Command.CreateFeedback request, CancellationToken cancellationToken) @@ -30,6 +31,7 @@ public async Task Handle(Command.CreateFeedback request, CancellationTok IsMentor = role, }; _feedbackRepository.Add(feedback); + await _unitOfWork.SaveChangesAsync(cancellationToken); return Result.Success(); } } \ No newline at end of file diff --git a/MBS_COMMAND.Application/UserCases/Commands/Groups/AddMemberToGroupCommandHandler.cs b/MBS_COMMAND.Application/UserCases/Commands/Groups/AddMemberToGroupCommandHandler.cs index 119571f..344c487 100644 --- a/MBS_COMMAND.Application/UserCases/Commands/Groups/AddMemberToGroupCommandHandler.cs +++ b/MBS_COMMAND.Application/UserCases/Commands/Groups/AddMemberToGroupCommandHandler.cs @@ -20,6 +20,8 @@ public async Task Handle(Command.AddMemberToGroup request, CancellationT var u = await userRepository.FindByIdAsync(request.MemberId, cancellationToken); if (u == null) return Result.Failure(new Error("404", "User Not Found")); + if(u.Role==1) + return Result.Failure(new Error("422", "Mentor cannot be added to group")); var g = await groupRepository.FindSingleAsync(x => x.Id == request.GroupId, cancellationToken); if (g == null) return Result.Failure(new Error("404", "Group Not Found")); diff --git a/MBS_COMMAND.Application/UserCases/Commands/Schedules/CreateScheduleCommandHandler.cs b/MBS_COMMAND.Application/UserCases/Commands/Schedules/CreateScheduleCommandHandler.cs index 471a016..d2082f7 100644 --- a/MBS_COMMAND.Application/UserCases/Commands/Schedules/CreateScheduleCommandHandler.cs +++ b/MBS_COMMAND.Application/UserCases/Commands/Schedules/CreateScheduleCommandHandler.cs @@ -76,7 +76,6 @@ public async Task Handle(Command.CreateScheduleCommand request, Cancella MentorId = slot.MentorId ?? new Guid(), SubjectId = request.SubjectId, GroupId = group.Id, - IsBooked = true, }; slot.IsBook = true; diff --git a/MBS_COMMAND.Domain/Entities/Schedule.cs b/MBS_COMMAND.Domain/Entities/Schedule.cs index 2a17dd7..87bfc00 100644 --- a/MBS_COMMAND.Domain/Entities/Schedule.cs +++ b/MBS_COMMAND.Domain/Entities/Schedule.cs @@ -10,12 +10,10 @@ public class Schedule : Entity, IAuditableEntity public virtual Slot? Slot { get; set; } public Guid GroupId { get; set; } public virtual Group? Group { get; set; } - public TimeOnly StartTime { get; set; } public TimeOnly EndTime { get; set; } public DateOnly Date { get; set; } public Guid SubjectId { get; set; } - public bool IsBooked { get; set; }=false; public virtual Subject? Subject { get; set; } public DateTimeOffset CreatedOnUtc { get ; set ; } public DateTimeOffset? ModifiedOnUtc { get ; set ; } diff --git a/MBS_COMMAND.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs b/MBS_COMMAND.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs index d3577f7..d418419 100644 --- a/MBS_COMMAND.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/MBS_COMMAND.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs @@ -273,9 +273,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("GroupId") .HasColumnType("uniqueidentifier"); - b.Property("IsBooked") - .HasColumnType("bit"); - b.Property("IsDeleted") .HasColumnType("bit");