merge From BugSection

This commit is contained in:
gozareshgir
2026-01-28 12:45:48 +03:30
10 changed files with 1345 additions and 15 deletions

View File

@@ -0,0 +1,32 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
public class BugSectionWorkflowProvider : IWorkflowProvider
{
public WorkflowType Type => WorkflowType.BugSection;
public async Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
{
var bugs =context.BugSections
.Where(b=>b.Status == TaskSectionStatus.ReadyToStart)
.Include(x => x.ProjectTask).AsNoTracking();
return await bugs.Select(x => new WorkflowListItem
{
EntityId = x.Id,
Title = x.ProjectTask.Name,
Type = WorkflowType.BugSection
}).ToListAsync(cancellationToken);
}
public async Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
{
var query = context.BugSections
.Where(b => b.Status == TaskSectionStatus.ReadyToStart);
return await query.CountAsync(cancellationToken);
}
}

View File

@@ -4,7 +4,7 @@ using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowLi
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
public record WorkflowCountResponse(int Total, int Rejected, int NotAssigned, int PendingForApproval);
public record WorkflowCountResponse(int Total, int Rejected, int NotAssigned, int PendingForApproval,int BugSection);
public record WorkflowCountQuery() : IBaseQuery<WorkflowCountResponse>;
@@ -28,6 +28,7 @@ public class WorkflowCountQueryHandler : IBaseQueryHandler<WorkflowCountQuery, W
int rejectedCount = 0;
int notAssignedCount = 0;
int pendingForApprovalCount = 0;
int bugSectionCount = 0;
foreach (var provider in _providers)
{
@@ -40,11 +41,13 @@ public class WorkflowCountQueryHandler : IBaseQueryHandler<WorkflowCountQuery, W
notAssignedCount += count; break;
case WorkflowType.PendingForApproval:
pendingForApprovalCount += count; break;
case WorkflowType.BugSection:
bugSectionCount += count; break;
}
}
var total = rejectedCount + notAssignedCount + pendingForApprovalCount;
var response = new WorkflowCountResponse(total, rejectedCount, notAssignedCount, pendingForApprovalCount);
var total = rejectedCount + notAssignedCount + pendingForApprovalCount + bugSectionCount;
var response = new WorkflowCountResponse(total, rejectedCount, notAssignedCount, pendingForApprovalCount, bugSectionCount);
return OperationResult<WorkflowCountResponse>.Success(response);
}
}

View File

@@ -19,6 +19,7 @@ public enum WorkflowType
Rejected,
NotAssigned,
PendingForApproval,
BugSection,
}
public record WorkflowListQuery():IBaseQuery<WorkflowListResponse>;
@@ -42,7 +43,7 @@ public class WorkflowListQueryHandler:IBaseQueryHandler<WorkflowListQuery,Workfl
{
var currentUserId = _authHelper.GetCurrentUserId()!.Value;
var items = new List<WorkflowListItem>();
var response = new WorkflowListResponse(items);
foreach (var provider in _providers)
{
var providerItems = await provider.GetItems(currentUserId, _context, cancellationToken);
@@ -50,7 +51,6 @@ public class WorkflowListQueryHandler:IBaseQueryHandler<WorkflowListQuery,Workfl
items.AddRange(providerItems);
}
var res = new WorkflowListResponse(items);
return OperationResult<WorkflowListResponse>.Success(res);
return OperationResult<WorkflowListResponse>.Success(response);
}
}

View File

@@ -22,7 +22,6 @@ public class ProjectTask : ProjectHierarchyNode
_sections = new List<TaskSection.TaskSection>();
BugSectionList = new List<BugSection>();
Priority = priority;
Priority = ProjectTaskPriority.Low;
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
}

View File

@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GozareshgirProgramManager.Infrastructure.Migrations
{
[DbContext(typeof(ProgramManagerDbContext))]
[Migration("20260127100843_BugSectioninit")]
partial class BugSectioninit
[Migration("20260127151807_Bug Section Init")]
partial class BugSectionInit
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace GozareshgirProgramManager.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class BugSectioninit : Migration
public partial class BugSectionInit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@@ -0,0 +1,24 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GozareshgirProgramManager.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class test : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GozareshgirProgramManager.Infrastructure.Migrations
{
[DbContext(typeof(ProgramManagerDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
partial class ProgramManagerDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
@@ -262,7 +262,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("BugSections", (string)null);
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -904,7 +904,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
{
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "ProjectTask")
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", "ProjectTask")
.WithMany("BugSectionList")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
@@ -939,7 +939,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("ProjectTask");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
{
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase")
.WithMany("PhaseSections")

View File

@@ -19,7 +19,7 @@
"sqlDebugging": true,
"dotnetRunMessages": "true",
"nativeDebugging": true,
"applicationUrl": "https://localhost:5004;http://localhost:5003;https://192.168.0.117:5006",
"applicationUrl": "https://localhost:5004;http://localhost:5003;",
"jsWebView2Debugging": false,
"hotReloadEnabled": true
},