linting
parent
5276c7e962
commit
285704daab
4
app.ts
4
app.ts
|
|
@ -1,5 +1,5 @@
|
||||||
import createError from 'http-errors'
|
import createError from 'http-errors'
|
||||||
import express from 'express'
|
import express, { RequestHandler } from 'express'
|
||||||
|
|
||||||
import compression from 'compression'
|
import compression from 'compression'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|
@ -233,7 +233,7 @@ app.get(urlPrefix + '/', sessionChecker, (_request, response) => {
|
||||||
|
|
||||||
app.use(urlPrefix + '/dashboard', sessionChecker, routerDashboard)
|
app.use(urlPrefix + '/dashboard', sessionChecker, routerDashboard)
|
||||||
|
|
||||||
app.use(urlPrefix + '/api/:apiKey', apiGetHandler, routerApi)
|
app.use(urlPrefix + '/api/:apiKey', apiGetHandler as RequestHandler, routerApi)
|
||||||
|
|
||||||
app.use(urlPrefix + '/print', sessionChecker, routerPrint)
|
app.use(urlPrefix + '/print', sessionChecker, routerPrint)
|
||||||
app.use(urlPrefix + '/maps', sessionChecker, routerMaps)
|
app.use(urlPrefix + '/maps', sessionChecker, routerMaps)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { getLotTypeSummary } from '../../helpers/lotOccupancyDB/getLotTypeSummar
|
||||||
import { getLotStatusSummary } from '../../helpers/lotOccupancyDB/getLotStatusSummary.js';
|
import { getLotStatusSummary } from '../../helpers/lotOccupancyDB/getLotStatusSummary.js';
|
||||||
export async function handler(request, response) {
|
export async function handler(request, response) {
|
||||||
const map = await getMap(request.params.mapId);
|
const map = await getMap(request.params.mapId);
|
||||||
if (!map) {
|
if (map === undefined) {
|
||||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||||
'/maps/?error=mapIdNotFound');
|
'/maps/?error=mapIdNotFound');
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export async function handler(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const map = await getMap(request.params.mapId)
|
const map = await getMap(request.params.mapId)
|
||||||
|
|
||||||
if (!map) {
|
if (map === undefined) {
|
||||||
response.redirect(
|
response.redirect(
|
||||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||||
'/maps/?error=mapIdNotFound'
|
'/maps/?error=mapIdNotFound'
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { getLotStatusSummary } from '../../helpers/lotOccupancyDB/getLotStatusSu
|
||||||
import { getLotTypeSummary } from '../../helpers/lotOccupancyDB/getLotTypeSummary.js';
|
import { getLotTypeSummary } from '../../helpers/lotOccupancyDB/getLotTypeSummary.js';
|
||||||
export async function handler(request, response) {
|
export async function handler(request, response) {
|
||||||
const map = await getMap(request.params.mapId);
|
const map = await getMap(request.params.mapId);
|
||||||
if (!map) {
|
if (map === undefined) {
|
||||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||||
'/maps/?error=mapIdNotFound');
|
'/maps/?error=mapIdNotFound');
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import { getLotTypeSummary } from '../../helpers/lotOccupancyDB/getLotTypeSummar
|
||||||
export async function handler(request: Request, response: Response): Promise<void> {
|
export async function handler(request: Request, response: Response): Promise<void> {
|
||||||
const map = await getMap(request.params.mapId)
|
const map = await getMap(request.params.mapId)
|
||||||
|
|
||||||
if (!map) {
|
if (map === undefined) {
|
||||||
response.redirect(
|
response.redirect(
|
||||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||||
'/maps/?error=mapIdNotFound'
|
'/maps/?error=mapIdNotFound'
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ async function saveApiKeys() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function generateApiKey(apiKeyPrefix) {
|
function generateApiKey(apiKeyPrefix) {
|
||||||
return `${apiKeyPrefix}-${uuidv4()}-${Date.now()}`;
|
return `${apiKeyPrefix}-${uuidv4()}-${Date.now().toString()}`;
|
||||||
}
|
}
|
||||||
export async function regenerateApiKey(userName) {
|
export async function regenerateApiKey(userName) {
|
||||||
apiKeys[userName] = generateApiKey(userName);
|
apiKeys[userName] = generateApiKey(userName);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ async function saveApiKeys(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateApiKey(apiKeyPrefix: string): string {
|
function generateApiKey(apiKeyPrefix: string): string {
|
||||||
return `${apiKeyPrefix}-${uuidv4()}-${Date.now()}`
|
return `${apiKeyPrefix}-${uuidv4()}-${Date.now().toString()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function regenerateApiKey(userName: string): Promise<void> {
|
export async function regenerateApiKey(userName: string): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export async function addLot(lotForm, requestSession) {
|
||||||
const lotTypeFieldIds = (lotForm.lotTypeFieldIds ?? '').split(',');
|
const lotTypeFieldIds = (lotForm.lotTypeFieldIds ?? '').split(',');
|
||||||
for (const lotTypeFieldId of lotTypeFieldIds) {
|
for (const lotTypeFieldId of lotTypeFieldIds) {
|
||||||
const lotFieldValue = lotForm['lotFieldValue_' + lotTypeFieldId];
|
const lotFieldValue = lotForm['lotFieldValue_' + lotTypeFieldId];
|
||||||
if (lotFieldValue && lotFieldValue !== '') {
|
if ((lotFieldValue ?? '') !== '') {
|
||||||
await addOrUpdateLotField({
|
await addOrUpdateLotField({
|
||||||
lotId,
|
lotId,
|
||||||
lotTypeFieldId,
|
lotTypeFieldId,
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export async function addLot(
|
||||||
for (const lotTypeFieldId of lotTypeFieldIds) {
|
for (const lotTypeFieldId of lotTypeFieldIds) {
|
||||||
const lotFieldValue = lotForm['lotFieldValue_' + lotTypeFieldId] as string
|
const lotFieldValue = lotForm['lotFieldValue_' + lotTypeFieldId] as string
|
||||||
|
|
||||||
if (lotFieldValue && lotFieldValue !== '') {
|
if ((lotFieldValue ?? '') !== '') {
|
||||||
await addOrUpdateLotField(
|
await addOrUpdateLotField(
|
||||||
{
|
{
|
||||||
lotId,
|
lotId,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export async function addLotOccupancy(lotOccupancyForm, requestSession, connecte
|
||||||
const occupancyTypeFieldIds = (lotOccupancyForm.occupancyTypeFieldIds ?? '').split(',');
|
const occupancyTypeFieldIds = (lotOccupancyForm.occupancyTypeFieldIds ?? '').split(',');
|
||||||
for (const occupancyTypeFieldId of occupancyTypeFieldIds) {
|
for (const occupancyTypeFieldId of occupancyTypeFieldIds) {
|
||||||
const lotOccupancyFieldValue = lotOccupancyForm['lotOccupancyFieldValue_' + occupancyTypeFieldId];
|
const lotOccupancyFieldValue = lotOccupancyForm['lotOccupancyFieldValue_' + occupancyTypeFieldId];
|
||||||
if (lotOccupancyFieldValue && lotOccupancyFieldValue !== '') {
|
if ((lotOccupancyFieldValue ?? '') !== '') {
|
||||||
await addOrUpdateLotOccupancyField({
|
await addOrUpdateLotOccupancyField({
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
occupancyTypeFieldId,
|
occupancyTypeFieldId,
|
||||||
|
|
@ -31,7 +31,7 @@ export async function addLotOccupancy(lotOccupancyForm, requestSession, connecte
|
||||||
}, requestSession, database);
|
}, requestSession, database);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lotOccupancyForm.lotOccupantTypeId) {
|
if ((lotOccupancyForm.lotOccupantTypeId ?? '') !== '') {
|
||||||
await addLotOccupancyOccupant({
|
await addLotOccupancyOccupant({
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId,
|
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId,
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ export async function addLotOccupancy(
|
||||||
'lotOccupancyFieldValue_' + occupancyTypeFieldId
|
'lotOccupancyFieldValue_' + occupancyTypeFieldId
|
||||||
] as string
|
] as string
|
||||||
|
|
||||||
if (lotOccupancyFieldValue && lotOccupancyFieldValue !== '') {
|
if ((lotOccupancyFieldValue ?? '') !== '') {
|
||||||
await addOrUpdateLotOccupancyField(
|
await addOrUpdateLotOccupancyField(
|
||||||
{
|
{
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
|
|
@ -96,11 +96,11 @@ export async function addLotOccupancy(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lotOccupancyForm.lotOccupantTypeId) {
|
if ((lotOccupancyForm.lotOccupantTypeId ?? '') !== '') {
|
||||||
await addLotOccupancyOccupant(
|
await addLotOccupancyOccupant(
|
||||||
{
|
{
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId,
|
lotOccupantTypeId: lotOccupancyForm.lotOccupantTypeId!,
|
||||||
occupantName: lotOccupancyForm.occupantName!,
|
occupantName: lotOccupancyForm.occupantName!,
|
||||||
occupantAddress1: lotOccupancyForm.occupantAddress1!,
|
occupantAddress1: lotOccupancyForm.occupantAddress1!,
|
||||||
occupantAddress2: lotOccupancyForm.occupantAddress2!,
|
occupantAddress2: lotOccupancyForm.occupantAddress2!,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ export async function addLotOccupancyOccupant(lotOccupancyOccupantForm, requestS
|
||||||
order by lotOccupantIndex desc
|
order by lotOccupantIndex desc
|
||||||
limit 1`)
|
limit 1`)
|
||||||
.get(lotOccupancyOccupantForm.lotOccupancyId);
|
.get(lotOccupancyOccupantForm.lotOccupancyId);
|
||||||
if (maxIndexResult) {
|
if (maxIndexResult !== undefined) {
|
||||||
lotOccupantIndex = maxIndexResult.lotOccupantIndex + 1;
|
lotOccupantIndex = maxIndexResult.lotOccupantIndex + 1;
|
||||||
}
|
}
|
||||||
const rightNowMillis = Date.now();
|
const rightNowMillis = Date.now();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export async function addLotOccupancyOccupant(
|
||||||
)
|
)
|
||||||
.get(lotOccupancyOccupantForm.lotOccupancyId)
|
.get(lotOccupancyOccupantForm.lotOccupancyId)
|
||||||
|
|
||||||
if (maxIndexResult) {
|
if (maxIndexResult !== undefined) {
|
||||||
lotOccupantIndex = maxIndexResult.lotOccupantIndex + 1
|
lotOccupantIndex = maxIndexResult.lotOccupantIndex + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export async function addLotOccupancyTransaction(lotOccupancyTransactionForm, re
|
||||||
order by transactionIndex desc
|
order by transactionIndex desc
|
||||||
limit 1`)
|
limit 1`)
|
||||||
.get(lotOccupancyTransactionForm.lotOccupancyId);
|
.get(lotOccupancyTransactionForm.lotOccupancyId);
|
||||||
if (maxIndexResult) {
|
if (maxIndexResult !== undefined) {
|
||||||
transactionIndex = maxIndexResult.transactionIndex + 1;
|
transactionIndex = maxIndexResult.transactionIndex + 1;
|
||||||
}
|
}
|
||||||
const rightNow = new Date();
|
const rightNow = new Date();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export async function addLotOccupancyTransaction(
|
||||||
)
|
)
|
||||||
.get(lotOccupancyTransactionForm.lotOccupancyId)
|
.get(lotOccupancyTransactionForm.lotOccupancyId)
|
||||||
|
|
||||||
if (maxIndexResult) {
|
if (maxIndexResult !== undefined) {
|
||||||
transactionIndex = maxIndexResult.transactionIndex + 1
|
transactionIndex = maxIndexResult.transactionIndex + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import sqlite from 'better-sqlite3'
|
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
import type * as recordTypes from '../../types/recordTypes'
|
import type * as recordTypes from '../../types/recordTypes'
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,16 @@ export async function addWorkOrderLot(workOrderLotForm, requestSession) {
|
||||||
where workOrderId = ?
|
where workOrderId = ?
|
||||||
and lotId = ?`)
|
and lotId = ?`)
|
||||||
.get(workOrderLotForm.workOrderId, workOrderLotForm.lotId);
|
.get(workOrderLotForm.workOrderId, workOrderLotForm.lotId);
|
||||||
if (row) {
|
if (row === undefined) {
|
||||||
|
database
|
||||||
|
.prepare(`insert into WorkOrderLots (
|
||||||
|
workOrderId, lotId,
|
||||||
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
|
values (?, ?, ?, ?, ?, ?)`)
|
||||||
|
.run(workOrderLotForm.workOrderId, workOrderLotForm.lotId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (row.recordDelete_timeMillis) {
|
if (row.recordDelete_timeMillis) {
|
||||||
database
|
database
|
||||||
.prepare(`update WorkOrderLots
|
.prepare(`update WorkOrderLots
|
||||||
|
|
@ -23,15 +32,6 @@ export async function addWorkOrderLot(workOrderLotForm, requestSession) {
|
||||||
.run(requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis, workOrderLotForm.workOrderId, workOrderLotForm.lotId);
|
.run(requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis, workOrderLotForm.workOrderId, workOrderLotForm.lotId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
database
|
|
||||||
.prepare(`insert into WorkOrderLots (
|
|
||||||
workOrderId, lotId,
|
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
|
||||||
values (?, ?, ?, ?, ?, ?)`)
|
|
||||||
.run(workOrderLotForm.workOrderId, workOrderLotForm.lotId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
|
||||||
}
|
|
||||||
database.release();
|
database.release();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,24 @@ export async function addWorkOrderLot(
|
||||||
)
|
)
|
||||||
.get(workOrderLotForm.workOrderId, workOrderLotForm.lotId)
|
.get(workOrderLotForm.workOrderId, workOrderLotForm.lotId)
|
||||||
|
|
||||||
if (row) {
|
if (row === undefined) {
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`insert into WorkOrderLots (
|
||||||
|
workOrderId, lotId,
|
||||||
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
|
values (?, ?, ?, ?, ?, ?)`
|
||||||
|
)
|
||||||
|
.run(
|
||||||
|
workOrderLotForm.workOrderId,
|
||||||
|
workOrderLotForm.lotId,
|
||||||
|
requestSession.user!.userName,
|
||||||
|
rightNowMillis,
|
||||||
|
requestSession.user!.userName,
|
||||||
|
rightNowMillis
|
||||||
|
)
|
||||||
|
} else {
|
||||||
if (row.recordDelete_timeMillis) {
|
if (row.recordDelete_timeMillis) {
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
|
|
@ -47,23 +64,6 @@ export async function addWorkOrderLot(
|
||||||
workOrderLotForm.lotId
|
workOrderLotForm.lotId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
database
|
|
||||||
.prepare(
|
|
||||||
`insert into WorkOrderLots (
|
|
||||||
workOrderId, lotId,
|
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
|
||||||
values (?, ?, ?, ?, ?, ?)`
|
|
||||||
)
|
|
||||||
.run(
|
|
||||||
workOrderLotForm.workOrderId,
|
|
||||||
workOrderLotForm.lotId,
|
|
||||||
requestSession.user!.userName,
|
|
||||||
rightNowMillis,
|
|
||||||
requestSession.user!.userName,
|
|
||||||
rightNowMillis
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
database.release()
|
database.release()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,16 @@ export async function addWorkOrderLotOccupancy(workOrderLotOccupancyForm, reques
|
||||||
where workOrderId = ?
|
where workOrderId = ?
|
||||||
and lotOccupancyId = ?`)
|
and lotOccupancyId = ?`)
|
||||||
.get(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId);
|
.get(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId);
|
||||||
if (row) {
|
if (row === undefined) {
|
||||||
|
database
|
||||||
|
.prepare(`insert into WorkOrderLotOccupancies (
|
||||||
|
workOrderId, lotOccupancyId,
|
||||||
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
|
values (?, ?, ?, ?, ?, ?)`)
|
||||||
|
.run(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (row.recordDelete_timeMillis) {
|
if (row.recordDelete_timeMillis) {
|
||||||
database
|
database
|
||||||
.prepare(`update WorkOrderLotOccupancies
|
.prepare(`update WorkOrderLotOccupancies
|
||||||
|
|
@ -23,15 +32,6 @@ export async function addWorkOrderLotOccupancy(workOrderLotOccupancyForm, reques
|
||||||
.run(requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis, workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId);
|
.run(requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis, workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
database
|
|
||||||
.prepare(`insert into WorkOrderLotOccupancies (
|
|
||||||
workOrderId, lotOccupancyId,
|
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
|
||||||
values (?, ?, ?, ?, ?, ?)`)
|
|
||||||
.run(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
|
||||||
}
|
|
||||||
if (connectedDatabase === undefined) {
|
if (connectedDatabase === undefined) {
|
||||||
database.release();
|
database.release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,24 @@ export async function addWorkOrderLotOccupancy(
|
||||||
workOrderLotOccupancyForm.lotOccupancyId
|
workOrderLotOccupancyForm.lotOccupancyId
|
||||||
)
|
)
|
||||||
|
|
||||||
if (row) {
|
if (row === undefined) {
|
||||||
|
database
|
||||||
|
.prepare(
|
||||||
|
`insert into WorkOrderLotOccupancies (
|
||||||
|
workOrderId, lotOccupancyId,
|
||||||
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
|
values (?, ?, ?, ?, ?, ?)`
|
||||||
|
)
|
||||||
|
.run(
|
||||||
|
workOrderLotOccupancyForm.workOrderId,
|
||||||
|
workOrderLotOccupancyForm.lotOccupancyId,
|
||||||
|
requestSession.user!.userName,
|
||||||
|
rightNowMillis,
|
||||||
|
requestSession.user!.userName,
|
||||||
|
rightNowMillis
|
||||||
|
)
|
||||||
|
} else {
|
||||||
if (row.recordDelete_timeMillis) {
|
if (row.recordDelete_timeMillis) {
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
|
|
@ -52,23 +69,6 @@ export async function addWorkOrderLotOccupancy(
|
||||||
workOrderLotOccupancyForm.lotOccupancyId
|
workOrderLotOccupancyForm.lotOccupancyId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
database
|
|
||||||
.prepare(
|
|
||||||
`insert into WorkOrderLotOccupancies (
|
|
||||||
workOrderId, lotOccupancyId,
|
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
|
||||||
values (?, ?, ?, ?, ?, ?)`
|
|
||||||
)
|
|
||||||
.run(
|
|
||||||
workOrderLotOccupancyForm.workOrderId,
|
|
||||||
workOrderLotOccupancyForm.lotOccupancyId,
|
|
||||||
requestSession.user!.userName,
|
|
||||||
rightNowMillis,
|
|
||||||
requestSession.user!.userName,
|
|
||||||
rightNowMillis
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectedDatabase === undefined) {
|
if (connectedDatabase === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
/* eslint-disable @typescript-eslint/indent */
|
/* eslint-disable @typescript-eslint/indent */
|
||||||
|
|
||||||
import sqlite from 'better-sqlite3'
|
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export async function getFeeCategories(filters, options) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
if (filters.occupancyTypeId) {
|
if ((filters.occupancyTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and feeCategoryId in (' +
|
' and feeCategoryId in (' +
|
||||||
'select feeCategoryId from Fees' +
|
'select feeCategoryId from Fees' +
|
||||||
|
|
@ -14,7 +14,7 @@ export async function getFeeCategories(filters, options) {
|
||||||
' and (occupancyTypeId is null or occupancyTypeId = ?))';
|
' and (occupancyTypeId is null or occupancyTypeId = ?))';
|
||||||
sqlParameters.push(filters.occupancyTypeId);
|
sqlParameters.push(filters.occupancyTypeId);
|
||||||
}
|
}
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and feeCategoryId in (' +
|
' and feeCategoryId in (' +
|
||||||
'select feeCategoryId from Fees' +
|
'select feeCategoryId from Fees' +
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export async function getFeeCategories(
|
||||||
|
|
||||||
const sqlParameters: unknown[] = []
|
const sqlParameters: unknown[] = []
|
||||||
|
|
||||||
if (filters.occupancyTypeId) {
|
if ((filters.occupancyTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and feeCategoryId in (' +
|
' and feeCategoryId in (' +
|
||||||
'select feeCategoryId from Fees' +
|
'select feeCategoryId from Fees' +
|
||||||
|
|
@ -37,7 +37,7 @@ export async function getFeeCategories(
|
||||||
sqlParameters.push(filters.occupancyTypeId)
|
sqlParameters.push(filters.occupancyTypeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and feeCategoryId in (' +
|
' and feeCategoryId in (' +
|
||||||
'select feeCategoryId from Fees' +
|
'select feeCategoryId from Fees' +
|
||||||
|
|
@ -76,7 +76,11 @@ export async function getFeeCategories(
|
||||||
|
|
||||||
expectedOrderNumber += 1
|
expectedOrderNumber += 1
|
||||||
|
|
||||||
feeCategory.fees = await getFees(feeCategory.feeCategoryId, filters, database)
|
feeCategory.fees = await getFees(
|
||||||
|
feeCategory.feeCategoryId,
|
||||||
|
filters,
|
||||||
|
database
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import sqlite from 'better-sqlite3'
|
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import type { PoolConnection } from 'better-sqlite-pool'
|
import type { PoolConnection } from 'better-sqlite-pool'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const baseSQL = `select l.lotId, l.lotTypeId, t.lotType, l.lotName, l.lotStatusI
|
||||||
async function _getLot(sql, lotIdOrLotName) {
|
async function _getLot(sql, lotIdOrLotName) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const lot = database.prepare(sql).get(lotIdOrLotName);
|
const lot = database.prepare(sql).get(lotIdOrLotName);
|
||||||
if (lot) {
|
if (lot !== undefined) {
|
||||||
const lotOccupancies = await getLotOccupancies({
|
const lotOccupancies = await getLotOccupancies({
|
||||||
lotId: lot.lotId
|
lotId: lot.lotId
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ async function _getLot(
|
||||||
|
|
||||||
const lot: recordTypes.Lot = database.prepare(sql).get(lotIdOrLotName)
|
const lot: recordTypes.Lot = database.prepare(sql).get(lotIdOrLotName)
|
||||||
|
|
||||||
if (lot) {
|
if (lot !== undefined) {
|
||||||
const lotOccupancies = await getLotOccupancies(
|
const lotOccupancies = await getLotOccupancies(
|
||||||
{
|
{
|
||||||
lotId: lot.lotId
|
lotId: lot.lotId
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { getLotNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWher
|
||||||
function buildWhereClause(filters) {
|
function buildWhereClause(filters) {
|
||||||
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
if (filters.lotId) {
|
if ((filters.lotId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and o.lotId = ?';
|
sqlWhereClause += ' and o.lotId = ?';
|
||||||
sqlParameters.push(filters.lotId);
|
sqlParameters.push(filters.lotId);
|
||||||
}
|
}
|
||||||
|
|
@ -22,36 +22,36 @@ function buildWhereClause(filters) {
|
||||||
')';
|
')';
|
||||||
sqlParameters.push(...occupantNameFilters.sqlParameters);
|
sqlParameters.push(...occupantNameFilters.sqlParameters);
|
||||||
}
|
}
|
||||||
if (filters.occupancyTypeId) {
|
if ((filters.occupancyTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and o.occupancyTypeId = ?';
|
sqlWhereClause += ' and o.occupancyTypeId = ?';
|
||||||
sqlParameters.push(filters.occupancyTypeId);
|
sqlParameters.push(filters.occupancyTypeId);
|
||||||
}
|
}
|
||||||
const occupancyTimeFilters = getOccupancyTimeWhereClause(filters.occupancyTime ?? '', 'o');
|
const occupancyTimeFilters = getOccupancyTimeWhereClause(filters.occupancyTime ?? '', 'o');
|
||||||
sqlWhereClause += occupancyTimeFilters.sqlWhereClause;
|
sqlWhereClause += occupancyTimeFilters.sqlWhereClause;
|
||||||
sqlParameters.push(...occupancyTimeFilters.sqlParameters);
|
sqlParameters.push(...occupancyTimeFilters.sqlParameters);
|
||||||
if (filters.occupancyStartDateString) {
|
if ((filters.occupancyStartDateString ?? '') !== '') {
|
||||||
sqlWhereClause += ' and o.occupancyStartDate = ?';
|
sqlWhereClause += ' and o.occupancyStartDate = ?';
|
||||||
sqlParameters.push(dateStringToInteger(filters.occupancyStartDateString));
|
sqlParameters.push(dateStringToInteger(filters.occupancyStartDateString));
|
||||||
}
|
}
|
||||||
if (filters.occupancyEffectiveDateString) {
|
if ((filters.occupancyEffectiveDateString ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and (o.occupancyStartDate <= ? and (o.occupancyEndDate is null or o.occupancyEndDate >= ?))';
|
' and (o.occupancyStartDate <= ? and (o.occupancyEndDate is null or o.occupancyEndDate >= ?))';
|
||||||
sqlParameters.push(dateStringToInteger(filters.occupancyEffectiveDateString), dateStringToInteger(filters.occupancyEffectiveDateString));
|
sqlParameters.push(dateStringToInteger(filters.occupancyEffectiveDateString), dateStringToInteger(filters.occupancyEffectiveDateString));
|
||||||
}
|
}
|
||||||
if (filters.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?';
|
sqlWhereClause += ' and l.mapId = ?';
|
||||||
sqlParameters.push(filters.mapId);
|
sqlParameters.push(filters.mapId);
|
||||||
}
|
}
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotTypeId = ?';
|
sqlWhereClause += ' and l.lotTypeId = ?';
|
||||||
sqlParameters.push(filters.lotTypeId);
|
sqlParameters.push(filters.lotTypeId);
|
||||||
}
|
}
|
||||||
if (filters.workOrderId) {
|
if ((filters.workOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and o.lotOccupancyId in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)';
|
' and o.lotOccupancyId in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)';
|
||||||
sqlParameters.push(filters.workOrderId);
|
sqlParameters.push(filters.workOrderId);
|
||||||
}
|
}
|
||||||
if (filters.notWorkOrderId) {
|
if ((filters.notWorkOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and o.lotOccupancyId not in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)';
|
' and o.lotOccupancyId not in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)';
|
||||||
sqlParameters.push(filters.notWorkOrderId);
|
sqlParameters.push(filters.notWorkOrderId);
|
||||||
|
|
@ -98,7 +98,7 @@ export async function getLotOccupancies(filters, options, connectedDatabase) {
|
||||||
}
|
}
|
||||||
for (const lotOccupancy of lotOccupancies) {
|
for (const lotOccupancy of lotOccupancies) {
|
||||||
const occupancyType = await getOccupancyTypeById(lotOccupancy.occupancyTypeId);
|
const occupancyType = await getOccupancyTypeById(lotOccupancy.occupancyTypeId);
|
||||||
if (occupancyType) {
|
if (occupancyType !== undefined) {
|
||||||
lotOccupancy.printEJS = (occupancyType.occupancyTypePrints ?? []).includes('*')
|
lotOccupancy.printEJS = (occupancyType.occupancyTypePrints ?? []).includes('*')
|
||||||
? configFunctions.getProperty('settings.lotOccupancy.prints')[0]
|
? configFunctions.getProperty('settings.lotOccupancy.prints')[0]
|
||||||
: occupancyType.occupancyTypePrints[0];
|
: occupancyType.occupancyTypePrints[0];
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ function buildWhereClause(filters: GetLotOccupanciesFilters): {
|
||||||
let sqlWhereClause = ' where o.recordDelete_timeMillis is null'
|
let sqlWhereClause = ' where o.recordDelete_timeMillis is null'
|
||||||
const sqlParameters: unknown[] = []
|
const sqlParameters: unknown[] = []
|
||||||
|
|
||||||
if (filters.lotId) {
|
if ((filters.lotId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and o.lotId = ?'
|
sqlWhereClause += ' and o.lotId = ?'
|
||||||
sqlParameters.push(filters.lotId)
|
sqlParameters.push(filters.lotId)
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +73,7 @@ function buildWhereClause(filters: GetLotOccupanciesFilters): {
|
||||||
sqlParameters.push(...occupantNameFilters.sqlParameters)
|
sqlParameters.push(...occupantNameFilters.sqlParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.occupancyTypeId) {
|
if ((filters.occupancyTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and o.occupancyTypeId = ?'
|
sqlWhereClause += ' and o.occupancyTypeId = ?'
|
||||||
sqlParameters.push(filters.occupancyTypeId)
|
sqlParameters.push(filters.occupancyTypeId)
|
||||||
}
|
}
|
||||||
|
|
@ -85,37 +85,37 @@ function buildWhereClause(filters: GetLotOccupanciesFilters): {
|
||||||
sqlWhereClause += occupancyTimeFilters.sqlWhereClause
|
sqlWhereClause += occupancyTimeFilters.sqlWhereClause
|
||||||
sqlParameters.push(...occupancyTimeFilters.sqlParameters)
|
sqlParameters.push(...occupancyTimeFilters.sqlParameters)
|
||||||
|
|
||||||
if (filters.occupancyStartDateString) {
|
if ((filters.occupancyStartDateString ?? '') !== '') {
|
||||||
sqlWhereClause += ' and o.occupancyStartDate = ?'
|
sqlWhereClause += ' and o.occupancyStartDate = ?'
|
||||||
sqlParameters.push(dateStringToInteger(filters.occupancyStartDateString))
|
sqlParameters.push(dateStringToInteger(filters.occupancyStartDateString!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.occupancyEffectiveDateString) {
|
if ((filters.occupancyEffectiveDateString ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and (o.occupancyStartDate <= ? and (o.occupancyEndDate is null or o.occupancyEndDate >= ?))'
|
' and (o.occupancyStartDate <= ? and (o.occupancyEndDate is null or o.occupancyEndDate >= ?))'
|
||||||
sqlParameters.push(
|
sqlParameters.push(
|
||||||
dateStringToInteger(filters.occupancyEffectiveDateString),
|
dateStringToInteger(filters.occupancyEffectiveDateString!),
|
||||||
dateStringToInteger(filters.occupancyEffectiveDateString)
|
dateStringToInteger(filters.occupancyEffectiveDateString!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?'
|
sqlWhereClause += ' and l.mapId = ?'
|
||||||
sqlParameters.push(filters.mapId)
|
sqlParameters.push(filters.mapId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotTypeId = ?'
|
sqlWhereClause += ' and l.lotTypeId = ?'
|
||||||
sqlParameters.push(filters.lotTypeId)
|
sqlParameters.push(filters.lotTypeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.workOrderId) {
|
if ((filters.workOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and o.lotOccupancyId in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)'
|
' and o.lotOccupancyId in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)'
|
||||||
sqlParameters.push(filters.workOrderId)
|
sqlParameters.push(filters.workOrderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.notWorkOrderId) {
|
if ((filters.notWorkOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and o.lotOccupancyId not in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)'
|
' and o.lotOccupancyId not in (select lotOccupancyId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and workOrderId = ?)'
|
||||||
sqlParameters.push(filters.notWorkOrderId)
|
sqlParameters.push(filters.notWorkOrderId)
|
||||||
|
|
@ -180,9 +180,11 @@ export async function getLotOccupancies(
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const lotOccupancy of lotOccupancies) {
|
for (const lotOccupancy of lotOccupancies) {
|
||||||
const occupancyType = await getOccupancyTypeById(lotOccupancy.occupancyTypeId!)
|
const occupancyType = await getOccupancyTypeById(
|
||||||
|
lotOccupancy.occupancyTypeId!
|
||||||
|
)
|
||||||
|
|
||||||
if (occupancyType) {
|
if (occupancyType !== undefined) {
|
||||||
lotOccupancy.printEJS = (
|
lotOccupancy.printEJS = (
|
||||||
occupancyType.occupancyTypePrints ?? []
|
occupancyType.occupancyTypePrints ?? []
|
||||||
).includes('*')
|
).includes('*')
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
|
||||||
where o.recordDelete_timeMillis is null
|
where o.recordDelete_timeMillis is null
|
||||||
and o.lotOccupancyId = ?`)
|
and o.lotOccupancyId = ?`)
|
||||||
.get(lotOccupancyId);
|
.get(lotOccupancyId);
|
||||||
if (lotOccupancy) {
|
if (lotOccupancy !== undefined) {
|
||||||
lotOccupancy.lotOccupancyFields = await getLotOccupancyFields(lotOccupancyId, database);
|
lotOccupancy.lotOccupancyFields = await getLotOccupancyFields(lotOccupancyId, database);
|
||||||
lotOccupancy.lotOccupancyOccupants = await getLotOccupancyOccupants(lotOccupancyId, database);
|
lotOccupancy.lotOccupancyOccupants = await getLotOccupancyOccupants(lotOccupancyId, database);
|
||||||
lotOccupancy.lotOccupancyComments = await getLotOccupancyComments(lotOccupancyId, database);
|
lotOccupancy.lotOccupancyComments = await getLotOccupancyComments(lotOccupancyId, database);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export async function getLotOccupancy(
|
||||||
)
|
)
|
||||||
.get(lotOccupancyId)
|
.get(lotOccupancyId)
|
||||||
|
|
||||||
if (lotOccupancy) {
|
if (lotOccupancy !== undefined) {
|
||||||
lotOccupancy.lotOccupancyFields = await getLotOccupancyFields(
|
lotOccupancy.lotOccupancyFields = await getLotOccupancyFields(
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
database
|
database
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,5 @@ interface GetFilters {
|
||||||
interface LotStatusSummary extends recordTypes.LotStatus {
|
interface LotStatusSummary extends recordTypes.LotStatus {
|
||||||
lotCount: number;
|
lotCount: number;
|
||||||
}
|
}
|
||||||
export declare function getLotStatusSummary(filters?: GetFilters): Promise<LotStatusSummary[]>;
|
export declare function getLotStatusSummary(filters: GetFilters): Promise<LotStatusSummary[]>;
|
||||||
export default getLotStatusSummary;
|
export default getLotStatusSummary;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ export async function getLotStatusSummary(filters) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
if (filters?.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?';
|
sqlWhereClause += ' and l.mapId = ?';
|
||||||
sqlParameters.push(filters.mapId);
|
sqlParameters.push(filters.mapId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@ interface LotStatusSummary extends recordTypes.LotStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLotStatusSummary(
|
export async function getLotStatusSummary(
|
||||||
filters?: GetFilters
|
filters: GetFilters
|
||||||
): Promise<LotStatusSummary[]> {
|
): Promise<LotStatusSummary[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
let sqlWhereClause = ' where l.recordDelete_timeMillis is null'
|
let sqlWhereClause = ' where l.recordDelete_timeMillis is null'
|
||||||
const sqlParameters: unknown[] = []
|
const sqlParameters: unknown[] = []
|
||||||
|
|
||||||
if (filters?.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?'
|
sqlWhereClause += ' and l.mapId = ?'
|
||||||
sqlParameters.push(filters.mapId)
|
sqlParameters.push(filters.mapId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,5 @@ interface GetFilters {
|
||||||
interface LotTypeSummary extends recordTypes.LotType {
|
interface LotTypeSummary extends recordTypes.LotType {
|
||||||
lotCount: number;
|
lotCount: number;
|
||||||
}
|
}
|
||||||
export declare function getLotTypeSummary(filters?: GetFilters): Promise<LotTypeSummary[]>;
|
export declare function getLotTypeSummary(filters: GetFilters): Promise<LotTypeSummary[]>;
|
||||||
export default getLotTypeSummary;
|
export default getLotTypeSummary;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ export async function getLotTypeSummary(filters) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
if (filters?.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?';
|
sqlWhereClause += ' and l.mapId = ?';
|
||||||
sqlParameters.push(filters.mapId);
|
sqlParameters.push(filters.mapId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@ interface LotTypeSummary extends recordTypes.LotType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLotTypeSummary(
|
export async function getLotTypeSummary(
|
||||||
filters?: GetFilters
|
filters: GetFilters
|
||||||
): Promise<LotTypeSummary[]> {
|
): Promise<LotTypeSummary[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
let sqlWhereClause = ' where l.recordDelete_timeMillis is null'
|
let sqlWhereClause = ' where l.recordDelete_timeMillis is null'
|
||||||
const sqlParameters: unknown[] = []
|
const sqlParameters: unknown[] = []
|
||||||
|
|
||||||
if (filters?.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?'
|
sqlWhereClause += ' and l.mapId = ?'
|
||||||
sqlParameters.push(filters.mapId)
|
sqlParameters.push(filters.mapId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue