mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-05-18 14:49:36 +01:00
Fix backend linting
This commit is contained in:
@@ -241,7 +241,7 @@ const internalAccessList = {
|
||||
|
||||
let row = await query.then(utils.omitRow(omissions()));
|
||||
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(thisData.id);
|
||||
}
|
||||
if (!skipMasking && typeof row.items !== "undefined" && row.items) {
|
||||
@@ -268,7 +268,7 @@ const internalAccessList = {
|
||||
expand: ["proxy_hosts", "items", "clients"],
|
||||
});
|
||||
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ const internalCertificate = {
|
||||
.andWhere("provider", "letsencrypt")
|
||||
.andWhere("expires_on", "<", expirationThreshold)
|
||||
.then((certificates) => {
|
||||
if (!certificates || !certificates.length) {
|
||||
if (!certificates?.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ const internalCertificate = {
|
||||
await internalCertificate.disableInUseHosts(inUseResult);
|
||||
|
||||
const user = await userModel.query().where("is_deleted", 0).andWhere("id", data.owner_user_id).first();
|
||||
if (!user || !user.email) {
|
||||
if (!user?.email) {
|
||||
throw new error.ValidationError(
|
||||
"A valid email address must be set on your user account to use Let's Encrypt",
|
||||
);
|
||||
@@ -305,7 +305,7 @@ const internalCertificate = {
|
||||
}
|
||||
|
||||
const row = await query.then(utils.omitRow(omissions()));
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new error.ItemNotFoundError(data.id);
|
||||
}
|
||||
// Custom omissions
|
||||
@@ -397,7 +397,7 @@ const internalCertificate = {
|
||||
await access.can("certificates:delete", data.id);
|
||||
const row = await internalCertificate.get(access, { id: data.id });
|
||||
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new error.ItemNotFoundError(data.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ const internalDeadHost = {
|
||||
}
|
||||
|
||||
const row = await query.then(utils.omitRow(omissions()));
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
// Custom omissions
|
||||
@@ -226,7 +226,7 @@ const internalDeadHost = {
|
||||
delete: async (access, data) => {
|
||||
await access.can("dead_hosts:delete", data.id)
|
||||
const row = await internalDeadHost.get(access, { id: data.id });
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ const internalDeadHost = {
|
||||
id: data.id,
|
||||
expand: ["certificate", "owner"],
|
||||
});
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (row.enabled) {
|
||||
@@ -303,7 +303,7 @@ const internalDeadHost = {
|
||||
disable: async (access, data) => {
|
||||
await access.can("dead_hosts:update", data.id)
|
||||
const row = await internalDeadHost.get(access, { id: data.id });
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (!row.enabled) {
|
||||
|
||||
@@ -253,7 +253,7 @@ const internalProxyHost = {
|
||||
return query.then(utils.omitRow(omissions()));
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(thisData.id);
|
||||
}
|
||||
const thisRow = internalHost.cleanRowCertificateMeta(row);
|
||||
@@ -279,7 +279,7 @@ const internalProxyHost = {
|
||||
return internalProxyHost.get(access, { id: data.id });
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ const internalProxyHost = {
|
||||
});
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (row.enabled) {
|
||||
@@ -375,7 +375,7 @@ const internalProxyHost = {
|
||||
return internalProxyHost.get(access, { id: data.id });
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (!row.enabled) {
|
||||
|
||||
@@ -251,7 +251,7 @@ const internalRedirectionHost = {
|
||||
})
|
||||
.then((row) => {
|
||||
let thisRow = row;
|
||||
if (!thisRow || !thisRow.id) {
|
||||
if (!thisRow?.id) {
|
||||
throw new errs.ItemNotFoundError(thisData.id);
|
||||
}
|
||||
thisRow = internalHost.cleanRowCertificateMeta(thisRow);
|
||||
@@ -277,7 +277,7 @@ const internalRedirectionHost = {
|
||||
return internalRedirectionHost.get(access, { id: data.id });
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ const internalRedirectionHost = {
|
||||
});
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (row.enabled) {
|
||||
@@ -373,7 +373,7 @@ const internalRedirectionHost = {
|
||||
return internalRedirectionHost.get(access, { id: data.id });
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (!row.enabled) {
|
||||
|
||||
@@ -200,7 +200,7 @@ const internalStream = {
|
||||
})
|
||||
.then((row) => {
|
||||
let thisRow = row;
|
||||
if (!thisRow || !thisRow.id) {
|
||||
if (!thisRow?.id) {
|
||||
throw new errs.ItemNotFoundError(thisData.id);
|
||||
}
|
||||
thisRow = internalHost.cleanRowCertificateMeta(thisRow);
|
||||
@@ -226,7 +226,7 @@ const internalStream = {
|
||||
return internalStream.get(access, { id: data.id });
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ const internalStream = {
|
||||
});
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (row.enabled) {
|
||||
@@ -322,7 +322,7 @@ const internalStream = {
|
||||
return internalStream.get(access, { id: data.id });
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(data.id);
|
||||
}
|
||||
if (!row.enabled) {
|
||||
|
||||
@@ -171,7 +171,7 @@ const internalUser = {
|
||||
return query.then(utils.omitRow(omissions()));
|
||||
})
|
||||
.then((row) => {
|
||||
if (!row || !row.id) {
|
||||
if (!row?.id) {
|
||||
throw new errs.ItemNotFoundError(thisData.id);
|
||||
}
|
||||
// Custom omissions
|
||||
|
||||
@@ -10,7 +10,7 @@ const migrateName = "trust_forwarded_proto";
|
||||
* @param {Object} knex
|
||||
* @returns {Promise}
|
||||
*/
|
||||
const up = function (knex) {
|
||||
const up = (knex) => {
|
||||
logger.info(`[${migrateName}] Migrating Up...`);
|
||||
|
||||
return knex.schema
|
||||
@@ -28,7 +28,7 @@ const up = function (knex) {
|
||||
* @param {Object} knex
|
||||
* @returns {Promise}
|
||||
*/
|
||||
const down = function (knex) {
|
||||
const down = (knex) => {
|
||||
logger.info(`[${migrateName}] Migrating Down...`);
|
||||
|
||||
return knex.schema
|
||||
|
||||
Reference in New Issue
Block a user