add bugsection Workflow

This commit is contained in:
gozareshgir
2026-01-27 18:39:59 +03:30
parent 6b81f383f6
commit 34d336f43e
4 changed files with 37 additions and 4 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

@@ -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

@@ -12,5 +12,6 @@ public enum FileCategory
Report = 5, // گزارش
Other = 6, // سایر
BugSection = 7, // تسک باگ
TaskSectionRevision
}

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
},