Skip to content

Commit

Permalink
Update database
Browse files Browse the repository at this point in the history
  • Loading branch information
PhucNghi176 committed Nov 11, 2024
1 parent e9e584f commit 358d6a9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace MBS_COMMAND.Application.UserCases.Commands.Feedbacks;

public class CreateFeedbackCommandHandler(
IRepositoryBase<Feedback, Guid> feedbackRepository,

ICurrentUserService currentUserService,
IUnitOfWork unitOfWork)
: ICommandHandler<Command.CreateFeedback>
Expand All @@ -19,7 +20,6 @@ public async Task<Result> Handle(Command.CreateFeedback request, CancellationTok
var feedback = new Feedback
{
Content = request.Content,
GroupId = request.GroupId,
Rating = request.Rating,
ScheduleId = request.ScheduleId,
IsMentor = role,
Expand Down
3 changes: 1 addition & 2 deletions MBS_COMMAND.Domain/Entities/Feedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +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 Guid? GroupId { get; set; }
public virtual Group? Group { get; set; }

public bool IsMentor { get; set; }
public DateTimeOffset CreatedOnUtc { get; set; }
public DateTimeOffset? ModifiedOnUtc { get; set; }
Expand Down
21 changes: 10 additions & 11 deletions MBS_COMMAND.Domain/Entities/Group.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
using MBS_COMMAND.Domain.Abstractions.Entities;

namespace MBS_COMMAND.Domain.Entities;

public class Group : Entity<Guid>, IAuditableEntity
{
public string Name { get; set; }
public Guid? MentorId { get; set; }
public string Name { get; set; }
public Guid? MentorId { get; set; }
public virtual User? Mentor { get; set; }
public Guid? LeaderId { get; set; }
public virtual User? Leader { get; set; }
public string Stack { get; set; }
public Guid? ProjectId { get; set; }
public string Stack { get; set; }

public Guid? SubjectId { get; set; }
public virtual Subject? Subject { get; set; }

public Guid? ProjectId { get; set; }
public virtual Project? Project { get; set; }

public double? BookingPoints { get; set; }
public DateTimeOffset CreatedOnUtc { get; set; }
public DateTimeOffset? ModifiedOnUtc { get; set; }
public virtual ICollection<Group_Student_Mapping>? Members { get; set; } = [];


}


}
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<DateTimeOffset>("CreatedOnUtc")
.HasColumnType("datetimeoffset");

b.Property<Guid?>("GroupId")
.HasColumnType("uniqueidentifier");

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

Expand All @@ -132,8 +129,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasKey("Id");

b.HasIndex("GroupId");

b.HasIndex("ScheduleId");

b.ToTable("Feedbacks");
Expand Down Expand Up @@ -174,6 +169,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.IsRequired()
.HasColumnType("nvarchar(max)");

b.Property<Guid?>("SubjectId")
.HasColumnType("uniqueidentifier");

b.HasKey("Id");

b.HasIndex("LeaderId");
Expand All @@ -182,6 +180,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasIndex("ProjectId");

b.HasIndex("SubjectId");

b.ToTable("Groups");
});

Expand Down Expand Up @@ -582,16 +582,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)

modelBuilder.Entity("MBS_COMMAND.Domain.Entities.Feedback", b =>
{
b.HasOne("MBS_COMMAND.Domain.Entities.Group", "Group")
.WithMany()
.HasForeignKey("GroupId");

b.HasOne("MBS_COMMAND.Domain.Entities.Schedule", "Schedule")
.WithMany()
.HasForeignKey("ScheduleId");

b.Navigation("Group");

b.Navigation("Schedule");
});

Expand All @@ -609,11 +603,17 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.WithMany()
.HasForeignKey("ProjectId");

b.HasOne("MBS_COMMAND.Domain.Entities.Subject", "Subject")
.WithMany()
.HasForeignKey("SubjectId");

b.Navigation("Leader");

b.Navigation("Mentor");

b.Navigation("Project");

b.Navigation("Subject");
});

modelBuilder.Entity("MBS_COMMAND.Domain.Entities.Group_Student_Mapping", b =>
Expand Down

0 comments on commit 358d6a9

Please sign in to comment.