bugSection and BugDocument mapping and migration
This commit is contained in:
5
Directory.Build.props
Normal file
5
Directory.Build.props
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<NuGetAudit>false</NuGetAudit>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -25,7 +25,7 @@ public interface IProgramManagerDbContext
|
|||||||
DbSet<TaskSection> TaskSections { get; set; }
|
DbSet<TaskSection> TaskSections { get; set; }
|
||||||
DbSet<ProjectSection> ProjectSections { get; set; }
|
DbSet<ProjectSection> ProjectSections { get; set; }
|
||||||
DbSet<PhaseSection> PhaseSections { get; set; }
|
DbSet<PhaseSection> PhaseSections { get; set; }
|
||||||
|
DbSet<BugSection> BugSections { get; set; }
|
||||||
DbSet<ProjectTask> ProjectTasks { get; set; }
|
DbSet<ProjectTask> ProjectTasks { get; set; }
|
||||||
|
|
||||||
DbSet<TaskChatMessage> TaskChatMessages { get; set; }
|
DbSet<TaskChatMessage> TaskChatMessages { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
|
||||||
|
public class BugDocument
|
||||||
|
{
|
||||||
|
|
||||||
|
public BugDocument(Guid fileId)
|
||||||
|
{
|
||||||
|
FileId = fileId;
|
||||||
|
}
|
||||||
|
private BugDocument() { } // EF
|
||||||
|
public Guid Id { get; private set; }
|
||||||
|
public Guid FileId { get; private set; }
|
||||||
|
public BugSection BugSection { get; private set; }
|
||||||
|
}
|
||||||
@@ -5,12 +5,23 @@ namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
|||||||
|
|
||||||
public class BugSection : EntityBase<Guid>
|
public class BugSection : EntityBase<Guid>
|
||||||
{
|
{
|
||||||
public BugSection(Guid taskId, string initialDescription, long originalAssignedUserId)
|
public BugSection(Guid taskId, string initialDescription, long originalAssignedUserId, ProjectTaskPriority priority)
|
||||||
{
|
{
|
||||||
TaskId = taskId;
|
TaskId = taskId;
|
||||||
InitialDescription = initialDescription;
|
InitialDescription = initialDescription;
|
||||||
Status = TaskSectionStatus.ReadyToStart;
|
Status = TaskSectionStatus.ReadyToStart;
|
||||||
OriginalAssignedUserId = originalAssignedUserId;
|
OriginalAssignedUserId = originalAssignedUserId;
|
||||||
|
Priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// برای EF Core
|
||||||
|
private BugSection()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,5 +52,14 @@ public class BugSection : EntityBase<Guid>
|
|||||||
// Navigation to ProjectTask (must be Task level)
|
// Navigation to ProjectTask (must be Task level)
|
||||||
public ProjectTask ProjectTask { get; private set; } = null!;
|
public ProjectTask ProjectTask { get; private set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// لیست مدارک و فایلها
|
||||||
|
/// </summary>
|
||||||
|
public List<BugDocument> BugDocuments { get; private set; } = new();
|
||||||
|
|
||||||
|
public void AddDocument(BugDocument document)
|
||||||
|
{
|
||||||
|
BugDocuments.Add(document);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class BugSectioninit : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "BugSections",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
InitialDescription = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
||||||
|
Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||||
|
OriginalAssignedUserId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
Priority = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_BugSections", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_BugSections_ProjectTasks_TaskId",
|
||||||
|
column: x => x.TaskId,
|
||||||
|
principalTable: "ProjectTasks",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "BugDocuments",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
FileId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
BugSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_BugDocuments", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_BugDocuments_BugSections_BugSectionId",
|
||||||
|
column: x => x.BugSectionId,
|
||||||
|
principalTable: "BugSections",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_BugDocuments_BugSectionId",
|
||||||
|
table: "BugDocuments",
|
||||||
|
column: "BugSectionId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_BugSections_TaskId",
|
||||||
|
table: "BugSections",
|
||||||
|
column: "TaskId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "BugDocuments");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "BugSections");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -227,6 +227,41 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("UploadedFiles", (string)null);
|
b.ToTable("UploadedFiles", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("InitialDescription")
|
||||||
|
.HasMaxLength(500)
|
||||||
|
.HasColumnType("nvarchar(500)");
|
||||||
|
|
||||||
|
b.Property<long>("OriginalAssignedUserId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Priority")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
|
b.Property<Guid>("TaskId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TaskId");
|
||||||
|
|
||||||
|
b.ToTable("BugSections", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
@@ -792,6 +827,43 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("UserRefreshTokens", (string)null);
|
b.ToTable("UserRefreshTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "ProjectTask")
|
||||||
|
.WithMany("BugSectionList")
|
||||||
|
.HasForeignKey("TaskId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugDocument", "BugDocuments", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b1.Property<Guid>("BugSectionId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b1.Property<Guid>("FileId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b1.HasKey("Id");
|
||||||
|
|
||||||
|
b1.HasIndex("BugSectionId");
|
||||||
|
|
||||||
|
b1.ToTable("BugDocuments", (string)null);
|
||||||
|
|
||||||
|
b1.WithOwner("BugSection")
|
||||||
|
.HasForeignKey("BugSectionId");
|
||||||
|
|
||||||
|
b1.Navigation("BugSection");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.Navigation("BugDocuments");
|
||||||
|
|
||||||
|
b.Navigation("ProjectTask");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase")
|
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase")
|
||||||
@@ -1047,6 +1119,8 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("BugSectionList");
|
||||||
|
|
||||||
b.Navigation("Sections");
|
b.Navigation("Sections");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class ProgramManagerDbContext : DbContext, IProgramManagerDbContext
|
|||||||
public DbSet<TaskSection> TaskSections { get; set; } = null!;
|
public DbSet<TaskSection> TaskSections { get; set; } = null!;
|
||||||
public DbSet<ProjectSection> ProjectSections { get; set; } = null!;
|
public DbSet<ProjectSection> ProjectSections { get; set; } = null!;
|
||||||
public DbSet<PhaseSection> PhaseSections { get; set; } = null!;
|
public DbSet<PhaseSection> PhaseSections { get; set; } = null!;
|
||||||
|
public DbSet<BugSection> BugSections { get; set; } = null!;
|
||||||
|
|
||||||
// New Hierarchy entities
|
// New Hierarchy entities
|
||||||
public DbSet<Project> Projects { get; set; } = null!;
|
public DbSet<Project> Projects { get; set; } = null!;
|
||||||
|
|||||||
@@ -34,6 +34,14 @@ public class BugSectionMapping : IEntityTypeConfiguration<BugSection>
|
|||||||
.IsRequired(false);
|
.IsRequired(false);
|
||||||
|
|
||||||
|
|
||||||
|
builder.OwnsMany(x => x.BugDocuments, navigationBuilder =>
|
||||||
|
{
|
||||||
|
|
||||||
|
navigationBuilder.ToTable("BugDocuments");
|
||||||
|
navigationBuilder.HasKey(x => x.Id);
|
||||||
|
navigationBuilder.WithOwner(x => x.BugSection);
|
||||||
|
});
|
||||||
|
|
||||||
// Navigation to ProjectTask (Task level)
|
// Navigation to ProjectTask (Task level)
|
||||||
builder.HasOne(x => x.ProjectTask)
|
builder.HasOne(x => x.ProjectTask)
|
||||||
.WithMany(t => t.BugSectionList)
|
.WithMany(t => t.BugSectionList)
|
||||||
|
|||||||
Reference in New Issue
Block a user