mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Nudge users to become template creators if eligible (#8357)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Container from 'typedi';
|
||||
import { StatisticsNames, type WorkflowStatistics } from '@/databases/entities/WorkflowStatistics';
|
||||
import type { Workflow } from 'n8n-workflow';
|
||||
import { WorkflowStatisticsRepository } from '@/databases/repositories/workflowStatistics.repository';
|
||||
|
||||
export async function createWorkflowStatisticsItem(
|
||||
workflowId: Workflow['id'],
|
||||
data?: Partial<WorkflowStatistics>,
|
||||
) {
|
||||
const entity = Container.get(WorkflowStatisticsRepository).create({
|
||||
count: 0,
|
||||
latestEvent: new Date().toISOString(),
|
||||
name: StatisticsNames.manualSuccess,
|
||||
...(data ?? {}),
|
||||
workflowId,
|
||||
});
|
||||
|
||||
await Container.get(WorkflowStatisticsRepository).insert(entity);
|
||||
|
||||
return entity;
|
||||
}
|
||||
Reference in New Issue
Block a user