[CLAUDE] App: Plan B Chunk E1 — CreateContractCommand +ApprovalWorkflowId V2 pin field
Mirror PE CreatePurchaseEvaluationCommand pattern. Drafter pick V2 workflow qua Workspace Select dropdown (Chunk D FE Implementer running parallel) → ApprovalWorkflowId pin lúc create. Fallback V1 auto activeWfId nếu null (7 prod contract giữ behavior). Changes: - CreateContractCommand record +Guid? ApprovalWorkflowId = null (optional) - Handler line 96 wire entity.ApprovalWorkflowId = request.ApprovalWorkflowId - Both V1 + V2 fields persist (Service ApproveV2Async branch dispatch theo V2 first) Verify: - dotnet build PASS 0 err - Backward compat: existing caller (KHÔNG pass ApprovalWorkflowId) → fallback null - V1 contract path UNCHANGED Plan B chain status: - A158898e8✅ Entity - A2a85e437✅ Mig 32 + Seed - B138469d✅ Service ApproveV2 branch - C26c98d3✅ Mig 33 LevelOpinions - B21f199b0✅ UPSERT block - E1 (this) ✅ CreateContractCommand +ApprovalWorkflowId - D FE Workspace V2 (Implementer running parallel) - E2 ContractDetailDto + GetContractByIdQuery extend (em main pending) - E3 FE Section 5 LevelOpinionsV2 (Implementer pending sau E2) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -27,7 +27,13 @@ public record CreateContractCommand(
|
|||||||
string? DraftData,
|
string? DraftData,
|
||||||
Guid? BudgetId,
|
Guid? BudgetId,
|
||||||
string? BudgetManualName,
|
string? BudgetManualName,
|
||||||
decimal? BudgetManualAmount) : IRequest<Guid>;
|
decimal? BudgetManualAmount,
|
||||||
|
// [Plan B S29 2026-05-22 Chunk E1] Drafter pick V2 workflow lúc create —
|
||||||
|
// mirror PE pattern Workspace Select dropdown. Nếu null → fallback V1 auto
|
||||||
|
// pick activeWfId (7 prod contract giữ behavior). Mutually exclusive với
|
||||||
|
// V1: pin V2 + V1 cùng lúc OK schema (cả 2 nullable) — Service ApproveV2Async
|
||||||
|
// branch ưu tiên V2 nếu cả 2 set.
|
||||||
|
Guid? ApprovalWorkflowId = null) : IRequest<Guid>;
|
||||||
|
|
||||||
public class CreateContractCommandValidator : AbstractValidator<CreateContractCommand>
|
public class CreateContractCommandValidator : AbstractValidator<CreateContractCommand>
|
||||||
{
|
{
|
||||||
@ -94,6 +100,10 @@ public class CreateContractCommandHandler(
|
|||||||
BudgetManualName = request.BudgetManualName,
|
BudgetManualName = request.BudgetManualName,
|
||||||
BudgetManualAmount = request.BudgetManualAmount,
|
BudgetManualAmount = request.BudgetManualAmount,
|
||||||
WorkflowDefinitionId = activeWfId,
|
WorkflowDefinitionId = activeWfId,
|
||||||
|
// [Plan B S29 2026-05-22 Chunk E1] Pin V2 workflow nếu Drafter pick
|
||||||
|
// qua Workspace Select dropdown (Chunk D FE). Cả 2 set ok — Service
|
||||||
|
// ApproveV2Async branch dispatch theo ApprovalWorkflowId trước.
|
||||||
|
ApprovalWorkflowId = request.ApprovalWorkflowId,
|
||||||
SlaDeadline = DateTime.UtcNow.Add(workflow.GetPhaseSla(ContractPhase.DangSoanThao) ?? TimeSpan.FromDays(7)),
|
SlaDeadline = DateTime.UtcNow.Add(workflow.GetPhaseSla(ContractPhase.DangSoanThao) ?? TimeSpan.FromDays(7)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user