mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Remove non-null assertions for Db collections (#3111)
* 📘 Remove unions to `null` * ⚡ Track `Db` initialization state * 🔥 Remove non-null assertions * 👕 Remove lint exceptions * 🔥 Remove leftover assertion
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable no-console */
|
||||
@@ -150,7 +149,7 @@ export class ImportCredentialsCommand extends Command {
|
||||
}
|
||||
|
||||
private async initOwnerCredentialRole() {
|
||||
const ownerCredentialRole = await Db.collections.Role!.findOne({
|
||||
const ownerCredentialRole = await Db.collections.Role.findOne({
|
||||
where: { name: 'owner', scope: 'credential' },
|
||||
});
|
||||
|
||||
@@ -180,11 +179,11 @@ export class ImportCredentialsCommand extends Command {
|
||||
}
|
||||
|
||||
private async getOwner() {
|
||||
const ownerGlobalRole = await Db.collections.Role!.findOne({
|
||||
const ownerGlobalRole = await Db.collections.Role.findOne({
|
||||
where: { name: 'owner', scope: 'global' },
|
||||
});
|
||||
|
||||
const owner = await Db.collections.User!.findOne({ globalRole: ownerGlobalRole });
|
||||
const owner = await Db.collections.User.findOne({ globalRole: ownerGlobalRole });
|
||||
|
||||
if (!owner) {
|
||||
throw new Error(`Failed to find owner. ${FIX_INSTRUCTION}`);
|
||||
@@ -194,7 +193,7 @@ export class ImportCredentialsCommand extends Command {
|
||||
}
|
||||
|
||||
private async getAssignee(userId: string) {
|
||||
const user = await Db.collections.User!.findOne(userId);
|
||||
const user = await Db.collections.User.findOne(userId);
|
||||
|
||||
if (!user) {
|
||||
throw new Error(`Failed to find user with ID ${userId}`);
|
||||
|
||||
Reference in New Issue
Block a user