Skip to content

Commit

Permalink
Merge pull request #33 from bentran1vn/Fix/CreateSchedules
Browse files Browse the repository at this point in the history
Fix CreateSchedules
  • Loading branch information
bentran1vn authored Oct 24, 2024
2 parents 9e259b8 + a9ab3ec commit 0236c87
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions MBS-COMMAND.API/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"ConnectionStrings": "Server=(local);Database=PRN_SUPER;Uid=sa;Pwd=12345;Trust Server Certificate=True;",
"ConnectionStrings": "Server=103.162.14.116;Database=PRN_SUPER;Uid=sa;Pwd=MyStrongPassword123@;Trust Server Certificate=True;",
"Redis": "103.162.14.116:6379,password=MyStrongPassword123@,abortConnect=false"
},
"JwtOption": {
Expand All @@ -10,11 +10,11 @@
"ExpireMin": 5
},
"MasstransitConfiguration": {
"Host": "local",
"VHost": "phucnghi",
"Host": "103.162.14.116",
"VHost": "myHost",
"Port": 5672,
"UserName": "guest",
"Password": "guest"
"UserName": "sa",
"Password": "MyStrongPassword123@"
},
"MessageBusOptions": {
"retryLimit": 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<Result> Handle(Command.CreateScheduleCommand request, Cancella
return Result.Failure(new Error("400", "User is not exist !"));
}

var group = await _groupRepository.FindSingleAsync(x => x.LeaderId.Equals(user.Id), cancellationToken);
var group = await _groupRepository.FindSingleAsync(x => x.LeaderId.Equals(user.Id) && x.ProjectId.Equals(request.ProjectId), cancellationToken);

if (group == null || group.IsDeleted)
{
Expand Down Expand Up @@ -76,6 +76,7 @@ public async Task<Result> Handle(Command.CreateScheduleCommand request, Cancella
MentorId = slot.MentorId ?? new Guid(),
SubjectId = request.SubjectId,
GroupId = group.Id,
SlotId = slot.Id
};

slot.IsBook = true;
Expand Down
1 change: 1 addition & 0 deletions MBS_COMMAND.Contract/Services/Schedule/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public record CreateScheduleCommand : ICommand

public Guid SlotId { get; set; }
public Guid SubjectId { get; set; }
public Guid ProjectId { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
}
Expand Down
2 changes: 0 additions & 2 deletions MBS_COMMAND.Domain/Entities/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class Schedule : Entity<Guid>, IAuditableEntity
public DateOnly Date { get; set; }
public Guid SubjectId { get; set; }

public string? Description { get; set; }

public virtual Subject? Subject { get; set; }
public DateTimeOffset CreatedOnUtc { get ; set ; }
public DateTimeOffset? ModifiedOnUtc { get ; set ; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static async Task<IResult> CreateMentorSkills(ISender sender, [FromForm]
command.MentorId = new Guid(userId);

var result = await sender.Send(command);

if (result.IsFailure)
return HandlerFailure(result);

Expand Down

0 comments on commit 0236c87

Please sign in to comment.