Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PhucNghi176 committed Nov 11, 2024
1 parent 25ce619 commit d75bd75
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ public class CreateFeedbackCommandHandler(
public async Task<Result> Handle(Command.CreateFeedback request, CancellationToken cancellationToken)
{
var role = currentUserService.Role == "1";

var feedback = new Feedback
{
Content = request.Content,
Rating = request.Rating,
ScheduleId = request.ScheduleId,
IsMentor = role,
IsPresent = request.IsPresent,
};
feedbackRepository.Add(feedback);
await unitOfWork.SaveChangesAsync(cancellationToken);
Expand Down
2 changes: 1 addition & 1 deletion MBS_COMMAND.Contract/Services/Feedbacks/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ namespace MBS_COMMAND.Contract.Services.Feedbacks;

public static class Command
{
public record CreateFeedback(Guid GroupId, string? Content,Guid ScheduleId, int Rating) : ICommand;
public record CreateFeedback(Guid GroupId, string? Content,Guid ScheduleId, int Rating,bool IsPresent) : ICommand;
}
1 change: 1 addition & 0 deletions MBS_COMMAND.Domain/Entities/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public class Config
{
[Key]
public string Key { get; set; }
[MaxLength(Int32.MaxValue)]
public string Value { get; set; }
}
2 changes: 1 addition & 1 deletion MBS_COMMAND.Domain/Entities/Feedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Feedback : Entity<Guid>, IAuditableEntity
public int Rating { get; set; }
public Guid? ScheduleId { get; set; }
public virtual Schedule? Schedule { get; set; }

public bool? IsPresent { get; set; }
public bool IsMentor { 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 @@ -93,6 +93,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2147483647)
.HasColumnType("nvarchar(max)");

b.HasKey("Key");
Expand All @@ -119,6 +120,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<bool>("IsMentor")
.HasColumnType("bit");

b.Property<bool?>("IsPresent")
.HasColumnType("bit");

b.Property<DateTimeOffset?>("ModifiedOnUtc")
.HasColumnType("datetimeoffset");

Expand Down

0 comments on commit d75bd75

Please sign in to comment.