mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-09-30 21:49:34 +02:00
30 lines
918 B
TypeScript
30 lines
918 B
TypeScript
import { Service } from '@n8n/di';
|
|
import { DataSource, In, Repository } from '@n8n/typeorm';
|
|
import type { EntityManager } from '@n8n/typeorm';
|
|
import type { QueryDeepPartialEntity } from '@n8n/typeorm/query-builder/QueryPartialEntity';
|
|
|
|
import { ExecutionData } from '../entities/execution-data';
|
|
|
|
@Service()
|
|
export class ExecutionDataRepository extends Repository<ExecutionData> {
|
|
constructor(dataSource: DataSource) {
|
|
super(ExecutionData, dataSource.manager);
|
|
}
|
|
|
|
async createExecutionDataForExecution(
|
|
data: QueryDeepPartialEntity<ExecutionData>,
|
|
transactionManager: EntityManager,
|
|
) {
|
|
return await transactionManager.insert(ExecutionData, data);
|
|
}
|
|
|
|
async findByExecutionIds(executionIds: string[]) {
|
|
return await this.find({
|
|
select: ['workflowData'],
|
|
where: {
|
|
executionId: In(executionIds),
|
|
},
|
|
}).then((executionData) => executionData.map(({ workflowData }) => workflowData));
|
|
}
|
|
}
|