refactor(core): Continue moving typeorm operators to repositories (no-changelog) (#8186)

Follow-up to: #8163
This commit is contained in:
Iván Ovejero
2024-01-02 17:53:24 +01:00
committed by GitHub
parent 0ca2759d75
commit 40c1eeeddd
35 changed files with 341 additions and 354 deletions

View File

@@ -1,6 +1,5 @@
import { v4 as uuid } from 'uuid';
import { Container } from 'typedi';
import type { DeleteResult, InsertResult } from 'typeorm';
import type { INodeCredentials, MessageEventBusDestinationOptions } from 'n8n-workflow';
import { MessageEventBusDestinationTypeNames } from 'n8n-workflow';
import { Logger } from '@/Logger';
@@ -92,7 +91,7 @@ export abstract class MessageEventBusDestination implements MessageEventBusDesti
id: this.getId(),
destination: this.serialize(),
};
const dbResult: InsertResult = await Container.get(EventDestinationsRepository).upsert(data, {
const dbResult = await Container.get(EventDestinationsRepository).upsert(data, {
skipUpdateIfNoValuesChanged: true,
conflictPaths: ['id'],
});
@@ -103,7 +102,7 @@ export abstract class MessageEventBusDestination implements MessageEventBusDesti
return MessageEventBusDestination.deleteFromDb(this.getId());
}
static async deleteFromDb(id: string): Promise<DeleteResult> {
static async deleteFromDb(id: string) {
const dbResult = await Container.get(EventDestinationsRepository).delete({ id });
return dbResult;
}