refactor(core): Continue moving typeorm operators to repositories (no-changelog) (#8212)
Follow-up to: https://github.com/n8n-io/n8n/pull/8186
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Service } from 'typedi';
|
||||
import type { FindOptionsWhere } from 'typeorm';
|
||||
import type { EntityManager, FindOptionsWhere } from 'typeorm';
|
||||
import { DataSource, In, Not, Repository } from 'typeorm';
|
||||
import { SharedCredentials } from '../entities/SharedCredentials';
|
||||
import type { User } from '../entities/User';
|
||||
@@ -60,4 +60,11 @@ export class SharedCredentialsRepository extends Repository<SharedCredentials> {
|
||||
|
||||
return this.find({ where });
|
||||
}
|
||||
|
||||
async deleteByIds(transaction: EntityManager, sharedCredentialsIds: string[], user?: User) {
|
||||
return transaction.delete(SharedCredentials, {
|
||||
user,
|
||||
credentialsId: In(sharedCredentialsIds),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user