From f440a35df7694566b546a7e91f13efeda4eae48e Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Mon, 28 Apr 2025 14:05:18 -0400 Subject: [PATCH] linting --- database/getBurialSite.js | 2 +- database/getBurialSite.ts | 2 +- database/getBurialSiteFields.js | 22 +++++++++++----------- database/getBurialSiteFields.ts | 22 +++++++++++----------- package-lock.json | 8 ++++---- package.json | 2 +- public/javascripts/contract.edit.ts | 1 - 7 files changed, 29 insertions(+), 30 deletions(-) diff --git a/database/getBurialSite.js b/database/getBurialSite.js index 84c2819b..fcdea72e 100644 --- a/database/getBurialSite.js +++ b/database/getBurialSite.js @@ -30,7 +30,7 @@ export async function getBurialSiteByBurialSiteName(burialSiteName) { return await _getBurialSite(`${baseSQL} and l.burialSiteName = ?`, burialSiteName); } async function _getBurialSite(sql, burialSiteIdOrLotName) { - const database = sqlite(sunriseDB); + const database = sqlite(sunriseDB, { readonly: true }); const burialSite = database.prepare(sql).get(burialSiteIdOrLotName); if (burialSite !== undefined) { const contracts = await getContracts({ diff --git a/database/getBurialSite.ts b/database/getBurialSite.ts index 3d42771d..01d89f3f 100644 --- a/database/getBurialSite.ts +++ b/database/getBurialSite.ts @@ -47,7 +47,7 @@ async function _getBurialSite( sql: string, burialSiteIdOrLotName: number | string ): Promise { - const database = sqlite(sunriseDB) + const database = sqlite(sunriseDB, { readonly: true }) const burialSite = database.prepare(sql).get(burialSiteIdOrLotName) as | BurialSite diff --git a/database/getBurialSiteFields.js b/database/getBurialSiteFields.js index 4858df7f..0ca16a62 100644 --- a/database/getBurialSiteFields.js +++ b/database/getBurialSiteFields.js @@ -4,30 +4,30 @@ export default function getBurialSiteFields(burialSiteId, connectedDatabase) { const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true }); const burialSiteFields = database .prepare(`select l.burialSiteId, l.burialSiteTypeFieldId, - l.fieldValue, - f.burialSiteTypeField, f.fieldType, f.fieldValues, - f.isRequired, f.pattern, f.minLength, f.maxLength, - f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber + l.fieldValue, + f.burialSiteTypeField, f.fieldType, f.fieldValues, + f.isRequired, f.pattern, f.minLength, f.maxLength, + f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber from BurialSiteFields l left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId where l.recordDelete_timeMillis is null - and l.burialSiteId = ? + and l.burialSiteId = ? union select ? as burialSiteId, f.burialSiteTypeFieldId, - '' as fieldValue, - f.burialSiteTypeField, f.fieldType, f.fieldValues, - f.isRequired, f.pattern, f.minLength, f.maxLength, - f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber + '' as fieldValue, + f.burialSiteTypeField, f.fieldType, f.fieldValues, + f.isRequired, f.pattern, f.minLength, f.maxLength, + f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber from BurialSiteTypeFields f left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId where f.recordDelete_timeMillis is null - and ( + and ( f.burialSiteTypeId is null or f.burialSiteTypeId in (select burialSiteTypeId from BurialSites where burialSiteId = ?)) - and f.burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields where burialSiteId = ? and recordDelete_timeMillis is null) + and f.burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields where burialSiteId = ? and recordDelete_timeMillis is null) order by burialSiteTypeOrderNumber, f.orderNumber, f.burialSiteTypeField`) .all(burialSiteId, burialSiteId, burialSiteId, burialSiteId); if (connectedDatabase === undefined) { diff --git a/database/getBurialSiteFields.ts b/database/getBurialSiteFields.ts index 111893c7..d5f17b34 100644 --- a/database/getBurialSiteFields.ts +++ b/database/getBurialSiteFields.ts @@ -12,30 +12,30 @@ export default function getBurialSiteFields( const burialSiteFields = database .prepare( `select l.burialSiteId, l.burialSiteTypeFieldId, - l.fieldValue, - f.burialSiteTypeField, f.fieldType, f.fieldValues, - f.isRequired, f.pattern, f.minLength, f.maxLength, - f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber + l.fieldValue, + f.burialSiteTypeField, f.fieldType, f.fieldValues, + f.isRequired, f.pattern, f.minLength, f.maxLength, + f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber from BurialSiteFields l left join BurialSiteTypeFields f on l.burialSiteTypeFieldId = f.burialSiteTypeFieldId left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId where l.recordDelete_timeMillis is null - and l.burialSiteId = ? + and l.burialSiteId = ? union select ? as burialSiteId, f.burialSiteTypeFieldId, - '' as fieldValue, - f.burialSiteTypeField, f.fieldType, f.fieldValues, - f.isRequired, f.pattern, f.minLength, f.maxLength, - f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber + '' as fieldValue, + f.burialSiteTypeField, f.fieldType, f.fieldValues, + f.isRequired, f.pattern, f.minLength, f.maxLength, + f.orderNumber, t.orderNumber as burialSiteTypeOrderNumber from BurialSiteTypeFields f left join BurialSiteTypes t on f.burialSiteTypeId = t.burialSiteTypeId where f.recordDelete_timeMillis is null - and ( + and ( f.burialSiteTypeId is null or f.burialSiteTypeId in (select burialSiteTypeId from BurialSites where burialSiteId = ?)) - and f.burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields where burialSiteId = ? and recordDelete_timeMillis is null) + and f.burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields where burialSiteId = ? and recordDelete_timeMillis is null) order by burialSiteTypeOrderNumber, f.orderNumber, f.burialSiteTypeField` ) .all( diff --git a/package-lock.json b/package-lock.json index 8430cd9a..1be9e41a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,7 +60,7 @@ "@types/http-errors": "^2.0.4", "@types/leaflet": "^1.9.17", "@types/mssql": "^9.1.7", - "@types/node": "^22.14.1", + "@types/node": "^22.15.3", "@types/node-windows": "^0.1.6", "@types/papaparse": "^5.3.15", "@types/randomcolor": "^0.5.9", @@ -2038,9 +2038,9 @@ } }, "node_modules/@types/node": { - "version": "22.14.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz", - "integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==", + "version": "22.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", + "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", "license": "MIT", "dependencies": { "undici-types": "~6.21.0" diff --git a/package.json b/package.json index 52214425..812612de 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "@types/http-errors": "^2.0.4", "@types/leaflet": "^1.9.17", "@types/mssql": "^9.1.7", - "@types/node": "^22.14.1", + "@types/node": "^22.15.3", "@types/node-windows": "^0.1.6", "@types/papaparse": "^5.3.15", "@types/randomcolor": "^0.5.9", diff --git a/public/javascripts/contract.edit.ts b/public/javascripts/contract.edit.ts index f64410d4..74b7540d 100644 --- a/public/javascripts/contract.edit.ts +++ b/public/javascripts/contract.edit.ts @@ -14,7 +14,6 @@ import type { } from '../../types/record.types.js' import type { Sunrise } from './types.js' -import { ref } from 'process' declare const cityssm: cityssmGlobal declare const bulmaJS: BulmaJS