deepsource-autofix-76c6eb20
Dan Gowans 2023-01-24 15:43:03 -05:00
parent c88e4912f8
commit 5b4a316aac
9 changed files with 14 additions and 11 deletions

View File

@ -25,7 +25,7 @@ function onError(error) {
}
function onListening(server) {
const addr = server.address();
if (addr) {
if (addr !== null) {
const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString();
debug('Listening on ' + bind);
}

View File

@ -50,7 +50,7 @@ function onError(error: ServerError): void {
function onListening(server: http.Server): void {
const addr = server.address()
if (addr) {
if (addr !== null) {
const bind =
typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port.toString()
debug('Listening on ' + bind)

View File

@ -8,7 +8,7 @@ export async function handler(_request, response) {
const occupancyTypePrintTitles = {};
for (const printEJS of occupancyTypePrints) {
const printConfig = printFunctions.getPrintConfig(printEJS);
if (printConfig) {
if (printConfig !== undefined) {
occupancyTypePrintTitles[printEJS] = printConfig.title;
}
}

View File

@ -24,7 +24,7 @@ export async function handler(
for (const printEJS of occupancyTypePrints) {
const printConfig = printFunctions.getPrintConfig(printEJS)
if (printConfig) {
if (printConfig !== undefined) {
occupancyTypePrintTitles[printEJS] = printConfig.title
}
}

View File

@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js'
import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js'
import * as cacheFunctions from '../../helpers/functions.cache.js'
import * as recordTypes from '../../types/recordTypes'
import type * as recordTypes from '../../types/recordTypes'
export async function handler(
request: Request,

View File

@ -1,3 +1,3 @@
import { Request, Response } from 'express';
import type { Request, Response } from 'express';
export declare function handler(request: Request, response: Response): Promise<void>;
export default handler;

View File

@ -1,4 +1,5 @@
import { Request, Response } from 'express'
import type { Request, Response } from 'express'
import { getLots } from '../../helpers/lotOccupancyDB/getLots.js'
export async function handler(request: Request, response: Response): Promise<void> {

View File

@ -51,7 +51,7 @@ export async function getReportData(printConfig, requestQuery) {
if (printConfig.params.includes('lotOccupancyId') &&
typeof requestQuery.lotOccupancyId === 'string') {
const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId);
if (lotOccupancy?.lotId) {
if ((lotOccupancy?.lotId ?? -1) !== -1) {
reportData.lot = getLot(lotOccupancy.lotId);
}
reportData.lotOccupancy = lotOccupancy;

View File

@ -18,7 +18,9 @@ const screenPrintConfigs: Record<string, PrintConfig> = {
}
}
export function getScreenPrintConfig(printName: string): PrintConfig | undefined {
export function getScreenPrintConfig(
printName: string
): PrintConfig | undefined {
return screenPrintConfigs[printName]
}
@ -78,8 +80,8 @@ export async function getReportData(
) {
const lotOccupancy = await getLotOccupancy(requestQuery.lotOccupancyId)
if (lotOccupancy?.lotId) {
reportData.lot = getLot(lotOccupancy.lotId)
if ((lotOccupancy?.lotId ?? -1) !== -1) {
reportData.lot = getLot(lotOccupancy!.lotId!)
}
reportData.lotOccupancy = lotOccupancy