mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
24 lines
794 B
TypeScript
24 lines
794 B
TypeScript
import { Service } from 'typedi';
|
|
import { ExecutionMetadataRepository } from '@db/repositories/executionMetadata.repository';
|
|
import type { ExecutionMetadata } from '@db/entities/ExecutionMetadata';
|
|
|
|
@Service()
|
|
export class ExecutionMetadataService {
|
|
constructor(private readonly executionMetadataRepository: ExecutionMetadataRepository) {}
|
|
|
|
async save(executionId: string, executionMetadata: Record<string, string>): Promise<void> {
|
|
const metadataRows: Array<Pick<ExecutionMetadata, 'executionId' | 'key' | 'value'>> = [];
|
|
for (const [key, value] of Object.entries(executionMetadata)) {
|
|
metadataRows.push({
|
|
executionId,
|
|
key,
|
|
value,
|
|
});
|
|
}
|
|
|
|
await this.executionMetadataRepository.upsert(metadataRows, {
|
|
conflictPaths: { executionId: true, key: true },
|
|
});
|
|
}
|
|
}
|