diff --git a/MBS-COMMAND.API/appsettings.Development.json b/MBS-COMMAND.API/appsettings.Development.json index 4f69f9b..4155751 100644 --- a/MBS-COMMAND.API/appsettings.Development.json +++ b/MBS-COMMAND.API/appsettings.Development.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "ConnectionStrings": "Server=103.162.14.116;Database=PRN_SUPER;Uid=sa;Pwd=MyStrongPassword123@;Trust Server Certificate=True;", + "ConnectionStrings": "Server=(local);Database=PRN_SUPER;Uid=sa;Pwd=12345;Trust Server Certificate=True;", "Redis": "103.162.14.116:6379,password=MyStrongPassword123@,abortConnect=false" }, "JwtOption": { @@ -10,11 +10,11 @@ "ExpireMin": 5 }, "MasstransitConfiguration": { - "Host": "103.162.14.116", - "VHost": "myHost", + "Host": "local", + "VHost": "phucnghi", "Port": 5672, - "UserName": "sa", - "Password": "MyStrongPassword123@" + "UserName": "guest", + "Password": "guest" }, "MessageBusOptions": { "retryLimit": 3, @@ -69,5 +69,6 @@ "WithThreadId" ] }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "Domain" : "localhost:3000" } diff --git a/MBS_COMMAND.Application/UserCases/Commands/Groups/CreateGroupCommandHandler.cs b/MBS_COMMAND.Application/UserCases/Commands/Groups/CreateGroupCommandHandler.cs index de1be6b..f793cc7 100644 --- a/MBS_COMMAND.Application/UserCases/Commands/Groups/CreateGroupCommandHandler.cs +++ b/MBS_COMMAND.Application/UserCases/Commands/Groups/CreateGroupCommandHandler.cs @@ -6,27 +6,26 @@ namespace MBS_COMMAND.Application.UserCases.Commands.Groups; -public sealed class CreateGroupCommandHandler(IRepositoryBase repositoryBase, IRepositoryBase userRepository, ICurrentUserService currentUserService) : ICommandHandler +public sealed class CreateGroupCommandHandler( + IRepositoryBase repositoryBase, + IRepositoryBase userRepository, + ICurrentUserService currentUserService) : ICommandHandler { public async Task Handle(Command.CreateGroupCommand request, CancellationToken cancellationToken) { - var M = await userRepository.FindSingleAsync(x => x.Id == request.MentorId, cancellationToken); - if (M == null) - return Result.Failure(new Error("404", "Mentor Not Found")); - /* var T = Guid.TryParse(currentUserService.UserId, out Guid L); + var T = Guid.TryParse(currentUserService.UserId, out var L); if (!T) - return Result.Failure(new Error("404", "User Not Authorized"));*/ + return Result.Failure(new Error("404", "User Not Authorized")); var G = new Group { Name = request.Name, MentorId = request.MentorId, Stack = request.Stacks, - // LeaderId = L - + // LeaderId = L }; - G.Members!.Add(new Group_Student_Mapping { StudentId = M.Id, GroupId = G.Id }); + G.Members!.Add(new Group_Student_Mapping { StudentId = L, GroupId = G.Id }); repositoryBase.Add(G); return Result.Success(); } -} +} \ No newline at end of file