Fix backend linting

This commit is contained in:
Jamie Curnow
2026-05-13 13:40:06 +10:00
parent c17475968f
commit 7d58c579fa
8 changed files with 25 additions and 25 deletions
+2 -2
View File
@@ -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);
}
+4 -4
View File
@@ -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);
}
+4 -4
View File
@@ -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) {
+4 -4
View File
@@ -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) {
+4 -4
View File
@@ -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) {
+4 -4
View File
@@ -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) {
+1 -1
View File
@@ -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