rename `getProperty` to `getConfigProperty`

deepsource-autofix-76c6eb20
Dan Gowans 2024-06-24 09:05:17 -04:00
parent 2323250627
commit 1a28c38066
137 changed files with 607 additions and 602 deletions

16
app.js
View File

@ -33,12 +33,12 @@ databaseInitializer.initializeDatabase();
const _dirname = '.'; const _dirname = '.';
export const app = express(); export const app = express();
app.disable('X-Powered-By'); app.disable('X-Powered-By');
if (!configFunctions.getProperty('reverseProxy.disableEtag')) { if (!configFunctions.getConfigProperty('reverseProxy.disableEtag')) {
app.set('etag', false); app.set('etag', false);
} }
app.set('views', path.join(_dirname, 'views')); app.set('views', path.join(_dirname, 'views'));
app.set('view engine', 'ejs'); app.set('view engine', 'ejs');
if (!configFunctions.getProperty('reverseProxy.disableCompression')) { if (!configFunctions.getConfigProperty('reverseProxy.disableCompression')) {
app.use(compression()); app.use(compression());
} }
app.use((request, _response, next) => { app.use((request, _response, next) => {
@ -57,7 +57,7 @@ app.use(rateLimit({
windowMs: 10_000, windowMs: 10_000,
max: useTestDatabases ? 1_000_000 : 200 max: useTestDatabases ? 1_000_000 : 200
})); }));
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix'); const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
if (urlPrefix !== '') { if (urlPrefix !== '') {
debug(`urlPrefix = ${urlPrefix}`); debug(`urlPrefix = ${urlPrefix}`);
} }
@ -68,7 +68,7 @@ app.use(`${urlPrefix}/lib/cityssm-bulma-webapp-js`, express.static(path.join('no
app.use(`${urlPrefix}/lib/fa`, express.static(path.join('node_modules', '@fortawesome', 'fontawesome-free'))); app.use(`${urlPrefix}/lib/fa`, express.static(path.join('node_modules', '@fortawesome', 'fontawesome-free')));
app.use(`${urlPrefix}/lib/leaflet`, express.static(path.join('node_modules', 'leaflet', 'dist'))); app.use(`${urlPrefix}/lib/leaflet`, express.static(path.join('node_modules', 'leaflet', 'dist')));
app.use(`${urlPrefix}/lib/randomcolor/randomColor.js`, express.static(path.join('node_modules', 'randomcolor', 'randomColor.js'))); app.use(`${urlPrefix}/lib/randomcolor/randomColor.js`, express.static(path.join('node_modules', 'randomcolor', 'randomColor.js')));
const sessionCookieName = configFunctions.getProperty('session.cookieName'); const sessionCookieName = configFunctions.getConfigProperty('session.cookieName');
const FileStoreSession = FileStore(session); const FileStoreSession = FileStore(session);
app.use(session({ app.use(session({
store: new FileStoreSession({ store: new FileStoreSession({
@ -77,12 +77,12 @@ app.use(session({
retries: 20 retries: 20
}), }),
name: sessionCookieName, name: sessionCookieName,
secret: configFunctions.getProperty('session.secret'), secret: configFunctions.getConfigProperty('session.secret'),
resave: true, resave: true,
saveUninitialized: false, saveUninitialized: false,
rolling: true, rolling: true,
cookie: { cookie: {
maxAge: configFunctions.getProperty('session.maxAgeMillis'), maxAge: configFunctions.getConfigProperty('session.maxAgeMillis'),
sameSite: 'strict' sameSite: 'strict'
} }
})); }));
@ -111,7 +111,7 @@ app.use((request, response, next) => {
response.locals.dateTimeFunctions = dateTimeFns; response.locals.dateTimeFunctions = dateTimeFns;
response.locals.stringFunctions = stringFns; response.locals.stringFunctions = stringFns;
response.locals.htmlFunctions = htmlFns; response.locals.htmlFunctions = htmlFns;
response.locals.urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix'); response.locals.urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
next(); next();
}); });
app.get(`${urlPrefix}/`, sessionChecker, (_request, response) => { app.get(`${urlPrefix}/`, sessionChecker, (_request, response) => {
@ -126,7 +126,7 @@ app.use(`${urlPrefix}/lotOccupancies`, sessionChecker, routerLotOccupancies);
app.use(`${urlPrefix}/workOrders`, sessionChecker, routerWorkOrders); app.use(`${urlPrefix}/workOrders`, sessionChecker, routerWorkOrders);
app.use(`${urlPrefix}/reports`, sessionChecker, routerReports); app.use(`${urlPrefix}/reports`, sessionChecker, routerReports);
app.use(`${urlPrefix}/admin`, sessionChecker, permissionHandlers.adminGetHandler, routerAdmin); app.use(`${urlPrefix}/admin`, sessionChecker, permissionHandlers.adminGetHandler, routerAdmin);
if (configFunctions.getProperty('session.doKeepAlive')) { if (configFunctions.getConfigProperty('session.doKeepAlive')) {
app.all(`${urlPrefix}/keepAlive`, (_request, response) => { app.all(`${urlPrefix}/keepAlive`, (_request, response) => {
response.json(true); response.json(true);
}); });

16
app.ts
View File

@ -49,7 +49,7 @@ export const app = express()
app.disable('X-Powered-By') app.disable('X-Powered-By')
if (!configFunctions.getProperty('reverseProxy.disableEtag')) { if (!configFunctions.getConfigProperty('reverseProxy.disableEtag')) {
app.set('etag', false) app.set('etag', false)
} }
@ -57,7 +57,7 @@ if (!configFunctions.getProperty('reverseProxy.disableEtag')) {
app.set('views', path.join(_dirname, 'views')) app.set('views', path.join(_dirname, 'views'))
app.set('view engine', 'ejs') app.set('view engine', 'ejs')
if (!configFunctions.getProperty('reverseProxy.disableCompression')) { if (!configFunctions.getConfigProperty('reverseProxy.disableCompression')) {
app.use(compression()) app.use(compression())
} }
@ -96,7 +96,7 @@ app.use(
* STATIC ROUTES * STATIC ROUTES
*/ */
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix') const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix')
if (urlPrefix !== '') { if (urlPrefix !== '') {
debug(`urlPrefix = ${urlPrefix}`) debug(`urlPrefix = ${urlPrefix}`)
@ -143,7 +143,7 @@ app.use(
*/ */
const sessionCookieName: string = const sessionCookieName: string =
configFunctions.getProperty('session.cookieName') configFunctions.getConfigProperty('session.cookieName')
const FileStoreSession = FileStore(session) const FileStoreSession = FileStore(session)
@ -156,12 +156,12 @@ app.use(
retries: 20 retries: 20
}), }),
name: sessionCookieName, name: sessionCookieName,
secret: configFunctions.getProperty('session.secret'), secret: configFunctions.getConfigProperty('session.secret'),
resave: true, resave: true,
saveUninitialized: false, saveUninitialized: false,
rolling: true, rolling: true,
cookie: { cookie: {
maxAge: configFunctions.getProperty('session.maxAgeMillis'), maxAge: configFunctions.getConfigProperty('session.maxAgeMillis'),
sameSite: 'strict' sameSite: 'strict'
} }
}) })
@ -218,7 +218,7 @@ app.use((request, response, next) => {
response.locals.stringFunctions = stringFns response.locals.stringFunctions = stringFns
response.locals.htmlFunctions = htmlFns response.locals.htmlFunctions = htmlFns
response.locals.urlPrefix = configFunctions.getProperty( response.locals.urlPrefix = configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
) )
@ -251,7 +251,7 @@ app.use(
routerAdmin routerAdmin
) )
if (configFunctions.getProperty('session.doKeepAlive')) { if (configFunctions.getConfigProperty('session.doKeepAlive')) {
app.all(`${urlPrefix}/keepAlive`, (_request, response) => { app.all(`${urlPrefix}/keepAlive`, (_request, response) => {
response.json(true) response.json(true)
}) })

View File

@ -8,8 +8,8 @@ import exitHook from 'exit-hook';
import * as configFunctions from '../helpers/functions.config.js'; import * as configFunctions from '../helpers/functions.config.js';
const debug = Debug(`lot-occupancy-system:www:${process.pid}`); const debug = Debug(`lot-occupancy-system:www:${process.pid}`);
const directoryName = dirname(fileURLToPath(import.meta.url)); const directoryName = dirname(fileURLToPath(import.meta.url));
const processCount = Math.min(configFunctions.getProperty('application.maximumProcesses'), os.cpus().length); const processCount = Math.min(configFunctions.getConfigProperty('application.maximumProcesses'), os.cpus().length);
process.title = `${configFunctions.getProperty('application.applicationName')} (Primary)`; process.title = `${configFunctions.getConfigProperty('application.applicationName')} (Primary)`;
debug(`Primary pid: ${process.pid}`); debug(`Primary pid: ${process.pid}`);
debug(`Primary title: ${process.title}`); debug(`Primary title: ${process.title}`);
debug(`Launching ${processCount} processes`); debug(`Launching ${processCount} processes`);
@ -37,19 +37,19 @@ cluster.on('exit', (worker) => {
debug('Starting another worker'); debug('Starting another worker');
cluster.fork(); cluster.fork();
}); });
const ntfyStartupConfig = configFunctions.getProperty('application.ntfyStartup'); const ntfyStartupConfig = configFunctions.getConfigProperty('application.ntfyStartup');
if (ntfyStartupConfig !== undefined) { if (ntfyStartupConfig !== undefined) {
const topic = ntfyStartupConfig.topic; const topic = ntfyStartupConfig.topic;
const server = ntfyStartupConfig.server; const server = ntfyStartupConfig.server;
const ntfyStartupMessage = { const ntfyStartupMessage = {
topic, topic,
title: configFunctions.getProperty('application.applicationName'), title: configFunctions.getConfigProperty('application.applicationName'),
message: 'Application Started', message: 'Application Started',
tags: ['arrow_up'] tags: ['arrow_up']
}; };
const ntfyShutdownMessage = { const ntfyShutdownMessage = {
topic, topic,
title: configFunctions.getProperty('application.applicationName'), title: configFunctions.getConfigProperty('application.applicationName'),
message: 'Application Shut Down', message: 'Application Shut Down',
tags: ['arrow_down'] tags: ['arrow_down']
}; };

View File

@ -15,11 +15,11 @@ const debug = Debug(`lot-occupancy-system:www:${process.pid}`)
const directoryName = dirname(fileURLToPath(import.meta.url)) const directoryName = dirname(fileURLToPath(import.meta.url))
const processCount = Math.min( const processCount = Math.min(
configFunctions.getProperty('application.maximumProcesses'), configFunctions.getConfigProperty('application.maximumProcesses'),
os.cpus().length os.cpus().length
) )
process.title = `${configFunctions.getProperty( process.title = `${configFunctions.getConfigProperty(
'application.applicationName' 'application.applicationName'
)} (Primary)` )} (Primary)`
@ -59,7 +59,7 @@ cluster.on('exit', (worker) => {
cluster.fork() cluster.fork()
}) })
const ntfyStartupConfig = configFunctions.getProperty('application.ntfyStartup') const ntfyStartupConfig = configFunctions.getConfigProperty('application.ntfyStartup')
if (ntfyStartupConfig !== undefined) { if (ntfyStartupConfig !== undefined) {
const topic = ntfyStartupConfig.topic const topic = ntfyStartupConfig.topic
@ -67,14 +67,14 @@ if (ntfyStartupConfig !== undefined) {
const ntfyStartupMessage: NtfyMessageOptions = { const ntfyStartupMessage: NtfyMessageOptions = {
topic, topic,
title: configFunctions.getProperty('application.applicationName'), title: configFunctions.getConfigProperty('application.applicationName'),
message: 'Application Started', message: 'Application Started',
tags: ['arrow_up'] tags: ['arrow_up']
} }
const ntfyShutdownMessage: NtfyMessageOptions = { const ntfyShutdownMessage: NtfyMessageOptions = {
topic, topic,
title: configFunctions.getProperty('application.applicationName'), title: configFunctions.getConfigProperty('application.applicationName'),
message: 'Application Shut Down', message: 'Application Shut Down',
tags: ['arrow_down'] tags: ['arrow_down']
} }

View File

@ -29,8 +29,8 @@ function onListening(server) {
debug(`HTTP Listening on ${bind}`); debug(`HTTP Listening on ${bind}`);
} }
} }
process.title = `${configFunctions.getProperty('application.applicationName')} (Worker)`; process.title = `${configFunctions.getConfigProperty('application.applicationName')} (Worker)`;
const httpPort = configFunctions.getProperty('application.httpPort'); const httpPort = configFunctions.getConfigProperty('application.httpPort');
const httpServer = http.createServer(app); const httpServer = http.createServer(app);
httpServer.listen(httpPort); httpServer.listen(httpPort);
httpServer.on('error', onError); httpServer.on('error', onError);

View File

@ -58,11 +58,11 @@ function onListening(server: http.Server): void {
* Initialize HTTP * Initialize HTTP
*/ */
process.title = `${configFunctions.getProperty( process.title = `${configFunctions.getConfigProperty(
'application.applicationName' 'application.applicationName'
)} (Worker)` )} (Worker)`
const httpPort = configFunctions.getProperty('application.httpPort') const httpPort = configFunctions.getConfigProperty('application.httpPort')
const httpServer = http.createServer(app) const httpServer = http.createServer(app)

View File

@ -40,7 +40,7 @@ describe('Admin - Fee Management', () => {
cy.get(".modal input[name='taxPercentage']") cy.get(".modal input[name='taxPercentage']")
.invoke('val') .invoke('val')
.should('equal', configFunctions .should('equal', configFunctions
.getProperty('settings.fees.taxPercentageDefault') .getConfigProperty('settings.fees.taxPercentageDefault')
.toString()); .toString());
cy.get(".modal input[name='quantityUnit']").should('be.disabled'); cy.get(".modal input[name='quantityUnit']").should('be.disabled');
cy.get(".modal select[name='includeQuantity']").select('1'); cy.get(".modal select[name='includeQuantity']").select('1');

View File

@ -67,7 +67,7 @@ describe('Admin - Fee Management', () => {
.should( .should(
'equal', 'equal',
configFunctions configFunctions
.getProperty('settings.fees.taxPercentageDefault') .getConfigProperty('settings.fees.taxPercentageDefault')
.toString() .toString()
) )

View File

@ -37,8 +37,8 @@ describe('Update - Maps', () => {
.type(mapJSON.mapLongitude.toString()); .type(mapJSON.mapLongitude.toString());
}); });
cy.log('Ensure the default city and province are used'); cy.log('Ensure the default city and province are used');
cy.get("input[name='mapCity']").should('have.value', configFunctions.getProperty('settings.map.mapCityDefault')); cy.get("input[name='mapCity']").should('have.value', configFunctions.getConfigProperty('settings.map.mapCityDefault'));
cy.get("input[name='mapProvince']").should('have.value', configFunctions.getProperty('settings.map.mapProvinceDefault')); cy.get("input[name='mapProvince']").should('have.value', configFunctions.getConfigProperty('settings.map.mapProvinceDefault'));
cy.log('Submit the form'); cy.log('Submit the form');
cy.get('#form--map').submit(); cy.get('#form--map').submit();
cy.wait(1000); cy.wait(1000);
@ -50,8 +50,8 @@ describe('Update - Maps', () => {
cy.get("textarea[name='mapDescription']").should('have.value', mapJSON.mapDescription); cy.get("textarea[name='mapDescription']").should('have.value', mapJSON.mapDescription);
cy.get("input[name='mapAddress1']").should('have.value', mapJSON.mapAddress1); cy.get("input[name='mapAddress1']").should('have.value', mapJSON.mapAddress1);
cy.get("input[name='mapAddress2']").should('have.value', mapJSON.mapAddress2); cy.get("input[name='mapAddress2']").should('have.value', mapJSON.mapAddress2);
cy.get("input[name='mapCity']").should('have.value', configFunctions.getProperty('settings.map.mapCityDefault')); cy.get("input[name='mapCity']").should('have.value', configFunctions.getConfigProperty('settings.map.mapCityDefault'));
cy.get("input[name='mapProvince']").should('have.value', configFunctions.getProperty('settings.map.mapProvinceDefault')); cy.get("input[name='mapProvince']").should('have.value', configFunctions.getConfigProperty('settings.map.mapProvinceDefault'));
cy.get("input[name='mapPostalCode']").should('have.value', mapJSON.mapPostalCode); cy.get("input[name='mapPostalCode']").should('have.value', mapJSON.mapPostalCode);
cy.get("input[name='mapPhoneNumber']").should('have.value', mapJSON.mapPhoneNumber); cy.get("input[name='mapPhoneNumber']").should('have.value', mapJSON.mapPhoneNumber);
cy.get("input[name='mapLatitude']").should('have.value', mapJSON.mapLatitude.toString()); cy.get("input[name='mapLatitude']").should('have.value', mapJSON.mapLatitude.toString());

View File

@ -56,12 +56,12 @@ describe('Update - Maps', () => {
cy.get("input[name='mapCity']").should( cy.get("input[name='mapCity']").should(
'have.value', 'have.value',
configFunctions.getProperty('settings.map.mapCityDefault') configFunctions.getConfigProperty('settings.map.mapCityDefault')
) )
cy.get("input[name='mapProvince']").should( cy.get("input[name='mapProvince']").should(
'have.value', 'have.value',
configFunctions.getProperty('settings.map.mapProvinceDefault') configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
) )
cy.log('Submit the form') cy.log('Submit the form')
@ -93,11 +93,11 @@ describe('Update - Maps', () => {
cy.get("input[name='mapCity']").should( cy.get("input[name='mapCity']").should(
'have.value', 'have.value',
configFunctions.getProperty('settings.map.mapCityDefault') configFunctions.getConfigProperty('settings.map.mapCityDefault')
) )
cy.get("input[name='mapProvince']").should( cy.get("input[name='mapProvince']").should(
'have.value', 'have.value',
configFunctions.getProperty('settings.map.mapProvinceDefault') configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
) )
cy.get("input[name='mapPostalCode']").should( cy.get("input[name='mapPostalCode']").should(

View File

@ -1,7 +1,7 @@
import * as configFunctions from '../helpers/functions.config.js'; import * as configFunctions from '../helpers/functions.config.js';
import Debug from 'debug'; import Debug from 'debug';
const debug = Debug('lot-occupancy-system:databasePaths'); const debug = Debug('lot-occupancy-system:databasePaths');
export const useTestDatabases = configFunctions.getProperty('application.useTestDatabases') || export const useTestDatabases = configFunctions.getConfigProperty('application.useTestDatabases') ||
process.env.TEST_DATABASES === 'true'; process.env.TEST_DATABASES === 'true';
if (useTestDatabases) { if (useTestDatabases) {
debug('Using "-testing" databases.'); debug('Using "-testing" databases.');

View File

@ -6,7 +6,7 @@ const debug = Debug('lot-occupancy-system:databasePaths')
// Determine if test databases should be used // Determine if test databases should be used
export const useTestDatabases = export const useTestDatabases =
configFunctions.getProperty('application.useTestDatabases') || configFunctions.getConfigProperty('application.useTestDatabases') ||
process.env.TEST_DATABASES === 'true' process.env.TEST_DATABASES === 'true'
if (useTestDatabases) { if (useTestDatabases) {

View File

@ -4,7 +4,7 @@ export default async function cleanupDatabase(user) {
const database = await acquireConnection(); const database = await acquireConnection();
const rightNowMillis = Date.now(); const rightNowMillis = Date.now();
const recordDeleteTimeMillisMin = rightNowMillis - const recordDeleteTimeMillisMin = rightNowMillis -
configFunctions.getProperty('settings.adminCleanup.recordDeleteAgeDays') * configFunctions.getConfigProperty('settings.adminCleanup.recordDeleteAgeDays') *
86_400 * 86_400 *
1000; 1000;
let inactivatedRecordCount = 0; let inactivatedRecordCount = 0;

View File

@ -10,7 +10,7 @@ export default async function cleanupDatabase(
const rightNowMillis = Date.now() const rightNowMillis = Date.now()
const recordDeleteTimeMillisMin = const recordDeleteTimeMillisMin =
rightNowMillis - rightNowMillis -
configFunctions.getProperty('settings.adminCleanup.recordDeleteAgeDays') * configFunctions.getConfigProperty('settings.adminCleanup.recordDeleteAgeDays') *
86_400 * 86_400 *
1000 1000

View File

@ -116,7 +116,7 @@ export async function getLotOccupancies(filters, options, connectedDatabase) {
const occupancyType = await getOccupancyTypeById(lotOccupancy.occupancyTypeId); const occupancyType = await getOccupancyTypeById(lotOccupancy.occupancyTypeId);
if (occupancyType !== undefined) { if (occupancyType !== undefined) {
lotOccupancy.printEJS = (occupancyType.occupancyTypePrints ?? []).includes('*') lotOccupancy.printEJS = (occupancyType.occupancyTypePrints ?? []).includes('*')
? configFunctions.getProperty('settings.lotOccupancy.prints')[0] ? configFunctions.getConfigProperty('settings.lotOccupancy.prints')[0]
: occupancyType.occupancyTypePrints[0]; : occupancyType.occupancyTypePrints[0];
} }
await addInclusions(lotOccupancy, options, database); await addInclusions(lotOccupancy, options, database);

View File

@ -222,7 +222,7 @@ export async function getLotOccupancies(
lotOccupancy.printEJS = ( lotOccupancy.printEJS = (
occupancyType.occupancyTypePrints ?? [] occupancyType.occupancyTypePrints ?? []
).includes('*') ).includes('*')
? configFunctions.getProperty('settings.lotOccupancy.prints')[0] ? configFunctions.getConfigProperty('settings.lotOccupancy.prints')[0]
: occupancyType.occupancyTypePrints![0] : occupancyType.occupancyTypePrints![0]
} }

View File

@ -20,7 +20,7 @@ export async function getLotOccupancyTransactions(lotOccupancyId, options, conne
database.release(); database.release();
} }
if ((options?.includeIntegrations ?? false) && if ((options?.includeIntegrations ?? false) &&
configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) { configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
for (const transaction of lotOccupancyTransactions) { for (const transaction of lotOccupancyTransactions) {
if ((transaction.externalReceiptNumber ?? '') !== '') { if ((transaction.externalReceiptNumber ?? '') !== '') {
const gpDocument = await gpFunctions.getDynamicsGPDocument(transaction.externalReceiptNumber ?? ''); const gpDocument = await gpFunctions.getDynamicsGPDocument(transaction.externalReceiptNumber ?? '');

View File

@ -41,7 +41,7 @@ export async function getLotOccupancyTransactions(
if ( if (
(options?.includeIntegrations ?? false) && (options?.includeIntegrations ?? false) &&
configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled') configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')
) { ) {
for (const transaction of lotOccupancyTransactions) { for (const transaction of lotOccupancyTransactions) {
if ((transaction.externalReceiptNumber ?? '') !== '') { if ((transaction.externalReceiptNumber ?? '') !== '') {

View File

@ -61,7 +61,7 @@ export async function getLots(filters, options, connectedDatabase) {
let lots = []; let lots = [];
if (options.limit === -1 || count > 0) { if (options.limit === -1 || count > 0) {
const includeLotOccupancyCount = options.includeLotOccupancyCount ?? true; const includeLotOccupancyCount = options.includeLotOccupancyCount ?? true;
database.function('userFn_lotNameSortName', configFunctions.getProperty('settings.lot.lotNameSortNameFunction')); database.function('userFn_lotNameSortName', configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction'));
if (includeLotOccupancyCount) { if (includeLotOccupancyCount) {
sqlParameters.unshift(currentDate, currentDate); sqlParameters.unshift(currentDate, currentDate);
} }

View File

@ -113,7 +113,7 @@ export async function getLots(
database.function( database.function(
'userFn_lotNameSortName', 'userFn_lotNameSortName',
configFunctions.getProperty('settings.lot.lotNameSortNameFunction') configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction')
) )
if (includeLotOccupancyCount) { if (includeLotOccupancyCount) {

View File

@ -2,7 +2,7 @@ import * as configFunctions from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
export async function getNextLotId(lotId) { export async function getNextLotId(lotId) {
const database = await acquireConnection(); const database = await acquireConnection();
database.function('userFn_lotNameSortName', configFunctions.getProperty('settings.lot.lotNameSortNameFunction')); database.function('userFn_lotNameSortName', configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction'));
const result = database const result = database
.prepare(`select lotId .prepare(`select lotId
from Lots from Lots

View File

@ -9,7 +9,7 @@ export async function getNextLotId(
database.function( database.function(
'userFn_lotNameSortName', 'userFn_lotNameSortName',
configFunctions.getProperty('settings.lot.lotNameSortNameFunction') configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction')
) )
const result = database const result = database

View File

@ -2,7 +2,7 @@ import * as configFunctions from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
export async function getNextWorkOrderNumber(connectedDatabase) { export async function getNextWorkOrderNumber(connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection()); const database = connectedDatabase ?? (await acquireConnection());
const paddingLength = configFunctions.getProperty('settings.workOrders.workOrderNumberLength'); const paddingLength = configFunctions.getConfigProperty('settings.workOrders.workOrderNumberLength');
const currentYearString = new Date().getFullYear().toString(); const currentYearString = new Date().getFullYear().toString();
const regex = new RegExp('^' + currentYearString + '-\\d+$'); const regex = new RegExp('^' + currentYearString + '-\\d+$');
database.function('userFn_matchesWorkOrderNumberSyntax', (workOrderNumber) => { database.function('userFn_matchesWorkOrderNumberSyntax', (workOrderNumber) => {

View File

@ -9,7 +9,7 @@ export async function getNextWorkOrderNumber(
): Promise<string> { ): Promise<string> {
const database = connectedDatabase ?? (await acquireConnection()) const database = connectedDatabase ?? (await acquireConnection())
const paddingLength = configFunctions.getProperty( const paddingLength = configFunctions.getConfigProperty(
'settings.workOrders.workOrderNumberLength' 'settings.workOrders.workOrderNumberLength'
) )
const currentYearString = new Date().getFullYear().toString() const currentYearString = new Date().getFullYear().toString()

View File

@ -1,6 +1,6 @@
import * as configFunctions from '../helpers/functions.config.js'; import * as configFunctions from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
const availablePrints = configFunctions.getProperty('settings.lotOccupancy.prints'); const availablePrints = configFunctions.getConfigProperty('settings.lotOccupancy.prints');
const userFunction_configContainsPrintEJS = (printEJS) => { const userFunction_configContainsPrintEJS = (printEJS) => {
if (printEJS === '*' || availablePrints.includes(printEJS)) { if (printEJS === '*' || availablePrints.includes(printEJS)) {
return 1; return 1;

View File

@ -4,7 +4,7 @@ import * as configFunctions from '../helpers/functions.config.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
const availablePrints = configFunctions.getProperty( const availablePrints = configFunctions.getConfigProperty(
'settings.lotOccupancy.prints' 'settings.lotOccupancy.prints'
) )

View File

@ -2,7 +2,7 @@ import * as configFunctions from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
export async function getPreviousLotId(lotId) { export async function getPreviousLotId(lotId) {
const database = await acquireConnection(); const database = await acquireConnection();
database.function('userFn_lotNameSortName', configFunctions.getProperty('settings.lot.lotNameSortNameFunction')); database.function('userFn_lotNameSortName', configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction'));
const result = database const result = database
.prepare(`select lotId from Lots .prepare(`select lotId from Lots
where recordDelete_timeMillis is null where recordDelete_timeMillis is null

View File

@ -9,7 +9,7 @@ export async function getPreviousLotId(
database.function( database.function(
'userFn_lotNameSortName', 'userFn_lotNameSortName',
configFunctions.getProperty('settings.lot.lotNameSortNameFunction') configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction')
) )
const result = database const result = database

View File

@ -2,7 +2,7 @@ import * as dateTimeFunctions from '@cityssm/utils-datetime';
import camelCase from 'camelcase'; import camelCase from 'camelcase';
import * as configFunctions from '../helpers/functions.config.js'; import * as configFunctions from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
const mapCamelCase = camelCase(configFunctions.getProperty('aliases.map')); const mapCamelCase = camelCase(configFunctions.getConfigProperty('aliases.map'));
const mapNameAlias = `${mapCamelCase}Name`; const mapNameAlias = `${mapCamelCase}Name`;
const mapDescriptionAlias = `${mapCamelCase}Description`; const mapDescriptionAlias = `${mapCamelCase}Description`;
const mapAddress1Alias = `${mapCamelCase}Address1`; const mapAddress1Alias = `${mapCamelCase}Address1`;
@ -11,17 +11,17 @@ const mapCityAlias = `${mapCamelCase}City`;
const mapProvinceAlias = `${mapCamelCase}Province`; const mapProvinceAlias = `${mapCamelCase}Province`;
const mapPostalCodeAlias = `${mapCamelCase}PostalCode`; const mapPostalCodeAlias = `${mapCamelCase}PostalCode`;
const mapPhoneNumberAlias = `${mapCamelCase}PhoneNumber`; const mapPhoneNumberAlias = `${mapCamelCase}PhoneNumber`;
const lotCamelCase = camelCase(configFunctions.getProperty('aliases.lot')); const lotCamelCase = camelCase(configFunctions.getConfigProperty('aliases.lot'));
const lotIdAlias = `${lotCamelCase}Id`; const lotIdAlias = `${lotCamelCase}Id`;
const lotNameAlias = `${lotCamelCase}Name`; const lotNameAlias = `${lotCamelCase}Name`;
const lotTypeAlias = `${lotCamelCase}Type`; const lotTypeAlias = `${lotCamelCase}Type`;
const lotStatusAlias = `${lotCamelCase}Status`; const lotStatusAlias = `${lotCamelCase}Status`;
const occupancyCamelCase = camelCase(configFunctions.getProperty('aliases.occupancy')); const occupancyCamelCase = camelCase(configFunctions.getConfigProperty('aliases.occupancy'));
const lotOccupancyIdAlias = `${occupancyCamelCase}Id`; const lotOccupancyIdAlias = `${occupancyCamelCase}Id`;
const occupancyTypeAlias = `${occupancyCamelCase}Type`; const occupancyTypeAlias = `${occupancyCamelCase}Type`;
const occupancyStartDateAlias = `${occupancyCamelCase}StartDate`; const occupancyStartDateAlias = `${occupancyCamelCase}StartDate`;
const occupancyEndDateAlias = `${occupancyCamelCase}EndDate`; const occupancyEndDateAlias = `${occupancyCamelCase}EndDate`;
const occupantCamelCase = camelCase(configFunctions.getProperty('aliases.occupant')); const occupantCamelCase = camelCase(configFunctions.getConfigProperty('aliases.occupant'));
const lotOccupantIndexAlias = `${occupantCamelCase}Index`; const lotOccupantIndexAlias = `${occupantCamelCase}Index`;
const lotOccupantTypeAlias = `${occupantCamelCase}Type`; const lotOccupantTypeAlias = `${occupantCamelCase}Type`;
const occupantNameAlias = `${occupantCamelCase}Name`; const occupantNameAlias = `${occupantCamelCase}Name`;

View File

@ -10,7 +10,7 @@ import { acquireConnection } from './pool.js'
export type ReportParameters = Record<string, string | number> export type ReportParameters = Record<string, string | number>
const mapCamelCase = camelCase(configFunctions.getProperty('aliases.map')) const mapCamelCase = camelCase(configFunctions.getConfigProperty('aliases.map'))
const mapNameAlias = `${mapCamelCase}Name` const mapNameAlias = `${mapCamelCase}Name`
const mapDescriptionAlias = `${mapCamelCase}Description` const mapDescriptionAlias = `${mapCamelCase}Description`
const mapAddress1Alias = `${mapCamelCase}Address1` const mapAddress1Alias = `${mapCamelCase}Address1`
@ -20,14 +20,14 @@ const mapProvinceAlias = `${mapCamelCase}Province`
const mapPostalCodeAlias = `${mapCamelCase}PostalCode` const mapPostalCodeAlias = `${mapCamelCase}PostalCode`
const mapPhoneNumberAlias = `${mapCamelCase}PhoneNumber` const mapPhoneNumberAlias = `${mapCamelCase}PhoneNumber`
const lotCamelCase = camelCase(configFunctions.getProperty('aliases.lot')) const lotCamelCase = camelCase(configFunctions.getConfigProperty('aliases.lot'))
const lotIdAlias = `${lotCamelCase}Id` const lotIdAlias = `${lotCamelCase}Id`
const lotNameAlias = `${lotCamelCase}Name` const lotNameAlias = `${lotCamelCase}Name`
const lotTypeAlias = `${lotCamelCase}Type` const lotTypeAlias = `${lotCamelCase}Type`
const lotStatusAlias = `${lotCamelCase}Status` const lotStatusAlias = `${lotCamelCase}Status`
const occupancyCamelCase = camelCase( const occupancyCamelCase = camelCase(
configFunctions.getProperty('aliases.occupancy') configFunctions.getConfigProperty('aliases.occupancy')
) )
const lotOccupancyIdAlias = `${occupancyCamelCase}Id` const lotOccupancyIdAlias = `${occupancyCamelCase}Id`
const occupancyTypeAlias = `${occupancyCamelCase}Type` const occupancyTypeAlias = `${occupancyCamelCase}Type`
@ -35,7 +35,7 @@ const occupancyStartDateAlias = `${occupancyCamelCase}StartDate`
const occupancyEndDateAlias = `${occupancyCamelCase}EndDate` const occupancyEndDateAlias = `${occupancyCamelCase}EndDate`
const occupantCamelCase = camelCase( const occupantCamelCase = camelCase(
configFunctions.getProperty('aliases.occupant') configFunctions.getConfigProperty('aliases.occupant')
) )
const lotOccupantIndexAlias = `${occupantCamelCase}Index` const lotOccupantIndexAlias = `${occupantCamelCase}Index`
const lotOccupantTypeAlias = `${occupantCamelCase}Type` const lotOccupantTypeAlias = `${occupantCamelCase}Type`

View File

@ -14,11 +14,11 @@ function buildWhereClause(filters) {
const date = new Date(); const date = new Date();
const currentDateNumber = dateToInteger(date); const currentDateNumber = dateToInteger(date);
date.setDate(date.getDate() - date.setDate(date.getDate() -
configFunctions.getProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays')); configFunctions.getConfigProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays'));
const recentBeforeDateNumber = dateToInteger(date); const recentBeforeDateNumber = dateToInteger(date);
date.setDate(date.getDate() + date.setDate(date.getDate() +
configFunctions.getProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays') + configFunctions.getConfigProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays') +
configFunctions.getProperty('settings.workOrders.workOrderMilestoneDateRecentAfterDays')); configFunctions.getConfigProperty('settings.workOrders.workOrderMilestoneDateRecentAfterDays'));
const recentAfterDateNumber = dateToInteger(date); const recentAfterDateNumber = dateToInteger(date);
switch (filters.workOrderMilestoneDateFilter) { switch (filters.workOrderMilestoneDateFilter) {
case 'upcomingMissed': { case 'upcomingMissed': {

View File

@ -52,7 +52,7 @@ function buildWhereClause(filters: WorkOrderMilestoneFilters): {
date.setDate( date.setDate(
date.getDate() - date.getDate() -
configFunctions.getProperty( configFunctions.getConfigProperty(
'settings.workOrders.workOrderMilestoneDateRecentBeforeDays' 'settings.workOrders.workOrderMilestoneDateRecentBeforeDays'
) )
) )
@ -61,10 +61,10 @@ function buildWhereClause(filters: WorkOrderMilestoneFilters): {
date.setDate( date.setDate(
date.getDate() + date.getDate() +
configFunctions.getProperty( configFunctions.getConfigProperty(
'settings.workOrders.workOrderMilestoneDateRecentBeforeDays' 'settings.workOrders.workOrderMilestoneDateRecentBeforeDays'
) + ) +
configFunctions.getProperty( configFunctions.getConfigProperty(
'settings.workOrders.workOrderMilestoneDateRecentAfterDays' 'settings.workOrders.workOrderMilestoneDateRecentAfterDays'
) )
) )

View File

@ -1,4 +1,5 @@
import { Fee } from '../types/recordTypes.js' import type { Fee } from '../types/recordTypes.js'
import { getFee } from './getFee.js' import { getFee } from './getFee.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js' import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'

View File

@ -1,7 +1,8 @@
import { type DateString, type TimeString } from '@cityssm/utils-datetime';
interface UpdateLotCommentForm { interface UpdateLotCommentForm {
lotCommentId: string | number; lotCommentId: string | number;
lotCommentDateString: string; lotCommentDateString: DateString;
lotCommentTimeString: string; lotCommentTimeString: TimeString;
lotComment: string; lotComment: string;
} }
export declare function updateLotComment(commentForm: UpdateLotCommentForm, user: User): Promise<boolean>; export declare function updateLotComment(commentForm: UpdateLotCommentForm, user: User): Promise<boolean>;

View File

@ -1,4 +1,6 @@
import { import {
type DateString,
type TimeString,
dateStringToInteger, dateStringToInteger,
timeStringToInteger timeStringToInteger
} from '@cityssm/utils-datetime' } from '@cityssm/utils-datetime'
@ -7,8 +9,8 @@ import { acquireConnection } from './pool.js'
interface UpdateLotCommentForm { interface UpdateLotCommentForm {
lotCommentId: string | number lotCommentId: string | number
lotCommentDateString: string lotCommentDateString: DateString
lotCommentTimeString: string lotCommentTimeString: TimeString
lotComment: string lotComment: string
} }

View File

@ -1,9 +1,10 @@
import { type DateString } from '@cityssm/utils-datetime';
interface UpdateLotOccupancyForm { interface UpdateLotOccupancyForm {
lotOccupancyId: string | number; lotOccupancyId: string | number;
occupancyTypeId: string | number; occupancyTypeId: string | number;
lotId: string | number; lotId: string | number;
occupancyStartDateString: string; occupancyStartDateString: DateString;
occupancyEndDateString: string; occupancyEndDateString: DateString | '';
occupancyTypeFieldIds?: string; occupancyTypeFieldIds?: string;
[lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown; [lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown;
} }

View File

@ -1,4 +1,4 @@
import { dateStringToInteger } from '@cityssm/utils-datetime' import { type DateString, dateStringToInteger } from '@cityssm/utils-datetime'
import addOrUpdateLotOccupancyField from './addOrUpdateLotOccupancyField.js' import addOrUpdateLotOccupancyField from './addOrUpdateLotOccupancyField.js'
import deleteLotOccupancyField from './deleteLotOccupancyField.js' import deleteLotOccupancyField from './deleteLotOccupancyField.js'
@ -9,8 +9,8 @@ interface UpdateLotOccupancyForm {
occupancyTypeId: string | number occupancyTypeId: string | number
lotId: string | number lotId: string | number
occupancyStartDateString: string occupancyStartDateString: DateString
occupancyEndDateString: string occupancyEndDateString: DateString | ''
occupancyTypeFieldIds?: string occupancyTypeFieldIds?: string
[lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown [lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown

View File

@ -3,7 +3,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
export async function handler(_request, response) { export async function handler(_request, response) {
const lotTypes = await getLotTypes(); const lotTypes = await getLotTypes();
response.render('admin-lotTypes', { response.render('admin-lotTypes', {
headTitle: `${configFunctions.getProperty('aliases.lot')} Type Management`, headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Type Management`,
lotTypes lotTypes
}); });
} }

View File

@ -10,7 +10,7 @@ export async function handler(
const lotTypes = await getLotTypes() const lotTypes = await getLotTypes()
response.render('admin-lotTypes', { response.render('admin-lotTypes', {
headTitle: `${configFunctions.getProperty('aliases.lot')} Type Management`, headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Type Management`,
lotTypes lotTypes
}) })
} }

View File

@ -1,7 +1,7 @@
import * as configFunctions from '../../helpers/functions.config.js'; import * as configFunctions from '../../helpers/functions.config.js';
export function handler(_request, response) { export function handler(_request, response) {
if (configFunctions.getProperty('application.ntfyStartup') === undefined) { if (configFunctions.getConfigProperty('application.ntfyStartup') === undefined) {
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') + response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/dashboard/?error=ntfyNotConfigured'); '/dashboard/?error=ntfyNotConfigured');
return; return;
} }

View File

@ -3,9 +3,9 @@ import type { Request, Response } from 'express'
import * as configFunctions from '../../helpers/functions.config.js' import * as configFunctions from '../../helpers/functions.config.js'
export function handler(_request: Request, response: Response): void { export function handler(_request: Request, response: Response): void {
if (configFunctions.getProperty('application.ntfyStartup') === undefined) { if (configFunctions.getConfigProperty('application.ntfyStartup') === undefined) {
response.redirect( response.redirect(
configFunctions.getProperty('reverseProxy.urlPrefix') + configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/dashboard/?error=ntfyNotConfigured' '/dashboard/?error=ntfyNotConfigured'
) )
return return

View File

@ -4,7 +4,7 @@ import * as printFunctions from '../../helpers/functions.print.js';
export async function handler(_request, response) { export async function handler(_request, response) {
const occupancyTypes = await getOccupancyTypes(); const occupancyTypes = await getOccupancyTypes();
const allOccupancyTypeFields = await getAllOccupancyTypeFields(); const allOccupancyTypeFields = await getAllOccupancyTypeFields();
const occupancyTypePrints = configFunctions.getProperty('settings.lotOccupancy.prints'); const occupancyTypePrints = configFunctions.getConfigProperty('settings.lotOccupancy.prints');
const occupancyTypePrintTitles = {}; const occupancyTypePrintTitles = {};
for (const printEJS of occupancyTypePrints) { for (const printEJS of occupancyTypePrints) {
const printConfig = printFunctions.getPrintConfig(printEJS); const printConfig = printFunctions.getPrintConfig(printEJS);
@ -13,7 +13,7 @@ export async function handler(_request, response) {
} }
} }
response.render('admin-occupancyTypes', { response.render('admin-occupancyTypes', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Type Management`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Type Management`,
occupancyTypes, occupancyTypes,
allOccupancyTypeFields, allOccupancyTypeFields,
occupancyTypePrintTitles occupancyTypePrintTitles

View File

@ -14,7 +14,7 @@ export async function handler(
const occupancyTypes = await getOccupancyTypes() const occupancyTypes = await getOccupancyTypes()
const allOccupancyTypeFields = await getAllOccupancyTypeFields() const allOccupancyTypeFields = await getAllOccupancyTypeFields()
const occupancyTypePrints = configFunctions.getProperty( const occupancyTypePrints = configFunctions.getConfigProperty(
'settings.lotOccupancy.prints' 'settings.lotOccupancy.prints'
) )
@ -30,7 +30,7 @@ export async function handler(
response.render('admin-occupancyTypes', { response.render('admin-occupancyTypes', {
headTitle: headTitle:
`${configFunctions.getProperty('aliases.occupancy')} Type Management`, `${configFunctions.getConfigProperty('aliases.occupancy')} Type Management`,
occupancyTypes, occupancyTypes,
allOccupancyTypeFields, allOccupancyTypeFields,
occupancyTypePrintTitles occupancyTypePrintTitles

View File

@ -3,7 +3,7 @@ import { getWorkOrderMilestones } from '../../database/getWorkOrderMilestones.js
import * as configFunctions from '../../helpers/functions.config.js'; import * as configFunctions from '../../helpers/functions.config.js';
import { getPrintConfig } from '../../helpers/functions.print.js'; import { getPrintConfig } from '../../helpers/functions.print.js';
const calendarCompany = 'cityssm.github.io'; const calendarCompany = 'cityssm.github.io';
const calendarProduct = configFunctions.getProperty('application.applicationName'); const calendarProduct = configFunctions.getConfigProperty('application.applicationName');
const timeStringSplitRegex = /[ :-]/; const timeStringSplitRegex = /[ :-]/;
function escapeHTML(stringToEscape) { function escapeHTML(stringToEscape) {
return stringToEscape.replaceAll(/[^\d a-z]/gi, (c) => `&#${c.codePointAt(0)};`); return stringToEscape.replaceAll(/[^\d a-z]/gi, (c) => `&#${c.codePointAt(0)};`);
@ -11,10 +11,10 @@ function escapeHTML(stringToEscape) {
function getUrlRoot(request) { function getUrlRoot(request) {
return ('http://' + return ('http://' +
request.hostname + request.hostname +
(configFunctions.getProperty('application.httpPort') === 80 (configFunctions.getConfigProperty('application.httpPort') === 80
? '' ? ''
: `:${configFunctions.getProperty('application.httpPort')}`) + : `:${configFunctions.getConfigProperty('application.httpPort')}`) +
configFunctions.getProperty('reverseProxy.urlPrefix')); configFunctions.getConfigProperty('reverseProxy.urlPrefix'));
} }
function getWorkOrderUrl(request, milestone) { function getWorkOrderUrl(request, milestone) {
return `${getUrlRoot(request)}/workOrders/${milestone.workOrderId}`; return `${getUrlRoot(request)}/workOrders/${milestone.workOrderId}`;
@ -49,15 +49,15 @@ function buildEventDescriptionHTML_occupancies(request, milestone) {
if (milestone.workOrderLotOccupancies.length > 0) { if (milestone.workOrderLotOccupancies.length > 0) {
const urlRoot = getUrlRoot(request); const urlRoot = getUrlRoot(request);
descriptionHTML = `<h2> descriptionHTML = `<h2>
Related ${escapeHTML(configFunctions.getProperty('aliases.occupancies'))} Related ${escapeHTML(configFunctions.getConfigProperty('aliases.occupancies'))}
</h2> </h2>
<table border="1"> <table border="1">
<thead><tr> <thead><tr>
<th>${escapeHTML(configFunctions.getProperty('aliases.occupancy'))} Type</th> <th>${escapeHTML(configFunctions.getConfigProperty('aliases.occupancy'))} Type</th>
<th>${escapeHTML(configFunctions.getProperty('aliases.lot'))}</th> <th>${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))}</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>${escapeHTML(configFunctions.getProperty('aliases.occupants'))}</th> <th>${escapeHTML(configFunctions.getConfigProperty('aliases.occupants'))}</th>
</tr></thead> </tr></thead>
<tbody>`; <tbody>`;
for (const occupancy of milestone.workOrderLotOccupancies) { for (const occupancy of milestone.workOrderLotOccupancies) {
@ -93,17 +93,17 @@ function buildEventDescriptionHTML_lots(request, milestone) {
if (milestone.workOrderLots.length > 0) { if (milestone.workOrderLots.length > 0) {
const urlRoot = getUrlRoot(request); const urlRoot = getUrlRoot(request);
descriptionHTML += `<h2> descriptionHTML += `<h2>
Related ${escapeHTML(configFunctions.getProperty('aliases.lots'))} Related ${escapeHTML(configFunctions.getConfigProperty('aliases.lots'))}
</h2> </h2>
<table border="1"><thead><tr> <table border="1"><thead><tr>
<th> <th>
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type ${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
</th> </th>
<th> <th>
${escapeHTML(configFunctions.getProperty('aliases.map'))} ${escapeHTML(configFunctions.getConfigProperty('aliases.map'))}
</th> </th>
<th> <th>
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type ${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
</th> </th>
<th>Status</th> <th>Status</th>
</tr></thead> </tr></thead>
@ -126,7 +126,7 @@ function buildEventDescriptionHTML_lots(request, milestone) {
} }
function buildEventDescriptionHTML_prints(request, milestone) { function buildEventDescriptionHTML_prints(request, milestone) {
let descriptionHTML = ''; let descriptionHTML = '';
const prints = configFunctions.getProperty('settings.workOrders.prints'); const prints = configFunctions.getConfigProperty('settings.workOrders.prints');
if (prints.length > 0) { if (prints.length > 0) {
const urlRoot = getUrlRoot(request); const urlRoot = getUrlRoot(request);
descriptionHTML += '<h2>Prints</h2>'; descriptionHTML += '<h2>Prints</h2>';
@ -245,13 +245,13 @@ export async function handler(request, response) {
if (organizerSet) { if (organizerSet) {
calendarEvent.createAttendee({ calendarEvent.createAttendee({
name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`, name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`,
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress') email: configFunctions.getConfigProperty('settings.workOrders.calendarEmailAddress')
}); });
} }
else { else {
calendarEvent.organizer({ calendarEvent.organizer({
name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`, name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`,
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress') email: configFunctions.getConfigProperty('settings.workOrders.calendarEmailAddress')
}); });
organizerSet = true; organizerSet = true;
} }
@ -261,7 +261,7 @@ export async function handler(request, response) {
else { else {
calendarEvent.organizer({ calendarEvent.organizer({
name: milestone.recordCreate_userName, name: milestone.recordCreate_userName,
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress') email: configFunctions.getConfigProperty('settings.workOrders.calendarEmailAddress')
}); });
} }
} }

View File

@ -12,7 +12,7 @@ import { getPrintConfig } from '../../helpers/functions.print.js'
import type { WorkOrderMilestone } from '../../types/recordTypes.js' import type { WorkOrderMilestone } from '../../types/recordTypes.js'
const calendarCompany = 'cityssm.github.io' const calendarCompany = 'cityssm.github.io'
const calendarProduct = configFunctions.getProperty( const calendarProduct = configFunctions.getConfigProperty(
'application.applicationName' 'application.applicationName'
) )
@ -29,10 +29,10 @@ function getUrlRoot(request: Request): string {
return ( return (
'http://' + 'http://' +
request.hostname + request.hostname +
(configFunctions.getProperty('application.httpPort') === 80 (configFunctions.getConfigProperty('application.httpPort') === 80
? '' ? ''
: `:${configFunctions.getProperty('application.httpPort')}`) + : `:${configFunctions.getConfigProperty('application.httpPort')}`) +
configFunctions.getProperty('reverseProxy.urlPrefix') configFunctions.getConfigProperty('reverseProxy.urlPrefix')
) )
} }
@ -88,17 +88,17 @@ function buildEventDescriptionHTML_occupancies(
const urlRoot = getUrlRoot(request) const urlRoot = getUrlRoot(request)
descriptionHTML = `<h2> descriptionHTML = `<h2>
Related ${escapeHTML(configFunctions.getProperty('aliases.occupancies'))} Related ${escapeHTML(configFunctions.getConfigProperty('aliases.occupancies'))}
</h2> </h2>
<table border="1"> <table border="1">
<thead><tr> <thead><tr>
<th>${escapeHTML( <th>${escapeHTML(
configFunctions.getProperty('aliases.occupancy') configFunctions.getConfigProperty('aliases.occupancy')
)} Type</th> )} Type</th>
<th>${escapeHTML(configFunctions.getProperty('aliases.lot'))}</th> <th>${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))}</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>${escapeHTML(configFunctions.getProperty('aliases.occupants'))}</th> <th>${escapeHTML(configFunctions.getConfigProperty('aliases.occupants'))}</th>
</tr></thead> </tr></thead>
<tbody>` <tbody>`
@ -152,17 +152,17 @@ function buildEventDescriptionHTML_lots(
const urlRoot = getUrlRoot(request) const urlRoot = getUrlRoot(request)
descriptionHTML += `<h2> descriptionHTML += `<h2>
Related ${escapeHTML(configFunctions.getProperty('aliases.lots'))} Related ${escapeHTML(configFunctions.getConfigProperty('aliases.lots'))}
</h2> </h2>
<table border="1"><thead><tr> <table border="1"><thead><tr>
<th> <th>
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type ${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
</th> </th>
<th> <th>
${escapeHTML(configFunctions.getProperty('aliases.map'))} ${escapeHTML(configFunctions.getConfigProperty('aliases.map'))}
</th> </th>
<th> <th>
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type ${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
</th> </th>
<th>Status</th> <th>Status</th>
</tr></thead> </tr></thead>
@ -194,7 +194,7 @@ function buildEventDescriptionHTML_prints(
): string { ): string {
let descriptionHTML = '' let descriptionHTML = ''
const prints = configFunctions.getProperty('settings.workOrders.prints') const prints = configFunctions.getConfigProperty('settings.workOrders.prints')
if (prints.length > 0) { if (prints.length > 0) {
const urlRoot = getUrlRoot(request) const urlRoot = getUrlRoot(request)
@ -395,7 +395,7 @@ export async function handler(
name: `${occupant.occupantName ?? ''} ${ name: `${occupant.occupantName ?? ''} ${
occupant.occupantFamilyName ?? '' occupant.occupantFamilyName ?? ''
}`, }`,
email: configFunctions.getProperty( email: configFunctions.getConfigProperty(
'settings.workOrders.calendarEmailAddress' 'settings.workOrders.calendarEmailAddress'
) )
}) })
@ -404,7 +404,7 @@ export async function handler(
name: `${occupant.occupantName ?? ''} ${ name: `${occupant.occupantName ?? ''} ${
occupant.occupantFamilyName ?? '' occupant.occupantFamilyName ?? ''
}`, }`,
email: configFunctions.getProperty( email: configFunctions.getConfigProperty(
'settings.workOrders.calendarEmailAddress' 'settings.workOrders.calendarEmailAddress'
) )
}) })
@ -415,7 +415,7 @@ export async function handler(
} else { } else {
calendarEvent.organizer({ calendarEvent.organizer({
name: milestone.recordCreate_userName!, name: milestone.recordCreate_userName!,
email: configFunctions.getProperty( email: configFunctions.getConfigProperty(
'settings.workOrders.calendarEmailAddress' 'settings.workOrders.calendarEmailAddress'
) )
}) })

View File

@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
export async function handler(request, response) { export async function handler(request, response) {
const lotOccupancy = await getLotOccupancy(request.params.lotOccupancyId); const lotOccupancy = await getLotOccupancy(request.params.lotOccupancyId);
if (lotOccupancy === undefined) { if (lotOccupancy === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`);
return; return;
} }
const occupancyTypePrints = await getOccupancyTypePrintsById(lotOccupancy.occupancyTypeId); const occupancyTypePrints = await getOccupancyTypePrintsById(lotOccupancy.occupancyTypeId);
@ -16,7 +16,7 @@ export async function handler(request, response) {
const maps = await getMaps(); const maps = await getMaps();
const workOrderTypes = await getWorkOrderTypes(); const workOrderTypes = await getWorkOrderTypes();
response.render('lotOccupancy-edit', { response.render('lotOccupancy-edit', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Update`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Update`,
lotOccupancy, lotOccupancy,
occupancyTypePrints, occupancyTypePrints,
occupancyTypes, occupancyTypes,

View File

@ -17,7 +17,7 @@ export async function handler(request: Request, response: Response): Promise<voi
if (lotOccupancy === undefined) { if (lotOccupancy === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/lotOccupancies/?error=lotOccupancyIdNotFound` )}/lotOccupancies/?error=lotOccupancyIdNotFound`
) )
@ -36,7 +36,7 @@ export async function handler(request: Request, response: Response): Promise<voi
const workOrderTypes = await getWorkOrderTypes() const workOrderTypes = await getWorkOrderTypes()
response.render('lotOccupancy-edit', { response.render('lotOccupancy-edit', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Update`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Update`,
lotOccupancy, lotOccupancy,
occupancyTypePrints, occupancyTypePrints,

View File

@ -24,7 +24,7 @@ export async function handler(request, response) {
const lotStatuses = await getLotStatuses(); const lotStatuses = await getLotStatuses();
const maps = await getMaps(); const maps = await getMaps();
response.render('lotOccupancy-edit', { response.render('lotOccupancy-edit', {
headTitle: `Create a New ${configFunctions.getProperty('aliases.occupancy')} Record`, headTitle: `Create a New ${configFunctions.getConfigProperty('aliases.occupancy')} Record`,
lotOccupancy, lotOccupancy,
occupancyTypes, occupancyTypes,
lotOccupantTypes, lotOccupantTypes,

View File

@ -44,7 +44,7 @@ export async function handler(
const maps = await getMaps() const maps = await getMaps()
response.render('lotOccupancy-edit', { response.render('lotOccupancy-edit', {
headTitle: `Create a New ${configFunctions.getProperty( headTitle: `Create a New ${configFunctions.getConfigProperty(
'aliases.occupancy' 'aliases.occupancy'
)} Record`, )} Record`,
lotOccupancy, lotOccupancy,

View File

@ -6,7 +6,7 @@ export async function handler(request, response) {
const lotTypes = await getLotTypes(); const lotTypes = await getLotTypes();
const occupancyTypes = await getOccupancyTypes(); const occupancyTypes = await getOccupancyTypes();
response.render('lotOccupancy-search', { response.render('lotOccupancy-search', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Search`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Search`,
maps, maps,
lotTypes, lotTypes,
occupancyTypes, occupancyTypes,

View File

@ -16,7 +16,7 @@ export async function handler(
const occupancyTypes = await getOccupancyTypes() const occupancyTypes = await getOccupancyTypes()
response.render('lotOccupancy-search', { response.render('lotOccupancy-search', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Search`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Search`,
maps, maps,
lotTypes, lotTypes,
occupancyTypes, occupancyTypes,

View File

@ -4,12 +4,12 @@ import * as configFunctions from '../../helpers/functions.config.js';
export async function handler(request, response) { export async function handler(request, response) {
const lotOccupancy = await getLotOccupancy(request.params.lotOccupancyId); const lotOccupancy = await getLotOccupancy(request.params.lotOccupancyId);
if (lotOccupancy === undefined) { if (lotOccupancy === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`);
return; return;
} }
const occupancyTypePrints = await getOccupancyTypePrintsById(lotOccupancy.occupancyTypeId); const occupancyTypePrints = await getOccupancyTypePrintsById(lotOccupancy.occupancyTypeId);
response.render('lotOccupancy-view', { response.render('lotOccupancy-view', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} View`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} View`,
lotOccupancy, lotOccupancy,
occupancyTypePrints occupancyTypePrints
}); });

View File

@ -12,7 +12,7 @@ export async function handler(
if (lotOccupancy === undefined) { if (lotOccupancy === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/lotOccupancies/?error=lotOccupancyIdNotFound` )}/lotOccupancies/?error=lotOccupancyIdNotFound`
) )
@ -24,7 +24,7 @@ export async function handler(
) )
response.render('lotOccupancy-view', { response.render('lotOccupancy-view', {
headTitle: `${configFunctions.getProperty('aliases.occupancy')} View`, headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} View`,
lotOccupancy, lotOccupancy,
occupancyTypePrints occupancyTypePrints
}) })

View File

@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
export async function handler(request, response) { export async function handler(request, response) {
const lot = await getLot(request.params.lotId); const lot = await getLot(request.params.lotId);
if (lot === undefined) { if (lot === undefined) {
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') + response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/lots/?error=lotIdNotFound'); '/lots/?error=lotIdNotFound');
return; return;
} }

View File

@ -13,7 +13,7 @@ export async function handler(
if (lot === undefined) { if (lot === undefined) {
response.redirect( response.redirect(
configFunctions.getProperty('reverseProxy.urlPrefix') + configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/lots/?error=lotIdNotFound' '/lots/?error=lotIdNotFound'
) )
return return

View File

@ -20,7 +20,7 @@ export async function handler(request, response) {
const lotTypes = await cacheFunctions.getLotTypes(); const lotTypes = await cacheFunctions.getLotTypes();
const lotStatuses = await cacheFunctions.getLotStatuses(); const lotStatuses = await cacheFunctions.getLotStatuses();
response.render('lot-edit', { response.render('lot-edit', {
headTitle: `Create a New ${configFunctions.getProperty('aliases.lot')}`, headTitle: `Create a New ${configFunctions.getConfigProperty('aliases.lot')}`,
lot, lot,
isCreate: true, isCreate: true,
maps, maps,

View File

@ -33,7 +33,7 @@ export async function handler(
const lotStatuses = await cacheFunctions.getLotStatuses() const lotStatuses = await cacheFunctions.getLotStatuses()
response.render('lot-edit', { response.render('lot-edit', {
headTitle: `Create a New ${configFunctions.getProperty('aliases.lot')}`, headTitle: `Create a New ${configFunctions.getConfigProperty('aliases.lot')}`,
lot, lot,
isCreate: true, isCreate: true,
maps, maps,

View File

@ -4,9 +4,9 @@ export async function handler(request, response) {
const lotId = Number.parseInt(request.params.lotId, 10); const lotId = Number.parseInt(request.params.lotId, 10);
const nextLotId = await getNextLotId(lotId); const nextLotId = await getNextLotId(lotId);
if (nextLotId === undefined) { if (nextLotId === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/?error=noNextLotIdFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/?error=noNextLotIdFound`);
return; return;
} }
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/${nextLotId.toString()}`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/${nextLotId.toString()}`);
} }
export default handler; export default handler;

View File

@ -13,7 +13,7 @@ export async function handler(
if (nextLotId === undefined) { if (nextLotId === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/lots/?error=noNextLotIdFound` )}/lots/?error=noNextLotIdFound`
) )
@ -21,7 +21,7 @@ export async function handler(
} }
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/lots/${nextLotId.toString()}` )}/lots/${nextLotId.toString()}`
) )

View File

@ -4,9 +4,9 @@ export async function handler(request, response) {
const lotId = Number.parseInt(request.params.lotId, 10); const lotId = Number.parseInt(request.params.lotId, 10);
const previousLotId = await getPreviousLotId(lotId); const previousLotId = await getPreviousLotId(lotId);
if (previousLotId === undefined) { if (previousLotId === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/?error=noPreviousLotIdFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/?error=noPreviousLotIdFound`);
return; return;
} }
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/${previousLotId.toString()}`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/${previousLotId.toString()}`);
} }
export default handler; export default handler;

View File

@ -13,7 +13,7 @@ export async function handler(
if (previousLotId === undefined) { if (previousLotId === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/lots/?error=noPreviousLotIdFound` )}/lots/?error=noPreviousLotIdFound`
) )
@ -21,7 +21,7 @@ export async function handler(
} }
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/lots/${previousLotId.toString()}` )}/lots/${previousLotId.toString()}`
) )

View File

@ -6,7 +6,7 @@ export async function handler(request, response) {
const lotTypes = await getLotTypes(); const lotTypes = await getLotTypes();
const lotStatuses = await getLotStatuses(); const lotStatuses = await getLotStatuses();
response.render('lot-search', { response.render('lot-search', {
headTitle: `${configFunctions.getProperty('aliases.lot')} Search`, headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Search`,
maps, maps,
lotTypes, lotTypes,
lotStatuses, lotStatuses,

View File

@ -13,7 +13,7 @@ export async function handler(
const lotStatuses = await getLotStatuses() const lotStatuses = await getLotStatuses()
response.render('lot-search', { response.render('lot-search', {
headTitle: `${configFunctions.getProperty('aliases.lot')} Search`, headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Search`,
maps, maps,
lotTypes, lotTypes,
lotStatuses, lotStatuses,

View File

@ -4,7 +4,7 @@ import { getNextLotId, getPreviousLotId } from '../../helpers/functions.lots.js'
export async function handler(request, response) { export async function handler(request, response) {
const lot = await getLot(request.params.lotId); const lot = await getLot(request.params.lotId);
if (lot === undefined) { if (lot === undefined) {
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') + response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/lots/?error=lotIdNotFound'); '/lots/?error=lotIdNotFound');
return; return;
} }

View File

@ -12,7 +12,7 @@ export async function handler(
if (lot === undefined) { if (lot === undefined) {
response.redirect( response.redirect(
configFunctions.getProperty('reverseProxy.urlPrefix') + configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/lots/?error=lotIdNotFound' '/lots/?error=lotIdNotFound'
) )
return return

View File

@ -6,7 +6,7 @@ import { getMapSVGs } from '../../helpers/functions.map.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 === undefined) { if (map === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`);
return; return;
} }
const mapSVGs = await getMapSVGs(); const mapSVGs = await getMapSVGs();

View File

@ -14,7 +14,7 @@ export async function handler(
if (map === undefined) { if (map === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/maps/?error=mapIdNotFound` )}/maps/?error=mapIdNotFound`
) )

View File

@ -2,12 +2,12 @@ import * as configFunctions from '../../helpers/functions.config.js';
import { getMapSVGs } from '../../helpers/functions.map.js'; import { getMapSVGs } from '../../helpers/functions.map.js';
export async function handler(_request, response) { export async function handler(_request, response) {
const map = { const map = {
mapCity: configFunctions.getProperty('settings.map.mapCityDefault'), mapCity: configFunctions.getConfigProperty('settings.map.mapCityDefault'),
mapProvince: configFunctions.getProperty('settings.map.mapProvinceDefault') mapProvince: configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
}; };
const mapSVGs = await getMapSVGs(); const mapSVGs = await getMapSVGs();
response.render('map-edit', { response.render('map-edit', {
headTitle: `${configFunctions.getProperty('aliases.map')} Create`, headTitle: `${configFunctions.getConfigProperty('aliases.map')} Create`,
isCreate: true, isCreate: true,
map, map,
mapSVGs mapSVGs

View File

@ -9,14 +9,14 @@ export async function handler(
response: Response response: Response
): Promise<void> { ): Promise<void> {
const map: MapRecord = { const map: MapRecord = {
mapCity: configFunctions.getProperty('settings.map.mapCityDefault'), mapCity: configFunctions.getConfigProperty('settings.map.mapCityDefault'),
mapProvince: configFunctions.getProperty('settings.map.mapProvinceDefault') mapProvince: configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
} }
const mapSVGs = await getMapSVGs() const mapSVGs = await getMapSVGs()
response.render('map-edit', { response.render('map-edit', {
headTitle: `${configFunctions.getProperty('aliases.map')} Create`, headTitle: `${configFunctions.getConfigProperty('aliases.map')} Create`,
isCreate: true, isCreate: true,
map, map,
mapSVGs mapSVGs

View File

@ -4,9 +4,9 @@ export async function handler(request, response) {
const mapId = Number.parseInt(request.params.mapId, 10); const mapId = Number.parseInt(request.params.mapId, 10);
const nextMapId = await getNextMapId(mapId); const nextMapId = await getNextMapId(mapId);
if (nextMapId === undefined) { if (nextMapId === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=noNextMapIdFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=noNextMapIdFound`);
return; return;
} }
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/${nextMapId.toString()}`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/${nextMapId.toString()}`);
} }
export default handler; export default handler;

View File

@ -13,7 +13,7 @@ export async function handler(
if (nextMapId === undefined) { if (nextMapId === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/maps/?error=noNextMapIdFound` )}/maps/?error=noNextMapIdFound`
) )
@ -21,7 +21,7 @@ export async function handler(
} }
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/maps/${nextMapId.toString()}` )}/maps/${nextMapId.toString()}`
) )

View File

@ -4,9 +4,9 @@ export async function handler(request, response) {
const mapId = Number.parseInt(request.params.mapId, 10); const mapId = Number.parseInt(request.params.mapId, 10);
const previousMapId = await getPreviousMapId(mapId); const previousMapId = await getPreviousMapId(mapId);
if (previousMapId === undefined) { if (previousMapId === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=noPreviousMapIdFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=noPreviousMapIdFound`);
return; return;
} }
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/${previousMapId.toString()}`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/${previousMapId.toString()}`);
} }
export default handler; export default handler;

View File

@ -13,7 +13,7 @@ export async function handler(
if (previousMapId === undefined) { if (previousMapId === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/maps/?error=noPreviousMapIdFound` )}/maps/?error=noPreviousMapIdFound`
) )
@ -21,7 +21,7 @@ export async function handler(
} }
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/maps/${previousMapId.toString()}` )}/maps/${previousMapId.toString()}`
) )

View File

@ -3,7 +3,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
export async function handler(_request, response) { export async function handler(_request, response) {
const maps = await getMaps(); const maps = await getMaps();
response.render('map-search', { response.render('map-search', {
headTitle: `${configFunctions.getProperty('aliases.map')} Search`, headTitle: `${configFunctions.getConfigProperty('aliases.map')} Search`,
maps maps
}); });
} }

View File

@ -7,7 +7,7 @@ export async function handler(_request: Request, response: Response): Promise<vo
const maps = await getMaps() const maps = await getMaps()
response.render('map-search', { response.render('map-search', {
headTitle: `${configFunctions.getProperty('aliases.map')} Search`, headTitle: `${configFunctions.getConfigProperty('aliases.map')} Search`,
maps maps
}) })
} }

View File

@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.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 === undefined) { if (map === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`);
return; return;
} }
const lotTypeSummary = await getLotTypeSummary({ const lotTypeSummary = await getLotTypeSummary({

View File

@ -13,7 +13,7 @@ export async function handler(
if (map === undefined) { if (map === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound` `${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`
) )
return return
} }

View File

@ -1,6 +1,6 @@
import * as configFunctions from '../helpers/functions.config.js'; import * as configFunctions from '../helpers/functions.config.js';
import * as userFunctions from '../helpers/functions.user.js'; import * as userFunctions from '../helpers/functions.user.js';
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix'); const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
const forbiddenStatus = 403; const forbiddenStatus = 403;
const forbiddenJSON = { const forbiddenJSON = {
success: false, success: false,

View File

@ -3,7 +3,7 @@ import type { Request, Response, NextFunction } from 'express'
import * as configFunctions from '../helpers/functions.config.js' import * as configFunctions from '../helpers/functions.config.js'
import * as userFunctions from '../helpers/functions.user.js' import * as userFunctions from '../helpers/functions.user.js'
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix') const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix')
const forbiddenStatus = 403 const forbiddenStatus = 403

View File

@ -6,21 +6,21 @@ import * as ejs from 'ejs';
import * as configFunctions from '../../helpers/functions.config.js'; import * as configFunctions from '../../helpers/functions.config.js';
import * as lotOccupancyFunctions from '../../helpers/functions.lotOccupancy.js'; import * as lotOccupancyFunctions from '../../helpers/functions.lotOccupancy.js';
import { getPdfPrintConfig, getReportData } from '../../helpers/functions.print.js'; import { getPdfPrintConfig, getReportData } from '../../helpers/functions.print.js';
const attachmentOrInline = configFunctions.getProperty('settings.printPdf.contentDisposition'); const attachmentOrInline = configFunctions.getConfigProperty('settings.printPdf.contentDisposition');
export async function handler(request, response, next) { export async function handler(request, response, next) {
const printName = request.params.printName; const printName = request.params.printName;
if (!configFunctions if (!configFunctions
.getProperty('settings.lotOccupancy.prints') .getConfigProperty('settings.lotOccupancy.prints')
.includes(`pdf/${printName}`) && .includes(`pdf/${printName}`) &&
!configFunctions !configFunctions
.getProperty('settings.workOrders.prints') .getConfigProperty('settings.workOrders.prints')
.includes(`pdf/${printName}`)) { .includes(`pdf/${printName}`)) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`);
return; return;
} }
const printConfig = getPdfPrintConfig(printName); const printConfig = getPdfPrintConfig(printName);
if (printConfig === undefined) { if (printConfig === undefined) {
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') + response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/dashboard/?error=printConfigNotFound'); '/dashboard/?error=printConfigNotFound');
return; return;
} }

View File

@ -13,7 +13,7 @@ import {
getReportData getReportData
} from '../../helpers/functions.print.js' } from '../../helpers/functions.print.js'
const attachmentOrInline = configFunctions.getProperty( const attachmentOrInline = configFunctions.getConfigProperty(
'settings.printPdf.contentDisposition' 'settings.printPdf.contentDisposition'
) )
@ -26,14 +26,14 @@ export async function handler(
if ( if (
!configFunctions !configFunctions
.getProperty('settings.lotOccupancy.prints') .getConfigProperty('settings.lotOccupancy.prints')
.includes(`pdf/${printName}`) && .includes(`pdf/${printName}`) &&
!configFunctions !configFunctions
.getProperty('settings.workOrders.prints') .getConfigProperty('settings.workOrders.prints')
.includes(`pdf/${printName}`) .includes(`pdf/${printName}`)
) { ) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/dashboard/?error=printConfigNotAllowed` )}/dashboard/?error=printConfigNotAllowed`
) )
@ -44,7 +44,7 @@ export async function handler(
if (printConfig === undefined) { if (printConfig === undefined) {
response.redirect( response.redirect(
configFunctions.getProperty('reverseProxy.urlPrefix') + configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/dashboard/?error=printConfigNotFound' '/dashboard/?error=printConfigNotFound'
) )
return return

View File

@ -3,17 +3,17 @@ import { getReportData, getScreenPrintConfig } from '../../helpers/functions.pri
export async function handler(request, response) { export async function handler(request, response) {
const printName = request.params.printName; const printName = request.params.printName;
if (!configFunctions if (!configFunctions
.getProperty('settings.lotOccupancy.prints') .getConfigProperty('settings.lotOccupancy.prints')
.includes(`screen/${printName}`) && .includes(`screen/${printName}`) &&
!configFunctions !configFunctions
.getProperty('settings.workOrders.prints') .getConfigProperty('settings.workOrders.prints')
.includes(`screen/${printName}`)) { .includes(`screen/${printName}`)) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`);
return; return;
} }
const printConfig = getScreenPrintConfig(printName); const printConfig = getScreenPrintConfig(printName);
if (printConfig === undefined) { if (printConfig === undefined) {
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') + response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/dashboard/?error=printConfigNotFound'); '/dashboard/?error=printConfigNotFound');
return; return;
} }

View File

@ -14,14 +14,14 @@ export async function handler(
if ( if (
!configFunctions !configFunctions
.getProperty('settings.lotOccupancy.prints') .getConfigProperty('settings.lotOccupancy.prints')
.includes(`screen/${printName}`) && .includes(`screen/${printName}`) &&
!configFunctions !configFunctions
.getProperty('settings.workOrders.prints') .getConfigProperty('settings.workOrders.prints')
.includes(`screen/${printName}`) .includes(`screen/${printName}`)
) { ) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/dashboard/?error=printConfigNotAllowed` )}/dashboard/?error=printConfigNotAllowed`
) )
@ -32,7 +32,7 @@ export async function handler(
if (printConfig === undefined) { if (printConfig === undefined) {
response.redirect( response.redirect(
configFunctions.getProperty('reverseProxy.urlPrefix') + configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
'/dashboard/?error=printConfigNotFound' '/dashboard/?error=printConfigNotFound'
) )
return return

View File

@ -8,11 +8,11 @@ export async function handler(request, response) {
includeMilestones: true includeMilestones: true
}); });
if (workOrder === undefined) { if (workOrder === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`);
return; return;
} }
if (workOrder.workOrderCloseDate) { if (workOrder.workOrderCloseDate) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/workOrders/${workOrder.workOrderId.toString()}/?error=workOrderIsClosed`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/workOrders/${workOrder.workOrderId.toString()}/?error=workOrderIsClosed`);
return; return;
} }
const workOrderTypes = await getWorkOrderTypes(); const workOrderTypes = await getWorkOrderTypes();

View File

@ -20,7 +20,7 @@ export async function handler(
if (workOrder === undefined) { if (workOrder === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/workOrders/?error=workOrderIdNotFound` )}/workOrders/?error=workOrderIdNotFound`
) )
@ -29,7 +29,7 @@ export async function handler(
if (workOrder.workOrderCloseDate) { if (workOrder.workOrderCloseDate) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/workOrders/${workOrder.workOrderId!.toString()}/?error=workOrderIsClosed` )}/workOrders/${workOrder.workOrderId!.toString()}/?error=workOrderIsClosed`
) )

View File

@ -7,7 +7,7 @@ export async function handler(request, response) {
includeMilestones: true includeMilestones: true
}); });
if (workOrder === undefined) { if (workOrder === undefined) {
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`); response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`);
return; return;
} }
response.render('workOrder-view', { response.render('workOrder-view', {

View File

@ -15,7 +15,7 @@ export async function handler(
if (workOrder === undefined) { if (workOrder === undefined) {
response.redirect( response.redirect(
`${configFunctions.getProperty( `${configFunctions.getConfigProperty(
'reverseProxy.urlPrefix' 'reverseProxy.urlPrefix'
)}/workOrders/?error=workOrderIdNotFound` )}/workOrders/?error=workOrderIdNotFound`
) )

View File

@ -1,7 +1,7 @@
import ActiveDirectory from 'activedirectory2'; import ActiveDirectory from 'activedirectory2';
import * as configFunctions from './functions.config.js'; import * as configFunctions from './functions.config.js';
const userDomain = configFunctions.getProperty('application.userDomain'); const userDomain = configFunctions.getConfigProperty('application.userDomain');
const activeDirectoryConfig = configFunctions.getProperty('activeDirectory'); const activeDirectoryConfig = configFunctions.getConfigProperty('activeDirectory');
async function authenticateViaActiveDirectory(userName, password) { async function authenticateViaActiveDirectory(userName, password) {
return await new Promise((resolve) => { return await new Promise((resolve) => {
try { try {
@ -46,7 +46,7 @@ const safeRedirects = new Set([
const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/; const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/;
const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/; const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/;
export function getSafeRedirectURL(possibleRedirectURL = '') { export function getSafeRedirectURL(possibleRedirectURL = '') {
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix'); const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
if (typeof possibleRedirectURL === 'string') { if (typeof possibleRedirectURL === 'string') {
const urlToCheck = possibleRedirectURL.startsWith(urlPrefix) const urlToCheck = possibleRedirectURL.startsWith(urlPrefix)
? possibleRedirectURL.slice(urlPrefix.length) ? possibleRedirectURL.slice(urlPrefix.length)

View File

@ -2,9 +2,9 @@ import ActiveDirectory from 'activedirectory2'
import * as configFunctions from './functions.config.js' import * as configFunctions from './functions.config.js'
const userDomain = configFunctions.getProperty('application.userDomain') const userDomain = configFunctions.getConfigProperty('application.userDomain')
const activeDirectoryConfig = configFunctions.getProperty('activeDirectory') const activeDirectoryConfig = configFunctions.getConfigProperty('activeDirectory')
async function authenticateViaActiveDirectory( async function authenticateViaActiveDirectory(
userName: string, userName: string,
@ -64,7 +64,7 @@ const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/
const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/ const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/
export function getSafeRedirectURL(possibleRedirectURL = ''): string { export function getSafeRedirectURL(possibleRedirectURL = ''): string {
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix') const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix')
if (typeof possibleRedirectURL === 'string') { if (typeof possibleRedirectURL === 'string') {
const urlToCheck = possibleRedirectURL.startsWith(urlPrefix) const urlToCheck = possibleRedirectURL.startsWith(urlPrefix)

View File

@ -114,7 +114,7 @@ export async function getOccupancyTypePrintsById(occupancyTypeId) {
return []; return [];
} }
if (occupancyType.occupancyTypePrints.includes('*')) { if (occupancyType.occupancyTypePrints.includes('*')) {
return configFunctions.getProperty('settings.lotOccupancy.prints'); return configFunctions.getConfigProperty('settings.lotOccupancy.prints');
} }
return occupancyType.occupancyTypePrints ?? []; return occupancyType.occupancyTypePrints ?? [];
} }

View File

@ -205,7 +205,7 @@ export async function getOccupancyTypePrintsById(
} }
if (occupancyType.occupancyTypePrints.includes('*')) { if (occupancyType.occupancyTypePrints.includes('*')) {
return configFunctions.getProperty('settings.lotOccupancy.prints') return configFunctions.getConfigProperty('settings.lotOccupancy.prints')
} }
return occupancyType.occupancyTypePrints ?? [] return occupancyType.occupancyTypePrints ?? []

View File

@ -1,14 +1,14 @@
import type { config as MSSQLConfig } from 'mssql'; import type { config as MSSQLConfig } from 'mssql';
import type { ConfigActiveDirectory, ConfigNtfyStartup, DynamicsGPLookup } from '../types/configTypes.js'; import type { ConfigActiveDirectory, ConfigNtfyStartup, DynamicsGPLookup } from '../types/configTypes.js';
export declare function getProperty(propertyName: 'application.applicationName' | 'application.logoURL' | 'application.userDomain' | 'reverseProxy.urlPrefix' | 'session.cookieName' | 'session.secret' | 'aliases.lot' | 'aliases.lots' | 'aliases.map' | 'aliases.maps' | 'aliases.occupancy' | 'aliases.occupancies' | 'aliases.occupancyStartDate' | 'aliases.occupant' | 'aliases.occupants' | 'aliases.workOrderOpenDate' | 'aliases.workOrderCloseDate' | 'aliases.externalReceiptNumber' | 'settings.map.mapCityDefault' | 'settings.map.mapProvinceDefault' | 'settings.lot.lotNameHelpText' | 'settings.lotOccupancy.occupantCityDefault' | 'settings.lotOccupancy.occupantProvinceDefault' | 'settings.workOrders.calendarEmailAddress'): string; export declare function getConfigProperty(propertyName: 'application.applicationName' | 'application.logoURL' | 'application.userDomain' | 'reverseProxy.urlPrefix' | 'session.cookieName' | 'session.secret' | 'aliases.lot' | 'aliases.lots' | 'aliases.map' | 'aliases.maps' | 'aliases.occupancy' | 'aliases.occupancies' | 'aliases.occupancyStartDate' | 'aliases.occupant' | 'aliases.occupants' | 'aliases.workOrderOpenDate' | 'aliases.workOrderCloseDate' | 'aliases.externalReceiptNumber' | 'settings.map.mapCityDefault' | 'settings.map.mapProvinceDefault' | 'settings.lot.lotNameHelpText' | 'settings.lotOccupancy.occupantCityDefault' | 'settings.lotOccupancy.occupantProvinceDefault' | 'settings.workOrders.calendarEmailAddress'): string;
export declare function getProperty(propertyName: 'application.httpPort' | 'application.maximumProcesses' | 'session.maxAgeMillis' | 'settings.fees.taxPercentageDefault' | 'settings.workOrders.workOrderNumberLength' | 'settings.workOrders.workOrderMilestoneDateRecentBeforeDays' | 'settings.workOrders.workOrderMilestoneDateRecentAfterDays' | 'settings.adminCleanup.recordDeleteAgeDays'): number; export declare function getConfigProperty(propertyName: 'application.httpPort' | 'application.maximumProcesses' | 'session.maxAgeMillis' | 'settings.fees.taxPercentageDefault' | 'settings.workOrders.workOrderNumberLength' | 'settings.workOrders.workOrderMilestoneDateRecentBeforeDays' | 'settings.workOrders.workOrderMilestoneDateRecentAfterDays' | 'settings.adminCleanup.recordDeleteAgeDays'): number;
export declare function getProperty(propertyName: 'application.useTestDatabases' | 'reverseProxy.disableCompression' | 'reverseProxy.disableEtag' | 'session.doKeepAlive' | 'settings.lotOccupancy.occupancyEndDateIsRequired' | 'settings.dynamicsGP.integrationIsEnabled'): boolean; export declare function getConfigProperty(propertyName: 'application.useTestDatabases' | 'reverseProxy.disableCompression' | 'reverseProxy.disableEtag' | 'session.doKeepAlive' | 'settings.lotOccupancy.occupancyEndDateIsRequired' | 'settings.dynamicsGP.integrationIsEnabled'): boolean;
export declare function getProperty(propertyName: 'users.testing' | 'users.canLogin' | 'users.canUpdate' | 'users.isAdmin' | 'settings.dynamicsGP.accountCodes' | 'settings.dynamicsGP.itemNumbers' | 'settings.dynamicsGP.trialBalanceCodes' | 'settings.lotOccupancy.prints' | 'settings.workOrders.prints'): string[]; export declare function getConfigProperty(propertyName: 'users.testing' | 'users.canLogin' | 'users.canUpdate' | 'users.isAdmin' | 'settings.dynamicsGP.accountCodes' | 'settings.dynamicsGP.itemNumbers' | 'settings.dynamicsGP.trialBalanceCodes' | 'settings.lotOccupancy.prints' | 'settings.workOrders.prints'): string[];
export declare function getProperty(propertyName: 'application.ntfyStartup'): ConfigNtfyStartup | undefined; export declare function getConfigProperty(propertyName: 'application.ntfyStartup'): ConfigNtfyStartup | undefined;
export declare function getProperty(propertyName: 'activeDirectory'): ConfigActiveDirectory; export declare function getConfigProperty(propertyName: 'activeDirectory'): ConfigActiveDirectory;
export declare function getProperty(propertyName: 'settings.lot.lotNamePattern'): RegExp; export declare function getConfigProperty(propertyName: 'settings.lot.lotNamePattern'): RegExp;
export declare function getProperty(propertyName: 'settings.lot.lotNameSortNameFunction'): (lotName: string) => string; export declare function getConfigProperty(propertyName: 'settings.lot.lotNameSortNameFunction'): (lotName: string) => string;
export declare function getProperty(propertyName: 'settings.printPdf.contentDisposition'): 'attachment' | 'inline'; export declare function getConfigProperty(propertyName: 'settings.printPdf.contentDisposition'): 'attachment' | 'inline';
export declare function getProperty(propertyName: 'settings.dynamicsGP.mssqlConfig'): MSSQLConfig; export declare function getConfigProperty(propertyName: 'settings.dynamicsGP.mssqlConfig'): MSSQLConfig;
export declare function getProperty(propertyName: 'settings.dynamicsGP.lookupOrder'): DynamicsGPLookup[]; export declare function getConfigProperty(propertyName: 'settings.dynamicsGP.lookupOrder'): DynamicsGPLookup[];
export declare const keepAliveMillis: number; export declare const keepAliveMillis: number;

View File

@ -54,7 +54,7 @@ configFallbackValues.set('settings.dynamicsGP.lookupOrder', ['invoice']);
configFallbackValues.set('settings.dynamicsGP.accountCodes', []); configFallbackValues.set('settings.dynamicsGP.accountCodes', []);
configFallbackValues.set('settings.dynamicsGP.itemNumbers', []); configFallbackValues.set('settings.dynamicsGP.itemNumbers', []);
configFallbackValues.set('settings.dynamicsGP.trialBalanceCodes', []); configFallbackValues.set('settings.dynamicsGP.trialBalanceCodes', []);
export function getProperty(propertyName) { export function getConfigProperty(propertyName) {
const propertyNameSplit = propertyName.split('.'); const propertyNameSplit = propertyName.split('.');
let currentObject = config; let currentObject = config;
for (const propertyNamePiece of propertyNameSplit) { for (const propertyNamePiece of propertyNameSplit) {
@ -66,6 +66,6 @@ export function getProperty(propertyName) {
} }
return currentObject; return currentObject;
} }
export const keepAliveMillis = getProperty('session.doKeepAlive') export const keepAliveMillis = getConfigProperty('session.doKeepAlive')
? Math.max(getProperty('session.maxAgeMillis') / 2, getProperty('session.maxAgeMillis') - 10 * 60 * 1000) ? Math.max(getConfigProperty('session.maxAgeMillis') / 2, getConfigProperty('session.maxAgeMillis') - 10 * 60 * 1000)
: 0; : 0;

View File

@ -106,7 +106,7 @@ configFallbackValues.set('settings.dynamicsGP.trialBalanceCodes', [])
* Set up function overloads * Set up function overloads
*/ */
export function getProperty( export function getConfigProperty(
propertyName: propertyName:
| 'application.applicationName' | 'application.applicationName'
| 'application.logoURL' | 'application.logoURL'
@ -134,7 +134,7 @@ export function getProperty(
| 'settings.workOrders.calendarEmailAddress' | 'settings.workOrders.calendarEmailAddress'
): string ): string
export function getProperty( export function getConfigProperty(
propertyName: propertyName:
| 'application.httpPort' | 'application.httpPort'
| 'application.maximumProcesses' | 'application.maximumProcesses'
@ -146,7 +146,7 @@ export function getProperty(
| 'settings.adminCleanup.recordDeleteAgeDays' | 'settings.adminCleanup.recordDeleteAgeDays'
): number ): number
export function getProperty( export function getConfigProperty(
propertyName: propertyName:
| 'application.useTestDatabases' | 'application.useTestDatabases'
| 'reverseProxy.disableCompression' | 'reverseProxy.disableCompression'
@ -156,7 +156,7 @@ export function getProperty(
| 'settings.dynamicsGP.integrationIsEnabled' | 'settings.dynamicsGP.integrationIsEnabled'
): boolean ): boolean
export function getProperty( export function getConfigProperty(
propertyName: propertyName:
| 'users.testing' | 'users.testing'
| 'users.canLogin' | 'users.canLogin'
@ -169,33 +169,33 @@ export function getProperty(
| 'settings.workOrders.prints' | 'settings.workOrders.prints'
): string[] ): string[]
export function getProperty( export function getConfigProperty(
propertyName: 'application.ntfyStartup' propertyName: 'application.ntfyStartup'
): ConfigNtfyStartup | undefined ): ConfigNtfyStartup | undefined
export function getProperty( export function getConfigProperty(
propertyName: 'activeDirectory' propertyName: 'activeDirectory'
): ConfigActiveDirectory ): ConfigActiveDirectory
export function getProperty(propertyName: 'settings.lot.lotNamePattern'): RegExp export function getConfigProperty(propertyName: 'settings.lot.lotNamePattern'): RegExp
export function getProperty( export function getConfigProperty(
propertyName: 'settings.lot.lotNameSortNameFunction' propertyName: 'settings.lot.lotNameSortNameFunction'
): (lotName: string) => string ): (lotName: string) => string
export function getProperty( export function getConfigProperty(
propertyName: 'settings.printPdf.contentDisposition' propertyName: 'settings.printPdf.contentDisposition'
): 'attachment' | 'inline' ): 'attachment' | 'inline'
export function getProperty( export function getConfigProperty(
propertyName: 'settings.dynamicsGP.mssqlConfig' propertyName: 'settings.dynamicsGP.mssqlConfig'
): MSSQLConfig ): MSSQLConfig
export function getProperty( export function getConfigProperty(
propertyName: 'settings.dynamicsGP.lookupOrder' propertyName: 'settings.dynamicsGP.lookupOrder'
): DynamicsGPLookup[] ): DynamicsGPLookup[]
export function getProperty(propertyName: string): unknown { export function getConfigProperty(propertyName: string): unknown {
const propertyNameSplit = propertyName.split('.') const propertyNameSplit = propertyName.split('.')
let currentObject = config let currentObject = config
@ -212,9 +212,9 @@ export function getProperty(propertyName: string): unknown {
return currentObject return currentObject
} }
export const keepAliveMillis = getProperty('session.doKeepAlive') export const keepAliveMillis = getConfigProperty('session.doKeepAlive')
? Math.max( ? Math.max(
getProperty('session.maxAgeMillis') / 2, getConfigProperty('session.maxAgeMillis') / 2,
getProperty('session.maxAgeMillis') - 10 * 60 * 1000 getConfigProperty('session.maxAgeMillis') - 10 * 60 * 1000
) )
: 0 : 0

View File

@ -1,11 +1,11 @@
import { DynamicsGP } from '@cityssm/dynamics-gp'; import { DynamicsGP } from '@cityssm/dynamics-gp';
import * as configFunctions from './functions.config.js'; import * as configFunctions from './functions.config.js';
let gp; let gp;
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) { if (configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
gp = new DynamicsGP(configFunctions.getProperty('settings.dynamicsGP.mssqlConfig')); gp = new DynamicsGP(configFunctions.getConfigProperty('settings.dynamicsGP.mssqlConfig'));
} }
function filterCashReceipt(cashReceipt) { function filterCashReceipt(cashReceipt) {
const accountCodes = configFunctions.getProperty('settings.dynamicsGP.accountCodes'); const accountCodes = configFunctions.getConfigProperty('settings.dynamicsGP.accountCodes');
if (accountCodes.length > 0) { if (accountCodes.length > 0) {
for (const detail of cashReceipt.details) { for (const detail of cashReceipt.details) {
if (accountCodes.includes(detail.accountCode)) { if (accountCodes.includes(detail.accountCode)) {
@ -22,7 +22,7 @@ function filterCashReceipt(cashReceipt) {
return cashReceipt; return cashReceipt;
} }
function filterInvoice(invoice) { function filterInvoice(invoice) {
const itemNumbers = configFunctions.getProperty('settings.dynamicsGP.itemNumbers'); const itemNumbers = configFunctions.getConfigProperty('settings.dynamicsGP.itemNumbers');
for (const itemNumber of itemNumbers) { for (const itemNumber of itemNumbers) {
const found = invoice.lineItems.some((itemRecord) => { const found = invoice.lineItems.some((itemRecord) => {
return itemRecord.itemNumber === itemNumber; return itemRecord.itemNumber === itemNumber;
@ -37,7 +37,7 @@ function filterExtendedInvoice(invoice) {
if (filterInvoice(invoice) === undefined) { if (filterInvoice(invoice) === undefined) {
return undefined; return undefined;
} }
const trialBalanceCodes = configFunctions.getProperty('settings.dynamicsGP.trialBalanceCodes'); const trialBalanceCodes = configFunctions.getConfigProperty('settings.dynamicsGP.trialBalanceCodes');
if (trialBalanceCodes.length > 0 && if (trialBalanceCodes.length > 0 &&
trialBalanceCodes.includes(invoice.trialBalanceCode ?? '')) { trialBalanceCodes.includes(invoice.trialBalanceCode ?? '')) {
return invoice; return invoice;
@ -115,11 +115,11 @@ async function _getDynamicsGPDocument(documentNumber, lookupType) {
return document; return document;
} }
export async function getDynamicsGPDocument(documentNumber) { export async function getDynamicsGPDocument(documentNumber) {
if (!configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) { if (!configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
return undefined; return undefined;
} }
let document; let document;
for (const lookupType of configFunctions.getProperty('settings.dynamicsGP.lookupOrder')) { for (const lookupType of configFunctions.getConfigProperty('settings.dynamicsGP.lookupOrder')) {
document = await _getDynamicsGPDocument(documentNumber, lookupType); document = await _getDynamicsGPDocument(documentNumber, lookupType);
if (document !== undefined) { if (document !== undefined) {
break; break;

View File

@ -14,16 +14,16 @@ import * as configFunctions from './functions.config.js'
let gp: DynamicsGP let gp: DynamicsGP
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) { if (configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
gp = new DynamicsGP( gp = new DynamicsGP(
configFunctions.getProperty('settings.dynamicsGP.mssqlConfig') configFunctions.getConfigProperty('settings.dynamicsGP.mssqlConfig')
) )
} }
function filterCashReceipt( function filterCashReceipt(
cashReceipt: DiamondCashReceipt cashReceipt: DiamondCashReceipt
): DiamondCashReceipt | undefined { ): DiamondCashReceipt | undefined {
const accountCodes = configFunctions.getProperty( const accountCodes = configFunctions.getConfigProperty(
'settings.dynamicsGP.accountCodes' 'settings.dynamicsGP.accountCodes'
) )
@ -47,7 +47,7 @@ function filterCashReceipt(
} }
function filterInvoice(invoice: GPInvoice): GPInvoice | undefined { function filterInvoice(invoice: GPInvoice): GPInvoice | undefined {
const itemNumbers = configFunctions.getProperty( const itemNumbers = configFunctions.getConfigProperty(
'settings.dynamicsGP.itemNumbers' 'settings.dynamicsGP.itemNumbers'
) )
@ -71,7 +71,7 @@ function filterExtendedInvoice(
return undefined return undefined
} }
const trialBalanceCodes = configFunctions.getProperty( const trialBalanceCodes = configFunctions.getConfigProperty(
'settings.dynamicsGP.trialBalanceCodes' 'settings.dynamicsGP.trialBalanceCodes'
) )
@ -177,14 +177,14 @@ export async function getDynamicsGPDocument(
documentNumber: string documentNumber: string
): Promise<DynamicsGPDocument | undefined> { ): Promise<DynamicsGPDocument | undefined> {
if ( if (
!configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled') !configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')
) { ) {
return undefined return undefined
} }
let document: DynamicsGPDocument | undefined let document: DynamicsGPDocument | undefined
for (const lookupType of configFunctions.getProperty( for (const lookupType of configFunctions.getConfigProperty(
'settings.dynamicsGP.lookupOrder' 'settings.dynamicsGP.lookupOrder'
)) { )) {
document = await _getDynamicsGPDocument(documentNumber, lookupType) document = await _getDynamicsGPDocument(documentNumber, lookupType)

View File

@ -4,7 +4,7 @@ import { getWorkOrder } from '../database/getWorkOrder.js';
import * as configFunctions from './functions.config.js'; import * as configFunctions from './functions.config.js';
const screenPrintConfigs = { const screenPrintConfigs = {
lotOccupancy: { lotOccupancy: {
title: `${configFunctions.getProperty('aliases.lot')} ${configFunctions.getProperty('aliases.occupancy')} Print`, title: `${configFunctions.getConfigProperty('aliases.lot')} ${configFunctions.getConfigProperty('aliases.occupancy')} Print`,
params: ['lotOccupancyId'] params: ['lotOccupancyId']
} }
}; };

View File

@ -11,9 +11,9 @@ interface PrintConfig {
const screenPrintConfigs: Record<string, PrintConfig> = { const screenPrintConfigs: Record<string, PrintConfig> = {
lotOccupancy: { lotOccupancy: {
title: `${configFunctions.getProperty( title: `${configFunctions.getConfigProperty(
'aliases.lot' 'aliases.lot'
)} ${configFunctions.getProperty('aliases.occupancy')} Print`, )} ${configFunctions.getConfigProperty('aliases.occupancy')} Print`,
params: ['lotOccupancyId'] params: ['lotOccupancyId']
} }
} }

View File

@ -16,7 +16,7 @@ export async function apiKeyIsValid(request) {
return false; return false;
} }
return configFunctions return configFunctions
.getProperty('users.canLogin') .getConfigProperty('users.canLogin')
.some((currentUserName) => { .some((currentUserName) => {
return userName === currentUserName.toLowerCase(); return userName === currentUserName.toLowerCase();
}); });

View File

@ -35,7 +35,7 @@ export async function apiKeyIsValid(request: APIRequest): Promise<boolean> {
} }
return configFunctions return configFunctions
.getProperty('users.canLogin') .getConfigProperty('users.canLogin')
.some((currentUserName) => { .some((currentUserName) => {
return userName === currentUserName.toLowerCase() return userName === currentUserName.toLowerCase()
}) })

Some files were not shown because too many files have changed in this diff Show More