From 3e42fa5e785079b7b7311ecd349e21a72166f5ac Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Wed, 31 Aug 2022 10:54:24 -0400 Subject: [PATCH] linting --- handlers/maps-get/view.ts | 24 ++++---- helpers/lotOccupancyDB/addLot.ts | 55 ++++++++++--------- helpers/lotOccupancyDB/addLotComment.ts | 45 ++++++++------- .../addLotOccupancyTransaction.js | 2 +- .../addLotOccupancyTransaction.ts | 11 ++-- helpers/lotOccupancyDB/addOccupancyType.ts | 7 ++- helpers/lotOccupancyDB/addWorkOrder.js | 2 +- helpers/lotOccupancyDB/addWorkOrder.ts | 10 +++- helpers/lotOccupancyDB/getLotComments.js | 2 +- helpers/lotOccupancyDB/getLotComments.ts | 7 ++- helpers/lotOccupancyDB/getLotOccupancies.js | 2 +- helpers/lotOccupancyDB/getLotOccupancies.ts | 12 ++-- helpers/lotOccupancyDB/getLotOccupancy.js | 2 +- helpers/lotOccupancyDB/getLotOccupancy.ts | 8 +-- .../lotOccupancyDB/getLotOccupancyComments.js | 2 +- .../lotOccupancyDB/getLotOccupancyComments.ts | 7 ++- .../getLotOccupancyTransactions.js | 2 +- .../getLotOccupancyTransactions.ts | 24 ++++---- helpers/lotOccupancyDB/getMap.ts | 53 +++++++++--------- helpers/lotOccupancyDB/getMaps.ts | 1 + helpers/lotOccupancyDB/getWorkOrderTypes.ts | 1 + helpers/lotOccupancyDB/updateFee.ts | 19 ++++--- helpers/lotOccupancyDB/updateFeeCategory.ts | 5 +- helpers/lotOccupancyDB/updateLot.ts | 5 +- helpers/lotOccupancyDB/updateLotOccupancy.js | 2 +- helpers/lotOccupancyDB/updateLotOccupancy.ts | 9 +-- 26 files changed, 183 insertions(+), 136 deletions(-) diff --git a/handlers/maps-get/view.ts b/handlers/maps-get/view.ts index 5ac8413c..74588de9 100644 --- a/handlers/maps-get/view.ts +++ b/handlers/maps-get/view.ts @@ -1,22 +1,26 @@ -import type { RequestHandler } from "express"; +import type { + RequestHandler +} from "express"; import * as configFunctions from "../../helpers/functions.config.js"; -import { getMap } from "../../helpers/lotOccupancyDB/getMap.js"; +import { + getMap +} from "../../helpers/lotOccupancyDB/getMap.js"; export const handler: RequestHandler = (request, response) => { - const map = getMap(request.params.mapId); + const map = getMap(request.params.mapId); - if (!map) { - return response.redirect(configFunctions.getProperty("reverseProxy.urlPrefix") + "/maps/?error=mapIdNotFound"); - } + if (!map) { + return response.redirect(configFunctions.getProperty("reverseProxy.urlPrefix") + "/maps/?error=mapIdNotFound"); + } - response.render("map-view", { - headTitle: map.mapName, - map - }); + response.render("map-view", { + headTitle: map.mapName, + map + }); }; diff --git a/helpers/lotOccupancyDB/addLot.ts b/helpers/lotOccupancyDB/addLot.ts index 452f4d05..f3bec367 100644 --- a/helpers/lotOccupancyDB/addLot.ts +++ b/helpers/lotOccupancyDB/addLot.ts @@ -1,5 +1,8 @@ import sqlite from "better-sqlite3"; -import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; import type * as recordTypes from "../../types/recordTypes"; @@ -18,36 +21,36 @@ interface AddLotForm { export const addLot = - (lotForm: AddLotForm, requestSession: recordTypes.PartialSession): number => { + (lotForm: AddLotForm, requestSession: recordTypes.PartialSession): number => { - const database = sqlite(databasePath); + const database = sqlite(databasePath); - const rightNowMillis = Date.now(); + const rightNowMillis = Date.now(); - const result = database - .prepare("insert into Lots (" + - "lotName, lotTypeId, lotStatusId," + - " mapId, mapKey," + - " lotLatitude, lotLongitude," + - " recordCreate_userName, recordCreate_timeMillis," + - " recordUpdate_userName, recordUpdate_timeMillis)" + - " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") - .run(lotForm.lotName, - lotForm.lotTypeId, - (lotForm.lotStatusId === "" ? undefined : lotForm.lotStatusId), - (lotForm.mapId === "" ? undefined : lotForm.mapId), - lotForm.mapKey, - (lotForm.lotLatitude === "" ? undefined : lotForm.lotLatitude), - (lotForm.lotLongitude === "" ? undefined : lotForm.lotLongitude), - requestSession.user.userName, - rightNowMillis, - requestSession.user.userName, - rightNowMillis); + const result = database + .prepare("insert into Lots (" + + "lotName, lotTypeId, lotStatusId," + + " mapId, mapKey," + + " lotLatitude, lotLongitude," + + " recordCreate_userName, recordCreate_timeMillis," + + " recordUpdate_userName, recordUpdate_timeMillis)" + + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") + .run(lotForm.lotName, + lotForm.lotTypeId, + (lotForm.lotStatusId === "" ? undefined : lotForm.lotStatusId), + (lotForm.mapId === "" ? undefined : lotForm.mapId), + lotForm.mapKey, + (lotForm.lotLatitude === "" ? undefined : lotForm.lotLatitude), + (lotForm.lotLongitude === "" ? undefined : lotForm.lotLongitude), + requestSession.user.userName, + rightNowMillis, + requestSession.user.userName, + rightNowMillis); - database.close(); + database.close(); - return result.lastInsertRowid as number; - }; + return result.lastInsertRowid as number; + }; export default addLot; \ No newline at end of file diff --git a/helpers/lotOccupancyDB/addLotComment.ts b/helpers/lotOccupancyDB/addLotComment.ts index 5633eed9..da6a137a 100644 --- a/helpers/lotOccupancyDB/addLotComment.ts +++ b/helpers/lotOccupancyDB/addLotComment.ts @@ -1,5 +1,8 @@ import sqlite from "better-sqlite3"; -import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; import * as dateTimeFunctions from "@cityssm/expressjs-server-js/dateTimeFns.js"; @@ -13,31 +16,31 @@ interface AddLotCommentForm { export const addLotComment = - (lotCommentForm: AddLotCommentForm, requestSession: recordTypes.PartialSession): number => { + (lotCommentForm: AddLotCommentForm, requestSession: recordTypes.PartialSession): number => { - const database = sqlite(databasePath); + const database = sqlite(databasePath); - const rightNow = new Date(); + const rightNow = new Date(); - const result = database - .prepare("insert into LotComments (" + - "lotId, lotCommentDate, lotCommentTime, lotComment," + - " recordCreate_userName, recordCreate_timeMillis," + - " recordUpdate_userName, recordUpdate_timeMillis)" + - " values (?, ?, ?, ?, ?, ?, ?, ?)") - .run(lotCommentForm.lotId, - dateTimeFunctions.dateToInteger(rightNow), - dateTimeFunctions.dateToTimeInteger(rightNow), - lotCommentForm.lotComment, - requestSession.user.userName, - rightNow.getTime(), - requestSession.user.userName, - rightNow.getTime()); + const result = database + .prepare("insert into LotComments (" + + "lotId, lotCommentDate, lotCommentTime, lotComment," + + " recordCreate_userName, recordCreate_timeMillis," + + " recordUpdate_userName, recordUpdate_timeMillis)" + + " values (?, ?, ?, ?, ?, ?, ?, ?)") + .run(lotCommentForm.lotId, + dateTimeFunctions.dateToInteger(rightNow), + dateTimeFunctions.dateToTimeInteger(rightNow), + lotCommentForm.lotComment, + requestSession.user.userName, + rightNow.getTime(), + requestSession.user.userName, + rightNow.getTime()); - database.close(); + database.close(); - return result.lastInsertRowid as number; - }; + return result.lastInsertRowid as number; + }; export default addLotComment; \ No newline at end of file diff --git a/helpers/lotOccupancyDB/addLotOccupancyTransaction.js b/helpers/lotOccupancyDB/addLotOccupancyTransaction.js index befb7ee1..64563824 100644 --- a/helpers/lotOccupancyDB/addLotOccupancyTransaction.js +++ b/helpers/lotOccupancyDB/addLotOccupancyTransaction.js @@ -1,6 +1,6 @@ -import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; export const addLotOccupancyTransaction = (lotOccupancyTransactionForm, requestSession) => { const database = sqlite(databasePath); let transactionIndex = 0; diff --git a/helpers/lotOccupancyDB/addLotOccupancyTransaction.ts b/helpers/lotOccupancyDB/addLotOccupancyTransaction.ts index da605b40..c2072814 100644 --- a/helpers/lotOccupancyDB/addLotOccupancyTransaction.ts +++ b/helpers/lotOccupancyDB/addLotOccupancyTransaction.ts @@ -1,14 +1,15 @@ +import sqlite from "better-sqlite3"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; + import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; -import sqlite from "better-sqlite3"; - -import { - lotOccupancyDB as databasePath -} from "../../data/databasePaths.js"; import type * as recordTypes from "../../types/recordTypes"; diff --git a/helpers/lotOccupancyDB/addOccupancyType.ts b/helpers/lotOccupancyDB/addOccupancyType.ts index 8715a4b7..21895deb 100644 --- a/helpers/lotOccupancyDB/addOccupancyType.ts +++ b/helpers/lotOccupancyDB/addOccupancyType.ts @@ -4,13 +4,16 @@ import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + clearOccupancyTypesCache +} from "../functions.cache.js"; + import type * as recordTypes from "../../types/recordTypes"; -import { clearOccupancyTypesCache } from "../functions.cache.js"; interface AddOccupancyTypeForm { occupancyType: string; - orderNumber?: number; + orderNumber ? : number; } diff --git a/helpers/lotOccupancyDB/addWorkOrder.js b/helpers/lotOccupancyDB/addWorkOrder.js index 81289689..18cfbfc7 100644 --- a/helpers/lotOccupancyDB/addWorkOrder.js +++ b/helpers/lotOccupancyDB/addWorkOrder.js @@ -1,6 +1,6 @@ -import { dateStringToInteger, dateToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateStringToInteger, dateToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; export const addWorkOrder = (workOrderForm, requestSession) => { const database = sqlite(databasePath); const rightNow = new Date(); diff --git a/helpers/lotOccupancyDB/addWorkOrder.ts b/helpers/lotOccupancyDB/addWorkOrder.ts index 4a62b071..af628244 100644 --- a/helpers/lotOccupancyDB/addWorkOrder.ts +++ b/helpers/lotOccupancyDB/addWorkOrder.ts @@ -1,10 +1,14 @@ -import { dateStringToInteger, dateToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateStringToInteger, + dateToInteger +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import type * as recordTypes from "../../types/recordTypes"; @@ -12,8 +16,8 @@ interface AddWorkOrderForm { workOrderTypeId: number | string; workOrderNumber: string; workOrderDescription: string; - workOrderOpenDateString?: string; - workOrderCloseDateString?: string; + workOrderOpenDateString ? : string; + workOrderCloseDateString ? : string; } diff --git a/helpers/lotOccupancyDB/getLotComments.js b/helpers/lotOccupancyDB/getLotComments.js index 2a01d5f5..7ab3cf3e 100644 --- a/helpers/lotOccupancyDB/getLotComments.js +++ b/helpers/lotOccupancyDB/getLotComments.js @@ -1,6 +1,6 @@ -import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; export const getLotComments = (lotId, connectedDatabase) => { const database = connectedDatabase || sqlite(databasePath, { readonly: true diff --git a/helpers/lotOccupancyDB/getLotComments.ts b/helpers/lotOccupancyDB/getLotComments.ts index 6031e06b..29e82aa6 100644 --- a/helpers/lotOccupancyDB/getLotComments.ts +++ b/helpers/lotOccupancyDB/getLotComments.ts @@ -1,9 +1,14 @@ -import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; + import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateIntegerToString, + timeIntegerToString +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import type * as recordTypes from "../../types/recordTypes"; diff --git a/helpers/lotOccupancyDB/getLotOccupancies.js b/helpers/lotOccupancyDB/getLotOccupancies.js index fd190c31..55c4aebd 100644 --- a/helpers/lotOccupancyDB/getLotOccupancies.js +++ b/helpers/lotOccupancyDB/getLotOccupancies.js @@ -1,6 +1,6 @@ -import { dateIntegerToString, dateStringToInteger, dateToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateIntegerToString, dateStringToInteger, dateToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import { getLotOccupancyOccupants } from "./getLotOccupancyOccupants.js"; export const getLotOccupancies = (filters, options, connectedDatabase) => { const database = connectedDatabase || sqlite(databasePath, { diff --git a/helpers/lotOccupancyDB/getLotOccupancies.ts b/helpers/lotOccupancyDB/getLotOccupancies.ts index 1534af23..c5b3a6f8 100644 --- a/helpers/lotOccupancyDB/getLotOccupancies.ts +++ b/helpers/lotOccupancyDB/getLotOccupancies.ts @@ -1,15 +1,15 @@ -import { - dateIntegerToString, - dateStringToInteger, - dateToInteger -} from "@cityssm/expressjs-server-js/dateTimeFns.js"; - import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateIntegerToString, + dateStringToInteger, + dateToInteger +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import { getLotOccupancyOccupants } from "./getLotOccupancyOccupants.js"; diff --git a/helpers/lotOccupancyDB/getLotOccupancy.js b/helpers/lotOccupancyDB/getLotOccupancy.js index 1f02cfbb..acae0482 100644 --- a/helpers/lotOccupancyDB/getLotOccupancy.js +++ b/helpers/lotOccupancyDB/getLotOccupancy.js @@ -1,6 +1,6 @@ -import { dateIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import { getLotOccupancyOccupants } from "./getLotOccupancyOccupants.js"; import { getLotOccupancyComments } from "./getLotOccupancyComments.js"; import { getLotOccupancyFields } from "./getLotOccupancyFields.js"; diff --git a/helpers/lotOccupancyDB/getLotOccupancy.ts b/helpers/lotOccupancyDB/getLotOccupancy.ts index 4920d573..b70649b0 100644 --- a/helpers/lotOccupancyDB/getLotOccupancy.ts +++ b/helpers/lotOccupancyDB/getLotOccupancy.ts @@ -1,13 +1,13 @@ -import { - dateIntegerToString -} from "@cityssm/expressjs-server-js/dateTimeFns.js"; - import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateIntegerToString +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import { getLotOccupancyOccupants } from "./getLotOccupancyOccupants.js"; diff --git a/helpers/lotOccupancyDB/getLotOccupancyComments.js b/helpers/lotOccupancyDB/getLotOccupancyComments.js index 34c3a9a8..ae729f89 100644 --- a/helpers/lotOccupancyDB/getLotOccupancyComments.js +++ b/helpers/lotOccupancyDB/getLotOccupancyComments.js @@ -1,6 +1,6 @@ -import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; export const getLotOccupancyComments = (lotOccupancyId, connectedDatabase) => { const database = connectedDatabase || sqlite(databasePath, { readonly: true diff --git a/helpers/lotOccupancyDB/getLotOccupancyComments.ts b/helpers/lotOccupancyDB/getLotOccupancyComments.ts index 01438617..5c723091 100644 --- a/helpers/lotOccupancyDB/getLotOccupancyComments.ts +++ b/helpers/lotOccupancyDB/getLotOccupancyComments.ts @@ -1,9 +1,14 @@ -import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; + import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateIntegerToString, + timeIntegerToString +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import type * as recordTypes from "../../types/recordTypes"; diff --git a/helpers/lotOccupancyDB/getLotOccupancyTransactions.js b/helpers/lotOccupancyDB/getLotOccupancyTransactions.js index 6911d691..f238d326 100644 --- a/helpers/lotOccupancyDB/getLotOccupancyTransactions.js +++ b/helpers/lotOccupancyDB/getLotOccupancyTransactions.js @@ -1,6 +1,6 @@ -import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; export const getLotOccupancyTransactions = (lotOccupancyId, connectedDatabase) => { const database = connectedDatabase || sqlite(databasePath, { readonly: true diff --git a/helpers/lotOccupancyDB/getLotOccupancyTransactions.ts b/helpers/lotOccupancyDB/getLotOccupancyTransactions.ts index 190ee436..aa9d5202 100644 --- a/helpers/lotOccupancyDB/getLotOccupancyTransactions.ts +++ b/helpers/lotOccupancyDB/getLotOccupancyTransactions.ts @@ -1,10 +1,14 @@ -import { dateIntegerToString, timeIntegerToString } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateIntegerToString, + timeIntegerToString +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import type * as recordTypes from "../../types/recordTypes"; @@ -19,15 +23,15 @@ export const getLotOccupancyTransactions = (lotOccupancyId: number | string, database.function("userFn_timeIntegerToString", timeIntegerToString); const lotOccupancyTransactions: recordTypes.LotOccupancyTransaction[] = database - .prepare("select lotOccupancyId, transactionIndex," + - " transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString," + - " transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString," + - " transactionAmount, externalReceiptNumber, transactionNote" + - " from LotOccupancyTransactions" + - " where recordDelete_timeMillis is null" + - " and lotOccupancyId = ?" + - " order by transactionDate, transactionTime, transactionIndex") - .all(lotOccupancyId); + .prepare("select lotOccupancyId, transactionIndex," + + " transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString," + + " transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString," + + " transactionAmount, externalReceiptNumber, transactionNote" + + " from LotOccupancyTransactions" + + " where recordDelete_timeMillis is null" + + " and lotOccupancyId = ?" + + " order by transactionDate, transactionTime, transactionIndex") + .all(lotOccupancyId); if (!connectedDatabase) { database.close(); diff --git a/helpers/lotOccupancyDB/getMap.ts b/helpers/lotOccupancyDB/getMap.ts index 27909324..fdf35fdd 100644 --- a/helpers/lotOccupancyDB/getMap.ts +++ b/helpers/lotOccupancyDB/getMap.ts @@ -1,38 +1,41 @@ import sqlite from "better-sqlite3"; -import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; import type * as recordTypes from "../../types/recordTypes"; export const getMap = (mapId: number | string): recordTypes.Map => { - const database = sqlite(databasePath, { - readonly: true - }); + const database = sqlite(databasePath, { + readonly: true + }); - const map: recordTypes.Map = database - .prepare("select m.mapId, m.mapName, m.mapDescription," + - " m.mapLatitude, m.mapLongitude, m.mapSVG," + - " m.mapAddress1, m.mapAddress2, m.mapCity, m.mapProvince, m.mapPostalCode, m.mapPhoneNumber," + - " m.recordCreate_userName, m.recordCreate_timeMillis," + - " m.recordUpdate_userName, m.recordUpdate_timeMillis," + - " m.recordDelete_userName, m.recordDelete_timeMillis," + - " count(l.lotId) as lotCount" + - " from Maps m" + - " left join Lots l on m.mapId = l.mapId and l.recordDelete_timeMillis is null" + - " where m.mapId = ?" + - " group by m.mapId, m.mapName, m.mapDescription," + - " m.mapLatitude, m.mapLongitude, m.mapSVG," + - " m.mapAddress1, m.mapAddress2, m.mapCity, m.mapProvince, m.mapPostalCode, m.mapPhoneNumber," + - " m.recordCreate_userName, m.recordCreate_timeMillis," + - " m.recordUpdate_userName, m.recordUpdate_timeMillis," + - " m.recordDelete_userName, m.recordDelete_timeMillis") - .get(mapId); + const map: recordTypes.Map = database + .prepare("select m.mapId, m.mapName, m.mapDescription," + + " m.mapLatitude, m.mapLongitude, m.mapSVG," + + " m.mapAddress1, m.mapAddress2, m.mapCity, m.mapProvince, m.mapPostalCode, m.mapPhoneNumber," + + " m.recordCreate_userName, m.recordCreate_timeMillis," + + " m.recordUpdate_userName, m.recordUpdate_timeMillis," + + " m.recordDelete_userName, m.recordDelete_timeMillis," + + " count(l.lotId) as lotCount" + + " from Maps m" + + " left join Lots l on m.mapId = l.mapId and l.recordDelete_timeMillis is null" + + " where m.mapId = ?" + + " group by m.mapId, m.mapName, m.mapDescription," + + " m.mapLatitude, m.mapLongitude, m.mapSVG," + + " m.mapAddress1, m.mapAddress2, m.mapCity, m.mapProvince, m.mapPostalCode, m.mapPhoneNumber," + + " m.recordCreate_userName, m.recordCreate_timeMillis," + + " m.recordUpdate_userName, m.recordUpdate_timeMillis," + + " m.recordDelete_userName, m.recordDelete_timeMillis") + .get(mapId); - database.close(); + database.close(); - return map; - }; + return map; +}; export default getMap; \ No newline at end of file diff --git a/helpers/lotOccupancyDB/getMaps.ts b/helpers/lotOccupancyDB/getMaps.ts index 950a2ef8..8382ede5 100644 --- a/helpers/lotOccupancyDB/getMaps.ts +++ b/helpers/lotOccupancyDB/getMaps.ts @@ -1,4 +1,5 @@ import sqlite from "better-sqlite3"; + import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; diff --git a/helpers/lotOccupancyDB/getWorkOrderTypes.ts b/helpers/lotOccupancyDB/getWorkOrderTypes.ts index 15cb9a4d..78e21be4 100644 --- a/helpers/lotOccupancyDB/getWorkOrderTypes.ts +++ b/helpers/lotOccupancyDB/getWorkOrderTypes.ts @@ -1,4 +1,5 @@ import sqlite from "better-sqlite3"; + import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; diff --git a/helpers/lotOccupancyDB/updateFee.ts b/helpers/lotOccupancyDB/updateFee.ts index 3f40f0c0..aed68ab7 100644 --- a/helpers/lotOccupancyDB/updateFee.ts +++ b/helpers/lotOccupancyDB/updateFee.ts @@ -1,5 +1,8 @@ import sqlite from "better-sqlite3"; -import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; import type * as recordTypes from "../../types/recordTypes"; @@ -9,14 +12,14 @@ interface UpdateFeeForm { feeCategoryId: string; feeName: string; feeDescription: string; - occupancyTypeId?: string; - lotTypeId?: string; - feeAmount?: string; - feeFunction?: string; - taxAmount?: string; - taxPercentage?: string; + occupancyTypeId ? : string; + lotTypeId ? : string; + feeAmount ? : string; + feeFunction ? : string; + taxAmount ? : string; + taxPercentage ? : string; includeQuantity: "" | "1"; - quantityUnit?: string; + quantityUnit ? : string; isRequired: "" | "1"; } diff --git a/helpers/lotOccupancyDB/updateFeeCategory.ts b/helpers/lotOccupancyDB/updateFeeCategory.ts index b65f64b3..4fd611f3 100644 --- a/helpers/lotOccupancyDB/updateFeeCategory.ts +++ b/helpers/lotOccupancyDB/updateFeeCategory.ts @@ -1,5 +1,8 @@ import sqlite from "better-sqlite3"; -import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; import type * as recordTypes from "../../types/recordTypes"; diff --git a/helpers/lotOccupancyDB/updateLot.ts b/helpers/lotOccupancyDB/updateLot.ts index 35c95b69..ff7b5e33 100644 --- a/helpers/lotOccupancyDB/updateLot.ts +++ b/helpers/lotOccupancyDB/updateLot.ts @@ -1,5 +1,8 @@ import sqlite from "better-sqlite3"; -import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; + +import { + lotOccupancyDB as databasePath +} from "../../data/databasePaths.js"; import type * as recordTypes from "../../types/recordTypes"; diff --git a/helpers/lotOccupancyDB/updateLotOccupancy.js b/helpers/lotOccupancyDB/updateLotOccupancy.js index 217208b9..2539d46b 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancy.js +++ b/helpers/lotOccupancyDB/updateLotOccupancy.js @@ -1,6 +1,6 @@ -import { dateStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { dateStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js"; import { addOrUpdateLotOccupancyField } from "./addOrUpdateLotOccupancyField.js"; import { deleteLotOccupancyField } from "./deleteLotOccupancyField.js"; export function updateLotOccupancy(lotOccupancyForm, requestSession) { diff --git a/helpers/lotOccupancyDB/updateLotOccupancy.ts b/helpers/lotOccupancyDB/updateLotOccupancy.ts index c92932e8..65b68503 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancy.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancy.ts @@ -1,13 +1,13 @@ -import { - dateStringToInteger -} from "@cityssm/expressjs-server-js/dateTimeFns.js"; - import sqlite from "better-sqlite3"; import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js"; +import { + dateStringToInteger +} from "@cityssm/expressjs-server-js/dateTimeFns.js"; + import { addOrUpdateLotOccupancyField } from "./addOrUpdateLotOccupancyField.js"; @@ -18,6 +18,7 @@ import { import type * as recordTypes from "../../types/recordTypes"; + interface UpdateLotOccupancyForm { lotOccupancyId: string | number; occupancyTypeId: string | number;