init
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
|
||||
public class BugSection : EntityBase<Guid>
|
||||
{
|
||||
public BugSection(Guid taskId, string initialDescription, long originalAssignedUserId)
|
||||
{
|
||||
TaskId = taskId;
|
||||
InitialDescription = initialDescription;
|
||||
Status = TaskSectionStatus.ReadyToStart;
|
||||
OriginalAssignedUserId = originalAssignedUserId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// آی دی تسک - بخش فرعی
|
||||
/// </summary>
|
||||
public Guid TaskId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات مدیر
|
||||
/// </summary>
|
||||
public string InitialDescription { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت باگ گزارش شده
|
||||
/// </summary>
|
||||
public TaskSectionStatus Status { get; private set; }
|
||||
|
||||
|
||||
// شخصی که برای اولین بار این بخش به او اختصاص داده شده (مالک اصلی)
|
||||
public long OriginalAssignedUserId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// اولویت رسیدگی
|
||||
/// </summary>
|
||||
public ProjectTaskPriority Priority { get; private set; }
|
||||
|
||||
// Navigation to ProjectTask (must be Task level)
|
||||
public ProjectTask ProjectTask { get; private set; } = null!;
|
||||
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
{
|
||||
PhaseId = phaseId;
|
||||
_sections = new List<TaskSection>();
|
||||
BugSectionList = new List<BugSection>();
|
||||
Priority = priority;
|
||||
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
||||
}
|
||||
@@ -27,6 +28,7 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
public Guid PhaseId { get; private set; }
|
||||
public ProjectPhase Phase { get; private set; } = null!;
|
||||
public IReadOnlyList<TaskSection> Sections => _sections.AsReadOnly();
|
||||
public List<BugSection> BugSectionList { get; set; }
|
||||
|
||||
// Task-specific properties
|
||||
public Enums.TaskStatus Status { get; private set; } = Enums.TaskStatus.NotStarted;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class BugSectionMapping : IEntityTypeConfiguration<BugSection>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BugSection> builder)
|
||||
{
|
||||
builder.ToTable("BugSections");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Id)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
builder.Property(x => x.TaskId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Status)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
builder.Property(x => x.Priority)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.InitialDescription)
|
||||
.HasMaxLength(500)
|
||||
.IsRequired(false);
|
||||
|
||||
|
||||
// Navigation to ProjectTask (Task level)
|
||||
builder.HasOne(x => x.ProjectTask)
|
||||
.WithMany(t => t.BugSectionList)
|
||||
.HasForeignKey(x => x.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,12 @@ public class ProjectTaskMapping : IEntityTypeConfiguration<ProjectTask>
|
||||
.WithOne(s => s.Task)
|
||||
.HasForeignKey(s => s.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
|
||||
// One-to-many relationship with BugSections
|
||||
builder.HasMany(t => t.BugSectionList)
|
||||
.WithOne(s => s.ProjectTask)
|
||||
.HasForeignKey(s => s.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user