Context
An admin screen needs to take an approval template out of service: no new instances may be started from it, while instances already in flight finish on the workflow snapshot they were submitted with.
Current behaviour
TemplateService exposes activate / deactivate / delete for categories only:
activateApprovalTemplateCategory(id)
deactivateApprovalTemplateCategory(id)
deleteApprovalTemplateCategory(id)
For templates themselves there is no equivalent. ApprovalTemplateEntity has a deletedAt column but no service method sets it, and there is no isActive / status field. listApprovalTemplates({ status }) filters by ApprovalTemplateListStatusEnum (DRAFT / PUBLISHED), which is derived from version state rather than from an explicit lifecycle flag.
Why this matters
The only host-side approximations are both lossy:
- Archive the published version. Blocks submission, but the version history now reads as if the template were never in service, and re-activating means republishing — which produces a new version number for a change that was purely administrative.
- Keep a separate "deactivated template" list in the host. Works, but it is a second source of truth for template lifecycle sitting outside the library that owns templates.
Suggested fix
Add an explicit lifecycle flag on the template plus the two service methods:
deactivateApprovalTemplate(id: string): Promise<ApprovalTemplateEntity>;
activateApprovalTemplate(id: string): Promise<ApprovalTemplateEntity>;
with submitApprovalInstance rejecting a deactivated template, and in-flight instances unaffected (they already run from workflowSnapshot).
Context
An admin screen needs to take an approval template out of service: no new instances may be started from it, while instances already in flight finish on the workflow snapshot they were submitted with.
Current behaviour
TemplateServiceexposes activate / deactivate / delete for categories only:For templates themselves there is no equivalent.
ApprovalTemplateEntityhas adeletedAtcolumn but no service method sets it, and there is noisActive/ status field.listApprovalTemplates({ status })filters byApprovalTemplateListStatusEnum(DRAFT/PUBLISHED), which is derived from version state rather than from an explicit lifecycle flag.Why this matters
The only host-side approximations are both lossy:
Suggested fix
Add an explicit lifecycle flag on the template plus the two service methods:
with
submitApprovalInstancerejecting a deactivated template, and in-flight instances unaffected (they already run fromworkflowSnapshot).