diff --git a/bin/www.js b/bin/www.js index 98a7880c..d3c88492 100644 --- a/bin/www.js +++ b/bin/www.js @@ -12,7 +12,7 @@ import { getConfigProperty } from '../helpers/config.helpers.js'; import version from '../version.js'; const debug = Debug(`${DEBUG_NAMESPACE}:www:${process.pid}`); // INITIALIZE THE DATABASE -await initializeDatabase(); +initializeDatabase(); const directoryName = path.dirname(fileURLToPath(import.meta.url)); const processCount = Math.min(getConfigProperty('application.maximumProcesses'), os.cpus().length * 2); const applicationName = getConfigProperty('application.applicationName'); diff --git a/bin/www.ts b/bin/www.ts index 8bbf40cd..ff6fbf4f 100644 --- a/bin/www.ts +++ b/bin/www.ts @@ -17,7 +17,7 @@ import version from '../version.js' const debug = Debug(`${DEBUG_NAMESPACE}:www:${process.pid}`) // INITIALIZE THE DATABASE -await initializeDatabase() +initializeDatabase() const directoryName = path.dirname(fileURLToPath(import.meta.url)) diff --git a/bin/wwwProcess.js b/bin/wwwProcess.js index 22e2c3d6..690035b4 100644 --- a/bin/wwwProcess.js +++ b/bin/wwwProcess.js @@ -10,7 +10,7 @@ import { getConfigProperty } from '../helpers/config.helpers.js'; const debug = Debug(`${DEBUG_NAMESPACE}:wwwProcess:${process.pid.toString().padEnd(5)}`); if (process.send === undefined) { // INITIALIZE THE DATABASE - await initializeDatabase(); + initializeDatabase(); } function onError(error) { if (error.syscall !== 'listen') { diff --git a/bin/wwwProcess.ts b/bin/wwwProcess.ts index 59fdf9e5..1987e540 100644 --- a/bin/wwwProcess.ts +++ b/bin/wwwProcess.ts @@ -15,7 +15,7 @@ const debug = Debug(`${DEBUG_NAMESPACE}:wwwProcess:${process.pid.toString().padE if (process.send === undefined) { // INITIALIZE THE DATABASE - await initializeDatabase() + initializeDatabase() } interface ServerError extends Error { diff --git a/database/getContracts.d.ts b/database/getContracts.d.ts index bea6c474..8b6e80c4 100644 --- a/database/getContracts.d.ts +++ b/database/getContracts.d.ts @@ -6,9 +6,9 @@ export interface GetContractsFilters { contractEffectiveDateString?: string; contractStartDateString?: DateString; contractTime?: '' | 'current' | 'future' | 'past'; - deceasedName?: string; - contractTypeId?: number | string; cemeteryId?: number | string; + contractTypeId?: number | string; + deceasedName?: string; burialSiteName?: string; burialSiteNameSearchType?: '' | 'endsWith' | 'startsWith'; burialSiteTypeId?: number | string; diff --git a/database/getContracts.ts b/database/getContracts.ts index 8464e048..be12ff22 100644 --- a/database/getContracts.ts +++ b/database/getContracts.ts @@ -28,9 +28,9 @@ export interface GetContractsFilters { contractStartDateString?: DateString contractTime?: '' | 'current' | 'future' | 'past' - deceasedName?: string - contractTypeId?: number | string cemeteryId?: number | string + contractTypeId?: number | string + deceasedName?: string burialSiteName?: string burialSiteNameSearchType?: '' | 'endsWith' | 'startsWith' diff --git a/test/0_initializeDatabase.js b/test/0_initializeDatabase.js index 5f23b122..0a325ef7 100644 --- a/test/0_initializeDatabase.js +++ b/test/0_initializeDatabase.js @@ -11,7 +11,7 @@ await describe('Initialize Database', async () => { } // eslint-disable-next-line security/detect-non-literal-fs-filename await fs.unlink(databasePath); - const success = await initializeDatabase(); + const success = initializeDatabase(); assert.ok(success); }); }); diff --git a/test/0_initializeDatabase.ts b/test/0_initializeDatabase.ts index 9652ee45..919c06e9 100644 --- a/test/0_initializeDatabase.ts +++ b/test/0_initializeDatabase.ts @@ -19,7 +19,7 @@ await describe('Initialize Database', async () => { // eslint-disable-next-line security/detect-non-literal-fs-filename await fs.unlink(databasePath) - const success = await initializeDatabase() + const success = initializeDatabase() assert.ok(success) }) diff --git a/test/functions.js b/test/functions.js index 24bf6dbd..11cc39fb 100644 --- a/test/functions.js +++ b/test/functions.js @@ -6,107 +6,107 @@ import * as sqlFilterFunctions from '../helpers/functions.sqlFilters.js'; import * as userFunctions from '../helpers/functions.user.js'; await describe('functions.cache', async () => { const badId = -3; - // eslint-disable-next-line no-secrets/no-secrets + // eslint-disable-next-line no-secrets/no-secrets, @cspell/spellchecker const badName = 'qwertyuiopasdfghjklzxcvbnm'; before(() => { cacheFunctions.clearCaches(); }); await describe('Burial Site Statuses', async () => { - await it('returns Burial Site Statuses', async () => { + await it('returns Burial Site Statuses', () => { cacheFunctions.clearCacheByTableName('BurialSiteStatuses'); - const burialSiteStatuses = await cacheFunctions.getBurialSiteStatuses(); + const burialSiteStatuses = cacheFunctions.getBurialSiteStatuses(); assert.ok(burialSiteStatuses.length > 0); for (const burialSiteStatus of burialSiteStatuses) { - const byId = await cacheFunctions.getBurialSiteStatusById(burialSiteStatus.burialSiteStatusId); + const byId = cacheFunctions.getBurialSiteStatusById(burialSiteStatus.burialSiteStatusId); assert.strictEqual(burialSiteStatus.burialSiteStatusId, byId?.burialSiteStatusId); - const byName = await cacheFunctions.getBurialSiteStatusByBurialSiteStatus(burialSiteStatus.burialSiteStatus); + const byName = cacheFunctions.getBurialSiteStatusByBurialSiteStatus(burialSiteStatus.burialSiteStatus); assert.strictEqual(burialSiteStatus.burialSiteStatus, byName?.burialSiteStatus); } }); - await it('returns undefined with a bad burialSiteStatusId', async () => { - const byBadId = await cacheFunctions.getBurialSiteStatusById(badId); + await it('returns undefined with a bad burialSiteStatusId', () => { + const byBadId = cacheFunctions.getBurialSiteStatusById(badId); assert.ok(byBadId === undefined); }); - await it('returns undefined with a bad lotStatus', async () => { - const byBadName = await cacheFunctions.getBurialSiteStatusByBurialSiteStatus(badName); + await it('returns undefined with a bad lotStatus', () => { + const byBadName = cacheFunctions.getBurialSiteStatusByBurialSiteStatus(badName); assert.ok(byBadName === undefined); }); }); await describe('Burial Site Types', async () => { - await it('returns Burial Site Types', async () => { + await it('returns Burial Site Types', () => { cacheFunctions.clearCacheByTableName('BurialSiteTypes'); - const burialSiteTypes = await cacheFunctions.getBurialSiteTypes(); + const burialSiteTypes = cacheFunctions.getBurialSiteTypes(); assert.ok(burialSiteTypes.length > 0); for (const burialSiteType of burialSiteTypes) { - const byId = await cacheFunctions.getBurialSiteTypeById(burialSiteType.burialSiteTypeId); + const byId = cacheFunctions.getBurialSiteTypeById(burialSiteType.burialSiteTypeId); assert.strictEqual(burialSiteType.burialSiteTypeId, byId?.burialSiteTypeId); - const byName = await cacheFunctions.getBurialSiteTypesByBurialSiteType(burialSiteType.burialSiteType); + const byName = cacheFunctions.getBurialSiteTypesByBurialSiteType(burialSiteType.burialSiteType); assert.strictEqual(burialSiteType.burialSiteType, byName?.burialSiteType); } }); - await it('returns undefined with a bad burialSiteTypeId', async () => { - const byBadId = await cacheFunctions.getBurialSiteTypeById(badId); + await it('returns undefined with a bad burialSiteTypeId', () => { + const byBadId = cacheFunctions.getBurialSiteTypeById(badId); assert.ok(byBadId === undefined); }); - await it('returns undefined with a bad lotType', async () => { - const byBadName = await cacheFunctions.getBurialSiteTypesByBurialSiteType(badName); + await it('returns undefined with a bad lotType', () => { + const byBadName = cacheFunctions.getBurialSiteTypesByBurialSiteType(badName); assert.ok(byBadName === undefined); }); }); await describe('Contract Types', async () => { - await it('returns Contract Types', async () => { + await it('returns Contract Types', () => { cacheFunctions.clearCacheByTableName('ContractTypes'); - const contractTypes = await cacheFunctions.getContractTypes(); + const contractTypes = cacheFunctions.getContractTypes(); assert.ok(contractTypes.length > 0); for (const contractType of contractTypes) { - const byId = await cacheFunctions.getContractTypeById(contractType.contractTypeId); + const byId = cacheFunctions.getContractTypeById(contractType.contractTypeId); assert.strictEqual(contractType.contractTypeId, byId?.contractTypeId); - const byName = await cacheFunctions.getContractTypeByContractType(contractType.contractType); + const byName = cacheFunctions.getContractTypeByContractType(contractType.contractType); assert.strictEqual(contractType.contractType, byName?.contractType); } }); - await it('returns undefined with a bad contractTypeId', async () => { - const byBadId = await cacheFunctions.getContractTypeById(badId); + await it('returns undefined with a bad contractTypeId', () => { + const byBadId = cacheFunctions.getContractTypeById(badId); assert.ok(byBadId === undefined); }); - await it('returns undefined with a bad contractType', async () => { - const byBadName = await cacheFunctions.getContractTypeByContractType(badName); + await it('returns undefined with a bad contractType', () => { + const byBadName = cacheFunctions.getContractTypeByContractType(badName); assert.ok(byBadName === undefined); }); }); await describe('Work Order Types', async () => { - await it('returns Work Order Types', async () => { + await it('returns Work Order Types', () => { cacheFunctions.clearCacheByTableName('WorkOrderTypes'); - const workOrderTypes = await cacheFunctions.getWorkOrderTypes(); + const workOrderTypes = cacheFunctions.getWorkOrderTypes(); assert.ok(workOrderTypes.length > 0); for (const workOrderType of workOrderTypes) { - const byId = await cacheFunctions.getWorkOrderTypeById(workOrderType.workOrderTypeId); + const byId = cacheFunctions.getWorkOrderTypeById(workOrderType.workOrderTypeId); assert.strictEqual(workOrderType.workOrderTypeId, byId?.workOrderTypeId); } }); - await it('returns undefined with a bad workOrderTypeId', async () => { - const byBadId = await cacheFunctions.getWorkOrderTypeById(badId); + await it('returns undefined with a bad workOrderTypeId', () => { + const byBadId = cacheFunctions.getWorkOrderTypeById(badId); assert.ok(byBadId === undefined); }); }); await describe('Work Order Milestone Types', async () => { - await it('returns Work Order Milestone Types', async () => { + await it('returns Work Order Milestone Types', () => { cacheFunctions.clearCacheByTableName('WorkOrderMilestoneTypes'); - const workOrderMilestoneTypes = await cacheFunctions.getWorkOrderMilestoneTypes(); + const workOrderMilestoneTypes = cacheFunctions.getWorkOrderMilestoneTypes(); assert.ok(workOrderMilestoneTypes.length > 0); for (const workOrderMilestoneType of workOrderMilestoneTypes) { - const byId = await cacheFunctions.getWorkOrderMilestoneTypeById(workOrderMilestoneType.workOrderMilestoneTypeId); + const byId = cacheFunctions.getWorkOrderMilestoneTypeById(workOrderMilestoneType.workOrderMilestoneTypeId); assert.strictEqual(workOrderMilestoneType.workOrderMilestoneTypeId, byId?.workOrderMilestoneTypeId); - const byName = await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneType.workOrderMilestoneType); + const byName = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneType.workOrderMilestoneType); assert.strictEqual(workOrderMilestoneType.workOrderMilestoneType, byName?.workOrderMilestoneType); } }); - await it('returns undefined with a bad workOrderMilestoneTypeId', async () => { - const byBadId = await cacheFunctions.getWorkOrderMilestoneTypeById(badId); + await it('returns undefined with a bad workOrderMilestoneTypeId', () => { + const byBadId = cacheFunctions.getWorkOrderMilestoneTypeById(badId); assert.ok(byBadId === undefined); }); - await it('returns undefined with a bad workOrderMilestoneType', async () => { - const byBadName = await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(badName); + await it('returns undefined with a bad workOrderMilestoneType', () => { + const byBadName = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(badName); assert.ok(byBadName === undefined); }); }); diff --git a/test/functions.ts b/test/functions.ts index a30952b0..be6564ed 100644 --- a/test/functions.ts +++ b/test/functions.ts @@ -8,7 +8,7 @@ import * as userFunctions from '../helpers/functions.user.js' await describe('functions.cache', async () => { const badId = -3 - // eslint-disable-next-line no-secrets/no-secrets + // eslint-disable-next-line no-secrets/no-secrets, @cspell/spellchecker const badName = 'qwertyuiopasdfghjklzxcvbnm' before(() => { @@ -16,15 +16,15 @@ await describe('functions.cache', async () => { }) await describe('Burial Site Statuses', async () => { - await it('returns Burial Site Statuses', async () => { + await it('returns Burial Site Statuses', () => { cacheFunctions.clearCacheByTableName('BurialSiteStatuses') - const burialSiteStatuses = await cacheFunctions.getBurialSiteStatuses() + const burialSiteStatuses = cacheFunctions.getBurialSiteStatuses() assert.ok(burialSiteStatuses.length > 0) for (const burialSiteStatus of burialSiteStatuses) { - const byId = await cacheFunctions.getBurialSiteStatusById( + const byId = cacheFunctions.getBurialSiteStatusById( burialSiteStatus.burialSiteStatusId ) assert.strictEqual( @@ -33,7 +33,7 @@ await describe('functions.cache', async () => { ) const byName = - await cacheFunctions.getBurialSiteStatusByBurialSiteStatus( + cacheFunctions.getBurialSiteStatusByBurialSiteStatus( burialSiteStatus.burialSiteStatus ) assert.strictEqual( @@ -43,28 +43,28 @@ await describe('functions.cache', async () => { } }) - await it('returns undefined with a bad burialSiteStatusId', async () => { - const byBadId = await cacheFunctions.getBurialSiteStatusById(badId) + await it('returns undefined with a bad burialSiteStatusId', () => { + const byBadId = cacheFunctions.getBurialSiteStatusById(badId) assert.ok(byBadId === undefined) }) - await it('returns undefined with a bad lotStatus', async () => { + await it('returns undefined with a bad lotStatus', () => { const byBadName = - await cacheFunctions.getBurialSiteStatusByBurialSiteStatus(badName) + cacheFunctions.getBurialSiteStatusByBurialSiteStatus(badName) assert.ok(byBadName === undefined) }) }) await describe('Burial Site Types', async () => { - await it('returns Burial Site Types', async () => { + await it('returns Burial Site Types', () => { cacheFunctions.clearCacheByTableName('BurialSiteTypes') - const burialSiteTypes = await cacheFunctions.getBurialSiteTypes() + const burialSiteTypes = cacheFunctions.getBurialSiteTypes() assert.ok(burialSiteTypes.length > 0) for (const burialSiteType of burialSiteTypes) { - const byId = await cacheFunctions.getBurialSiteTypeById( + const byId = cacheFunctions.getBurialSiteTypeById( burialSiteType.burialSiteTypeId ) assert.strictEqual( @@ -72,7 +72,7 @@ await describe('functions.cache', async () => { byId?.burialSiteTypeId ) - const byName = await cacheFunctions.getBurialSiteTypesByBurialSiteType( + const byName = cacheFunctions.getBurialSiteTypesByBurialSiteType( burialSiteType.burialSiteType ) assert.strictEqual( @@ -82,84 +82,84 @@ await describe('functions.cache', async () => { } }) - await it('returns undefined with a bad burialSiteTypeId', async () => { - const byBadId = await cacheFunctions.getBurialSiteTypeById(badId) + await it('returns undefined with a bad burialSiteTypeId', () => { + const byBadId = cacheFunctions.getBurialSiteTypeById(badId) assert.ok(byBadId === undefined) }) - await it('returns undefined with a bad lotType', async () => { + await it('returns undefined with a bad lotType', () => { const byBadName = - await cacheFunctions.getBurialSiteTypesByBurialSiteType(badName) + cacheFunctions.getBurialSiteTypesByBurialSiteType(badName) assert.ok(byBadName === undefined) }) }) await describe('Contract Types', async () => { - await it('returns Contract Types', async () => { + await it('returns Contract Types', () => { cacheFunctions.clearCacheByTableName('ContractTypes') - const contractTypes = await cacheFunctions.getContractTypes() + const contractTypes = cacheFunctions.getContractTypes() assert.ok(contractTypes.length > 0) for (const contractType of contractTypes) { - const byId = await cacheFunctions.getContractTypeById( + const byId = cacheFunctions.getContractTypeById( contractType.contractTypeId ) assert.strictEqual(contractType.contractTypeId, byId?.contractTypeId) - const byName = await cacheFunctions.getContractTypeByContractType( + const byName = cacheFunctions.getContractTypeByContractType( contractType.contractType ) assert.strictEqual(contractType.contractType, byName?.contractType) } }) - await it('returns undefined with a bad contractTypeId', async () => { - const byBadId = await cacheFunctions.getContractTypeById(badId) + await it('returns undefined with a bad contractTypeId', () => { + const byBadId = cacheFunctions.getContractTypeById(badId) assert.ok(byBadId === undefined) }) - await it('returns undefined with a bad contractType', async () => { + await it('returns undefined with a bad contractType', () => { const byBadName = - await cacheFunctions.getContractTypeByContractType(badName) + cacheFunctions.getContractTypeByContractType(badName) assert.ok(byBadName === undefined) }) }) await describe('Work Order Types', async () => { - await it('returns Work Order Types', async () => { + await it('returns Work Order Types', () => { cacheFunctions.clearCacheByTableName('WorkOrderTypes') - const workOrderTypes = await cacheFunctions.getWorkOrderTypes() + const workOrderTypes = cacheFunctions.getWorkOrderTypes() assert.ok(workOrderTypes.length > 0) for (const workOrderType of workOrderTypes) { - const byId = await cacheFunctions.getWorkOrderTypeById( + const byId = cacheFunctions.getWorkOrderTypeById( workOrderType.workOrderTypeId ) assert.strictEqual(workOrderType.workOrderTypeId, byId?.workOrderTypeId) } }) - await it('returns undefined with a bad workOrderTypeId', async () => { - const byBadId = await cacheFunctions.getWorkOrderTypeById(badId) + await it('returns undefined with a bad workOrderTypeId', () => { + const byBadId = cacheFunctions.getWorkOrderTypeById(badId) assert.ok(byBadId === undefined) }) }) await describe('Work Order Milestone Types', async () => { - await it('returns Work Order Milestone Types', async () => { + await it('returns Work Order Milestone Types', () => { cacheFunctions.clearCacheByTableName('WorkOrderMilestoneTypes') const workOrderMilestoneTypes = - await cacheFunctions.getWorkOrderMilestoneTypes() + cacheFunctions.getWorkOrderMilestoneTypes() assert.ok(workOrderMilestoneTypes.length > 0) for (const workOrderMilestoneType of workOrderMilestoneTypes) { - const byId = await cacheFunctions.getWorkOrderMilestoneTypeById( + const byId = cacheFunctions.getWorkOrderMilestoneTypeById( workOrderMilestoneType.workOrderMilestoneTypeId ) assert.strictEqual( @@ -168,7 +168,7 @@ await describe('functions.cache', async () => { ) const byName = - await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType( + cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType( workOrderMilestoneType.workOrderMilestoneType ) assert.strictEqual( @@ -178,14 +178,14 @@ await describe('functions.cache', async () => { } }) - await it('returns undefined with a bad workOrderMilestoneTypeId', async () => { - const byBadId = await cacheFunctions.getWorkOrderMilestoneTypeById(badId) + await it('returns undefined with a bad workOrderMilestoneTypeId', () => { + const byBadId = cacheFunctions.getWorkOrderMilestoneTypeById(badId) assert.ok(byBadId === undefined) }) - await it('returns undefined with a bad workOrderMilestoneType', async () => { + await it('returns undefined with a bad workOrderMilestoneType', () => { const byBadName = - await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType( + cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType( badName ) assert.ok(byBadName === undefined) diff --git a/views/burialSite-edit.ejs b/views/burialSite-edit.ejs index 9777eede..9c1357e8 100644 --- a/views/burialSite-edit.ejs +++ b/views/burialSite-edit.ejs @@ -470,31 +470,31 @@ Contracts - <% if (activeCount > 0) { %> -
- - - +
+
+ <% if (activeCount > 0) { %> + + + + + + <%= activeCount %> + Active + - - <%= activeCount %> - Active + <% } %> + <% if (pastCount > 0) { %> + + + + + + <%= pastCount %> Past + - + <% } %>
- <% } %> - <% if (pastCount > 0) { %> -
- - - - - - <%= pastCount %> Past - - -
- <% } %> +
@@ -526,7 +526,7 @@ - + diff --git a/views/burialSite-view.ejs b/views/burialSite-view.ejs index 906a983d..6e7d7939 100644 --- a/views/burialSite-view.ejs +++ b/views/burialSite-view.ejs @@ -221,43 +221,41 @@

Contracts

- <% if (activeCount > 0) { %> -
- - - +
+
+ <% if (activeCount > 0) { %> + + + + + + <%= activeCount %> + Active + - - <%= activeCount %> - Active + <% } %> + <% if (pastCount > 0) { %> + + + + + + <%= pastCount %> Past + - -
- <% } %> - <% if (pastCount > 0) { %> -
- - - - - - <%= pastCount %> Past - - -
- <% } %> -
- <% if (burialSite.contracts.length > 0) { %> -
-
- + <% } %>
- <% } %> +
+
+
+ +
+
@@ -271,7 +269,7 @@
   Contract Type Contract Date End Date
- + diff --git a/views/workOrder-edit.ejs b/views/workOrder-edit.ejs index 93ac174f..774bf29c 100644 --- a/views/workOrder-edit.ejs +++ b/views/workOrder-edit.ejs @@ -216,7 +216,7 @@
-

Related Burial Sites

+

Related Contracts

   Contract Type Contract Date End Date