rename `getProperty` to `getConfigProperty`
parent
2323250627
commit
1a28c38066
16
app.js
16
app.js
|
|
@ -33,12 +33,12 @@ databaseInitializer.initializeDatabase();
|
|||
const _dirname = '.';
|
||||
export const app = express();
|
||||
app.disable('X-Powered-By');
|
||||
if (!configFunctions.getProperty('reverseProxy.disableEtag')) {
|
||||
if (!configFunctions.getConfigProperty('reverseProxy.disableEtag')) {
|
||||
app.set('etag', false);
|
||||
}
|
||||
app.set('views', path.join(_dirname, 'views'));
|
||||
app.set('view engine', 'ejs');
|
||||
if (!configFunctions.getProperty('reverseProxy.disableCompression')) {
|
||||
if (!configFunctions.getConfigProperty('reverseProxy.disableCompression')) {
|
||||
app.use(compression());
|
||||
}
|
||||
app.use((request, _response, next) => {
|
||||
|
|
@ -57,7 +57,7 @@ app.use(rateLimit({
|
|||
windowMs: 10_000,
|
||||
max: useTestDatabases ? 1_000_000 : 200
|
||||
}));
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix');
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
|
||||
if (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/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')));
|
||||
const sessionCookieName = configFunctions.getProperty('session.cookieName');
|
||||
const sessionCookieName = configFunctions.getConfigProperty('session.cookieName');
|
||||
const FileStoreSession = FileStore(session);
|
||||
app.use(session({
|
||||
store: new FileStoreSession({
|
||||
|
|
@ -77,12 +77,12 @@ app.use(session({
|
|||
retries: 20
|
||||
}),
|
||||
name: sessionCookieName,
|
||||
secret: configFunctions.getProperty('session.secret'),
|
||||
secret: configFunctions.getConfigProperty('session.secret'),
|
||||
resave: true,
|
||||
saveUninitialized: false,
|
||||
rolling: true,
|
||||
cookie: {
|
||||
maxAge: configFunctions.getProperty('session.maxAgeMillis'),
|
||||
maxAge: configFunctions.getConfigProperty('session.maxAgeMillis'),
|
||||
sameSite: 'strict'
|
||||
}
|
||||
}));
|
||||
|
|
@ -111,7 +111,7 @@ app.use((request, response, next) => {
|
|||
response.locals.dateTimeFunctions = dateTimeFns;
|
||||
response.locals.stringFunctions = stringFns;
|
||||
response.locals.htmlFunctions = htmlFns;
|
||||
response.locals.urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix');
|
||||
response.locals.urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
|
||||
next();
|
||||
});
|
||||
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}/reports`, sessionChecker, routerReports);
|
||||
app.use(`${urlPrefix}/admin`, sessionChecker, permissionHandlers.adminGetHandler, routerAdmin);
|
||||
if (configFunctions.getProperty('session.doKeepAlive')) {
|
||||
if (configFunctions.getConfigProperty('session.doKeepAlive')) {
|
||||
app.all(`${urlPrefix}/keepAlive`, (_request, response) => {
|
||||
response.json(true);
|
||||
});
|
||||
|
|
|
|||
16
app.ts
16
app.ts
|
|
@ -49,7 +49,7 @@ export const app = express()
|
|||
|
||||
app.disable('X-Powered-By')
|
||||
|
||||
if (!configFunctions.getProperty('reverseProxy.disableEtag')) {
|
||||
if (!configFunctions.getConfigProperty('reverseProxy.disableEtag')) {
|
||||
app.set('etag', false)
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ if (!configFunctions.getProperty('reverseProxy.disableEtag')) {
|
|||
app.set('views', path.join(_dirname, 'views'))
|
||||
app.set('view engine', 'ejs')
|
||||
|
||||
if (!configFunctions.getProperty('reverseProxy.disableCompression')) {
|
||||
if (!configFunctions.getConfigProperty('reverseProxy.disableCompression')) {
|
||||
app.use(compression())
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ app.use(
|
|||
* STATIC ROUTES
|
||||
*/
|
||||
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix')
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix')
|
||||
|
||||
if (urlPrefix !== '') {
|
||||
debug(`urlPrefix = ${urlPrefix}`)
|
||||
|
|
@ -143,7 +143,7 @@ app.use(
|
|||
*/
|
||||
|
||||
const sessionCookieName: string =
|
||||
configFunctions.getProperty('session.cookieName')
|
||||
configFunctions.getConfigProperty('session.cookieName')
|
||||
|
||||
const FileStoreSession = FileStore(session)
|
||||
|
||||
|
|
@ -156,12 +156,12 @@ app.use(
|
|||
retries: 20
|
||||
}),
|
||||
name: sessionCookieName,
|
||||
secret: configFunctions.getProperty('session.secret'),
|
||||
secret: configFunctions.getConfigProperty('session.secret'),
|
||||
resave: true,
|
||||
saveUninitialized: false,
|
||||
rolling: true,
|
||||
cookie: {
|
||||
maxAge: configFunctions.getProperty('session.maxAgeMillis'),
|
||||
maxAge: configFunctions.getConfigProperty('session.maxAgeMillis'),
|
||||
sameSite: 'strict'
|
||||
}
|
||||
})
|
||||
|
|
@ -218,7 +218,7 @@ app.use((request, response, next) => {
|
|||
response.locals.stringFunctions = stringFns
|
||||
response.locals.htmlFunctions = htmlFns
|
||||
|
||||
response.locals.urlPrefix = configFunctions.getProperty(
|
||||
response.locals.urlPrefix = configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ app.use(
|
|||
routerAdmin
|
||||
)
|
||||
|
||||
if (configFunctions.getProperty('session.doKeepAlive')) {
|
||||
if (configFunctions.getConfigProperty('session.doKeepAlive')) {
|
||||
app.all(`${urlPrefix}/keepAlive`, (_request, response) => {
|
||||
response.json(true)
|
||||
})
|
||||
|
|
|
|||
10
bin/www.js
10
bin/www.js
|
|
@ -8,8 +8,8 @@ import exitHook from 'exit-hook';
|
|||
import * as configFunctions from '../helpers/functions.config.js';
|
||||
const debug = Debug(`lot-occupancy-system:www:${process.pid}`);
|
||||
const directoryName = dirname(fileURLToPath(import.meta.url));
|
||||
const processCount = Math.min(configFunctions.getProperty('application.maximumProcesses'), os.cpus().length);
|
||||
process.title = `${configFunctions.getProperty('application.applicationName')} (Primary)`;
|
||||
const processCount = Math.min(configFunctions.getConfigProperty('application.maximumProcesses'), os.cpus().length);
|
||||
process.title = `${configFunctions.getConfigProperty('application.applicationName')} (Primary)`;
|
||||
debug(`Primary pid: ${process.pid}`);
|
||||
debug(`Primary title: ${process.title}`);
|
||||
debug(`Launching ${processCount} processes`);
|
||||
|
|
@ -37,19 +37,19 @@ cluster.on('exit', (worker) => {
|
|||
debug('Starting another worker');
|
||||
cluster.fork();
|
||||
});
|
||||
const ntfyStartupConfig = configFunctions.getProperty('application.ntfyStartup');
|
||||
const ntfyStartupConfig = configFunctions.getConfigProperty('application.ntfyStartup');
|
||||
if (ntfyStartupConfig !== undefined) {
|
||||
const topic = ntfyStartupConfig.topic;
|
||||
const server = ntfyStartupConfig.server;
|
||||
const ntfyStartupMessage = {
|
||||
topic,
|
||||
title: configFunctions.getProperty('application.applicationName'),
|
||||
title: configFunctions.getConfigProperty('application.applicationName'),
|
||||
message: 'Application Started',
|
||||
tags: ['arrow_up']
|
||||
};
|
||||
const ntfyShutdownMessage = {
|
||||
topic,
|
||||
title: configFunctions.getProperty('application.applicationName'),
|
||||
title: configFunctions.getConfigProperty('application.applicationName'),
|
||||
message: 'Application Shut Down',
|
||||
tags: ['arrow_down']
|
||||
};
|
||||
|
|
|
|||
10
bin/www.ts
10
bin/www.ts
|
|
@ -15,11 +15,11 @@ const debug = Debug(`lot-occupancy-system:www:${process.pid}`)
|
|||
const directoryName = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const processCount = Math.min(
|
||||
configFunctions.getProperty('application.maximumProcesses'),
|
||||
configFunctions.getConfigProperty('application.maximumProcesses'),
|
||||
os.cpus().length
|
||||
)
|
||||
|
||||
process.title = `${configFunctions.getProperty(
|
||||
process.title = `${configFunctions.getConfigProperty(
|
||||
'application.applicationName'
|
||||
)} (Primary)`
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ cluster.on('exit', (worker) => {
|
|||
cluster.fork()
|
||||
})
|
||||
|
||||
const ntfyStartupConfig = configFunctions.getProperty('application.ntfyStartup')
|
||||
const ntfyStartupConfig = configFunctions.getConfigProperty('application.ntfyStartup')
|
||||
|
||||
if (ntfyStartupConfig !== undefined) {
|
||||
const topic = ntfyStartupConfig.topic
|
||||
|
|
@ -67,14 +67,14 @@ if (ntfyStartupConfig !== undefined) {
|
|||
|
||||
const ntfyStartupMessage: NtfyMessageOptions = {
|
||||
topic,
|
||||
title: configFunctions.getProperty('application.applicationName'),
|
||||
title: configFunctions.getConfigProperty('application.applicationName'),
|
||||
message: 'Application Started',
|
||||
tags: ['arrow_up']
|
||||
}
|
||||
|
||||
const ntfyShutdownMessage: NtfyMessageOptions = {
|
||||
topic,
|
||||
title: configFunctions.getProperty('application.applicationName'),
|
||||
title: configFunctions.getConfigProperty('application.applicationName'),
|
||||
message: 'Application Shut Down',
|
||||
tags: ['arrow_down']
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ function onListening(server) {
|
|||
debug(`HTTP Listening on ${bind}`);
|
||||
}
|
||||
}
|
||||
process.title = `${configFunctions.getProperty('application.applicationName')} (Worker)`;
|
||||
const httpPort = configFunctions.getProperty('application.httpPort');
|
||||
process.title = `${configFunctions.getConfigProperty('application.applicationName')} (Worker)`;
|
||||
const httpPort = configFunctions.getConfigProperty('application.httpPort');
|
||||
const httpServer = http.createServer(app);
|
||||
httpServer.listen(httpPort);
|
||||
httpServer.on('error', onError);
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ function onListening(server: http.Server): void {
|
|||
* Initialize HTTP
|
||||
*/
|
||||
|
||||
process.title = `${configFunctions.getProperty(
|
||||
process.title = `${configFunctions.getConfigProperty(
|
||||
'application.applicationName'
|
||||
)} (Worker)`
|
||||
|
||||
const httpPort = configFunctions.getProperty('application.httpPort')
|
||||
const httpPort = configFunctions.getConfigProperty('application.httpPort')
|
||||
|
||||
const httpServer = http.createServer(app)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ describe('Admin - Fee Management', () => {
|
|||
cy.get(".modal input[name='taxPercentage']")
|
||||
.invoke('val')
|
||||
.should('equal', configFunctions
|
||||
.getProperty('settings.fees.taxPercentageDefault')
|
||||
.getConfigProperty('settings.fees.taxPercentageDefault')
|
||||
.toString());
|
||||
cy.get(".modal input[name='quantityUnit']").should('be.disabled');
|
||||
cy.get(".modal select[name='includeQuantity']").select('1');
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ describe('Admin - Fee Management', () => {
|
|||
.should(
|
||||
'equal',
|
||||
configFunctions
|
||||
.getProperty('settings.fees.taxPercentageDefault')
|
||||
.getConfigProperty('settings.fees.taxPercentageDefault')
|
||||
.toString()
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ describe('Update - Maps', () => {
|
|||
.type(mapJSON.mapLongitude.toString());
|
||||
});
|
||||
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='mapProvince']").should('have.value', configFunctions.getProperty('settings.map.mapProvinceDefault'));
|
||||
cy.get("input[name='mapCity']").should('have.value', configFunctions.getConfigProperty('settings.map.mapCityDefault'));
|
||||
cy.get("input[name='mapProvince']").should('have.value', configFunctions.getConfigProperty('settings.map.mapProvinceDefault'));
|
||||
cy.log('Submit the form');
|
||||
cy.get('#form--map').submit();
|
||||
cy.wait(1000);
|
||||
|
|
@ -50,8 +50,8 @@ describe('Update - Maps', () => {
|
|||
cy.get("textarea[name='mapDescription']").should('have.value', mapJSON.mapDescription);
|
||||
cy.get("input[name='mapAddress1']").should('have.value', mapJSON.mapAddress1);
|
||||
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='mapProvince']").should('have.value', configFunctions.getProperty('settings.map.mapProvinceDefault'));
|
||||
cy.get("input[name='mapCity']").should('have.value', configFunctions.getConfigProperty('settings.map.mapCityDefault'));
|
||||
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='mapPhoneNumber']").should('have.value', mapJSON.mapPhoneNumber);
|
||||
cy.get("input[name='mapLatitude']").should('have.value', mapJSON.mapLatitude.toString());
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ describe('Update - Maps', () => {
|
|||
|
||||
cy.get("input[name='mapCity']").should(
|
||||
'have.value',
|
||||
configFunctions.getProperty('settings.map.mapCityDefault')
|
||||
configFunctions.getConfigProperty('settings.map.mapCityDefault')
|
||||
)
|
||||
|
||||
cy.get("input[name='mapProvince']").should(
|
||||
'have.value',
|
||||
configFunctions.getProperty('settings.map.mapProvinceDefault')
|
||||
configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
|
||||
)
|
||||
|
||||
cy.log('Submit the form')
|
||||
|
|
@ -93,11 +93,11 @@ describe('Update - Maps', () => {
|
|||
|
||||
cy.get("input[name='mapCity']").should(
|
||||
'have.value',
|
||||
configFunctions.getProperty('settings.map.mapCityDefault')
|
||||
configFunctions.getConfigProperty('settings.map.mapCityDefault')
|
||||
)
|
||||
cy.get("input[name='mapProvince']").should(
|
||||
'have.value',
|
||||
configFunctions.getProperty('settings.map.mapProvinceDefault')
|
||||
configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
|
||||
)
|
||||
|
||||
cy.get("input[name='mapPostalCode']").should(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as configFunctions from '../helpers/functions.config.js';
|
||||
import Debug from 'debug';
|
||||
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';
|
||||
if (useTestDatabases) {
|
||||
debug('Using "-testing" databases.');
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const debug = Debug('lot-occupancy-system:databasePaths')
|
|||
// Determine if test databases should be used
|
||||
|
||||
export const useTestDatabases =
|
||||
configFunctions.getProperty('application.useTestDatabases') ||
|
||||
configFunctions.getConfigProperty('application.useTestDatabases') ||
|
||||
process.env.TEST_DATABASES === 'true'
|
||||
|
||||
if (useTestDatabases) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ export default async function cleanupDatabase(user) {
|
|||
const database = await acquireConnection();
|
||||
const rightNowMillis = Date.now();
|
||||
const recordDeleteTimeMillisMin = rightNowMillis -
|
||||
configFunctions.getProperty('settings.adminCleanup.recordDeleteAgeDays') *
|
||||
configFunctions.getConfigProperty('settings.adminCleanup.recordDeleteAgeDays') *
|
||||
86_400 *
|
||||
1000;
|
||||
let inactivatedRecordCount = 0;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default async function cleanupDatabase(
|
|||
const rightNowMillis = Date.now()
|
||||
const recordDeleteTimeMillisMin =
|
||||
rightNowMillis -
|
||||
configFunctions.getProperty('settings.adminCleanup.recordDeleteAgeDays') *
|
||||
configFunctions.getConfigProperty('settings.adminCleanup.recordDeleteAgeDays') *
|
||||
86_400 *
|
||||
1000
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export async function getLotOccupancies(filters, options, connectedDatabase) {
|
|||
const occupancyType = await getOccupancyTypeById(lotOccupancy.occupancyTypeId);
|
||||
if (occupancyType !== undefined) {
|
||||
lotOccupancy.printEJS = (occupancyType.occupancyTypePrints ?? []).includes('*')
|
||||
? configFunctions.getProperty('settings.lotOccupancy.prints')[0]
|
||||
? configFunctions.getConfigProperty('settings.lotOccupancy.prints')[0]
|
||||
: occupancyType.occupancyTypePrints[0];
|
||||
}
|
||||
await addInclusions(lotOccupancy, options, database);
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ export async function getLotOccupancies(
|
|||
lotOccupancy.printEJS = (
|
||||
occupancyType.occupancyTypePrints ?? []
|
||||
).includes('*')
|
||||
? configFunctions.getProperty('settings.lotOccupancy.prints')[0]
|
||||
? configFunctions.getConfigProperty('settings.lotOccupancy.prints')[0]
|
||||
: occupancyType.occupancyTypePrints![0]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
|
|||
o.lotId, l.lotName, l.lotTypeId,
|
||||
l.mapId, m.mapName,
|
||||
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
|
||||
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString,
|
||||
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString,
|
||||
o.recordUpdate_timeMillis
|
||||
from LotOccupancies o
|
||||
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export async function getLotOccupancy(
|
|||
o.lotId, l.lotName, l.lotTypeId,
|
||||
l.mapId, m.mapName,
|
||||
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
|
||||
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString,
|
||||
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString,
|
||||
o.recordUpdate_timeMillis
|
||||
from LotOccupancies o
|
||||
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export async function getLotOccupancyTransactions(lotOccupancyId, options, conne
|
|||
database.release();
|
||||
}
|
||||
if ((options?.includeIntegrations ?? false) &&
|
||||
configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
for (const transaction of lotOccupancyTransactions) {
|
||||
if ((transaction.externalReceiptNumber ?? '') !== '') {
|
||||
const gpDocument = await gpFunctions.getDynamicsGPDocument(transaction.externalReceiptNumber ?? '');
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export async function getLotOccupancyTransactions(
|
|||
|
||||
if (
|
||||
(options?.includeIntegrations ?? false) &&
|
||||
configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')
|
||||
configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')
|
||||
) {
|
||||
for (const transaction of lotOccupancyTransactions) {
|
||||
if ((transaction.externalReceiptNumber ?? '') !== '') {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export async function getLots(filters, options, connectedDatabase) {
|
|||
let lots = [];
|
||||
if (options.limit === -1 || count > 0) {
|
||||
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) {
|
||||
sqlParameters.unshift(currentDate, currentDate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ export async function getLots(
|
|||
|
||||
database.function(
|
||||
'userFn_lotNameSortName',
|
||||
configFunctions.getProperty('settings.lot.lotNameSortNameFunction')
|
||||
configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction')
|
||||
)
|
||||
|
||||
if (includeLotOccupancyCount) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import * as configFunctions from '../helpers/functions.config.js';
|
|||
import { acquireConnection } from './pool.js';
|
||||
export async function getNextLotId(lotId) {
|
||||
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
|
||||
.prepare(`select lotId
|
||||
from Lots
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export async function getNextLotId(
|
|||
|
||||
database.function(
|
||||
'userFn_lotNameSortName',
|
||||
configFunctions.getProperty('settings.lot.lotNameSortNameFunction')
|
||||
configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction')
|
||||
)
|
||||
|
||||
const result = database
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import * as configFunctions from '../helpers/functions.config.js';
|
|||
import { acquireConnection } from './pool.js';
|
||||
export async function getNextWorkOrderNumber(connectedDatabase) {
|
||||
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 regex = new RegExp('^' + currentYearString + '-\\d+$');
|
||||
database.function('userFn_matchesWorkOrderNumberSyntax', (workOrderNumber) => {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export async function getNextWorkOrderNumber(
|
|||
): Promise<string> {
|
||||
const database = connectedDatabase ?? (await acquireConnection())
|
||||
|
||||
const paddingLength = configFunctions.getProperty(
|
||||
const paddingLength = configFunctions.getConfigProperty(
|
||||
'settings.workOrders.workOrderNumberLength'
|
||||
)
|
||||
const currentYearString = new Date().getFullYear().toString()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as configFunctions from '../helpers/functions.config.js';
|
||||
import { acquireConnection } from './pool.js';
|
||||
const availablePrints = configFunctions.getProperty('settings.lotOccupancy.prints');
|
||||
const availablePrints = configFunctions.getConfigProperty('settings.lotOccupancy.prints');
|
||||
const userFunction_configContainsPrintEJS = (printEJS) => {
|
||||
if (printEJS === '*' || availablePrints.includes(printEJS)) {
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import * as configFunctions from '../helpers/functions.config.js'
|
|||
|
||||
import { acquireConnection } from './pool.js'
|
||||
|
||||
const availablePrints = configFunctions.getProperty(
|
||||
const availablePrints = configFunctions.getConfigProperty(
|
||||
'settings.lotOccupancy.prints'
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import * as configFunctions from '../helpers/functions.config.js';
|
|||
import { acquireConnection } from './pool.js';
|
||||
export async function getPreviousLotId(lotId) {
|
||||
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
|
||||
.prepare(`select lotId from Lots
|
||||
where recordDelete_timeMillis is null
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export async function getPreviousLotId(
|
|||
|
||||
database.function(
|
||||
'userFn_lotNameSortName',
|
||||
configFunctions.getProperty('settings.lot.lotNameSortNameFunction')
|
||||
configFunctions.getConfigProperty('settings.lot.lotNameSortNameFunction')
|
||||
)
|
||||
|
||||
const result = database
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
|||
import camelCase from 'camelcase';
|
||||
import * as configFunctions from '../helpers/functions.config.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 mapDescriptionAlias = `${mapCamelCase}Description`;
|
||||
const mapAddress1Alias = `${mapCamelCase}Address1`;
|
||||
|
|
@ -11,17 +11,17 @@ const mapCityAlias = `${mapCamelCase}City`;
|
|||
const mapProvinceAlias = `${mapCamelCase}Province`;
|
||||
const mapPostalCodeAlias = `${mapCamelCase}PostalCode`;
|
||||
const mapPhoneNumberAlias = `${mapCamelCase}PhoneNumber`;
|
||||
const lotCamelCase = camelCase(configFunctions.getProperty('aliases.lot'));
|
||||
const lotCamelCase = camelCase(configFunctions.getConfigProperty('aliases.lot'));
|
||||
const lotIdAlias = `${lotCamelCase}Id`;
|
||||
const lotNameAlias = `${lotCamelCase}Name`;
|
||||
const lotTypeAlias = `${lotCamelCase}Type`;
|
||||
const lotStatusAlias = `${lotCamelCase}Status`;
|
||||
const occupancyCamelCase = camelCase(configFunctions.getProperty('aliases.occupancy'));
|
||||
const occupancyCamelCase = camelCase(configFunctions.getConfigProperty('aliases.occupancy'));
|
||||
const lotOccupancyIdAlias = `${occupancyCamelCase}Id`;
|
||||
const occupancyTypeAlias = `${occupancyCamelCase}Type`;
|
||||
const occupancyStartDateAlias = `${occupancyCamelCase}StartDate`;
|
||||
const occupancyEndDateAlias = `${occupancyCamelCase}EndDate`;
|
||||
const occupantCamelCase = camelCase(configFunctions.getProperty('aliases.occupant'));
|
||||
const occupantCamelCase = camelCase(configFunctions.getConfigProperty('aliases.occupant'));
|
||||
const lotOccupantIndexAlias = `${occupantCamelCase}Index`;
|
||||
const lotOccupantTypeAlias = `${occupantCamelCase}Type`;
|
||||
const occupantNameAlias = `${occupantCamelCase}Name`;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { acquireConnection } from './pool.js'
|
|||
|
||||
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 mapDescriptionAlias = `${mapCamelCase}Description`
|
||||
const mapAddress1Alias = `${mapCamelCase}Address1`
|
||||
|
|
@ -20,14 +20,14 @@ const mapProvinceAlias = `${mapCamelCase}Province`
|
|||
const mapPostalCodeAlias = `${mapCamelCase}PostalCode`
|
||||
const mapPhoneNumberAlias = `${mapCamelCase}PhoneNumber`
|
||||
|
||||
const lotCamelCase = camelCase(configFunctions.getProperty('aliases.lot'))
|
||||
const lotCamelCase = camelCase(configFunctions.getConfigProperty('aliases.lot'))
|
||||
const lotIdAlias = `${lotCamelCase}Id`
|
||||
const lotNameAlias = `${lotCamelCase}Name`
|
||||
const lotTypeAlias = `${lotCamelCase}Type`
|
||||
const lotStatusAlias = `${lotCamelCase}Status`
|
||||
|
||||
const occupancyCamelCase = camelCase(
|
||||
configFunctions.getProperty('aliases.occupancy')
|
||||
configFunctions.getConfigProperty('aliases.occupancy')
|
||||
)
|
||||
const lotOccupancyIdAlias = `${occupancyCamelCase}Id`
|
||||
const occupancyTypeAlias = `${occupancyCamelCase}Type`
|
||||
|
|
@ -35,7 +35,7 @@ const occupancyStartDateAlias = `${occupancyCamelCase}StartDate`
|
|||
const occupancyEndDateAlias = `${occupancyCamelCase}EndDate`
|
||||
|
||||
const occupantCamelCase = camelCase(
|
||||
configFunctions.getProperty('aliases.occupant')
|
||||
configFunctions.getConfigProperty('aliases.occupant')
|
||||
)
|
||||
const lotOccupantIndexAlias = `${occupantCamelCase}Index`
|
||||
const lotOccupantTypeAlias = `${occupantCamelCase}Type`
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ function buildWhereClause(filters) {
|
|||
const date = new Date();
|
||||
const currentDateNumber = dateToInteger(date);
|
||||
date.setDate(date.getDate() -
|
||||
configFunctions.getProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays'));
|
||||
configFunctions.getConfigProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays'));
|
||||
const recentBeforeDateNumber = dateToInteger(date);
|
||||
date.setDate(date.getDate() +
|
||||
configFunctions.getProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays') +
|
||||
configFunctions.getProperty('settings.workOrders.workOrderMilestoneDateRecentAfterDays'));
|
||||
configFunctions.getConfigProperty('settings.workOrders.workOrderMilestoneDateRecentBeforeDays') +
|
||||
configFunctions.getConfigProperty('settings.workOrders.workOrderMilestoneDateRecentAfterDays'));
|
||||
const recentAfterDateNumber = dateToInteger(date);
|
||||
switch (filters.workOrderMilestoneDateFilter) {
|
||||
case 'upcomingMissed': {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ function buildWhereClause(filters: WorkOrderMilestoneFilters): {
|
|||
|
||||
date.setDate(
|
||||
date.getDate() -
|
||||
configFunctions.getProperty(
|
||||
configFunctions.getConfigProperty(
|
||||
'settings.workOrders.workOrderMilestoneDateRecentBeforeDays'
|
||||
)
|
||||
)
|
||||
|
|
@ -61,10 +61,10 @@ function buildWhereClause(filters: WorkOrderMilestoneFilters): {
|
|||
|
||||
date.setDate(
|
||||
date.getDate() +
|
||||
configFunctions.getProperty(
|
||||
configFunctions.getConfigProperty(
|
||||
'settings.workOrders.workOrderMilestoneDateRecentBeforeDays'
|
||||
) +
|
||||
configFunctions.getProperty(
|
||||
configFunctions.getConfigProperty(
|
||||
'settings.workOrders.workOrderMilestoneDateRecentAfterDays'
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Fee } from '../types/recordTypes.js'
|
||||
import type { Fee } from '../types/recordTypes.js'
|
||||
|
||||
import { getFee } from './getFee.js'
|
||||
import { acquireConnection } from './pool.js'
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { type DateString, type TimeString } from '@cityssm/utils-datetime';
|
||||
interface UpdateLotCommentForm {
|
||||
lotCommentId: string | number;
|
||||
lotCommentDateString: string;
|
||||
lotCommentTimeString: string;
|
||||
lotCommentDateString: DateString;
|
||||
lotCommentTimeString: TimeString;
|
||||
lotComment: string;
|
||||
}
|
||||
export declare function updateLotComment(commentForm: UpdateLotCommentForm, user: User): Promise<boolean>;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import {
|
||||
type DateString,
|
||||
type TimeString,
|
||||
dateStringToInteger,
|
||||
timeStringToInteger
|
||||
} from '@cityssm/utils-datetime'
|
||||
|
|
@ -7,8 +9,8 @@ import { acquireConnection } from './pool.js'
|
|||
|
||||
interface UpdateLotCommentForm {
|
||||
lotCommentId: string | number
|
||||
lotCommentDateString: string
|
||||
lotCommentTimeString: string
|
||||
lotCommentDateString: DateString
|
||||
lotCommentTimeString: TimeString
|
||||
lotComment: string
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { type DateString } from '@cityssm/utils-datetime';
|
||||
interface UpdateLotOccupancyForm {
|
||||
lotOccupancyId: string | number;
|
||||
occupancyTypeId: string | number;
|
||||
lotId: string | number;
|
||||
occupancyStartDateString: string;
|
||||
occupancyEndDateString: string;
|
||||
occupancyStartDateString: DateString;
|
||||
occupancyEndDateString: DateString | '';
|
||||
occupancyTypeFieldIds?: string;
|
||||
[lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { dateStringToInteger } from '@cityssm/utils-datetime'
|
||||
import { type DateString, dateStringToInteger } from '@cityssm/utils-datetime'
|
||||
|
||||
import addOrUpdateLotOccupancyField from './addOrUpdateLotOccupancyField.js'
|
||||
import deleteLotOccupancyField from './deleteLotOccupancyField.js'
|
||||
|
|
@ -9,8 +9,8 @@ interface UpdateLotOccupancyForm {
|
|||
occupancyTypeId: string | number
|
||||
lotId: string | number
|
||||
|
||||
occupancyStartDateString: string
|
||||
occupancyEndDateString: string
|
||||
occupancyStartDateString: DateString
|
||||
occupancyEndDateString: DateString | ''
|
||||
|
||||
occupancyTypeFieldIds?: string
|
||||
[lotOccupancyFieldValue_occupancyTypeFieldId: string]: unknown
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
export async function handler(_request, response) {
|
||||
const lotTypes = await getLotTypes();
|
||||
response.render('admin-lotTypes', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.lot')} Type Management`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Type Management`,
|
||||
lotTypes
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export async function handler(
|
|||
const lotTypes = await getLotTypes()
|
||||
|
||||
response.render('admin-lotTypes', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.lot')} Type Management`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Type Management`,
|
||||
lotTypes
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as configFunctions from '../../helpers/functions.config.js';
|
||||
export function handler(_request, response) {
|
||||
if (configFunctions.getProperty('application.ntfyStartup') === undefined) {
|
||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
if (configFunctions.getConfigProperty('application.ntfyStartup') === undefined) {
|
||||
response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/dashboard/?error=ntfyNotConfigured');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import type { Request, Response } from 'express'
|
|||
import * as configFunctions from '../../helpers/functions.config.js'
|
||||
|
||||
export function handler(_request: Request, response: Response): void {
|
||||
if (configFunctions.getProperty('application.ntfyStartup') === undefined) {
|
||||
if (configFunctions.getConfigProperty('application.ntfyStartup') === undefined) {
|
||||
response.redirect(
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/dashboard/?error=ntfyNotConfigured'
|
||||
)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import * as printFunctions from '../../helpers/functions.print.js';
|
|||
export async function handler(_request, response) {
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
const occupancyTypePrints = configFunctions.getProperty('settings.lotOccupancy.prints');
|
||||
const occupancyTypePrints = configFunctions.getConfigProperty('settings.lotOccupancy.prints');
|
||||
const occupancyTypePrintTitles = {};
|
||||
for (const printEJS of occupancyTypePrints) {
|
||||
const printConfig = printFunctions.getPrintConfig(printEJS);
|
||||
|
|
@ -13,7 +13,7 @@ export async function handler(_request, response) {
|
|||
}
|
||||
}
|
||||
response.render('admin-occupancyTypes', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Type Management`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Type Management`,
|
||||
occupancyTypes,
|
||||
allOccupancyTypeFields,
|
||||
occupancyTypePrintTitles
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export async function handler(
|
|||
const occupancyTypes = await getOccupancyTypes()
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields()
|
||||
|
||||
const occupancyTypePrints = configFunctions.getProperty(
|
||||
const occupancyTypePrints = configFunctions.getConfigProperty(
|
||||
'settings.lotOccupancy.prints'
|
||||
)
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ export async function handler(
|
|||
|
||||
response.render('admin-occupancyTypes', {
|
||||
headTitle:
|
||||
`${configFunctions.getProperty('aliases.occupancy')} Type Management`,
|
||||
`${configFunctions.getConfigProperty('aliases.occupancy')} Type Management`,
|
||||
occupancyTypes,
|
||||
allOccupancyTypeFields,
|
||||
occupancyTypePrintTitles
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { getWorkOrderMilestones } from '../../database/getWorkOrderMilestones.js
|
|||
import * as configFunctions from '../../helpers/functions.config.js';
|
||||
import { getPrintConfig } from '../../helpers/functions.print.js';
|
||||
const calendarCompany = 'cityssm.github.io';
|
||||
const calendarProduct = configFunctions.getProperty('application.applicationName');
|
||||
const calendarProduct = configFunctions.getConfigProperty('application.applicationName');
|
||||
const timeStringSplitRegex = /[ :-]/;
|
||||
function escapeHTML(stringToEscape) {
|
||||
return stringToEscape.replaceAll(/[^\d a-z]/gi, (c) => `&#${c.codePointAt(0)};`);
|
||||
|
|
@ -11,10 +11,10 @@ function escapeHTML(stringToEscape) {
|
|||
function getUrlRoot(request) {
|
||||
return ('http://' +
|
||||
request.hostname +
|
||||
(configFunctions.getProperty('application.httpPort') === 80
|
||||
(configFunctions.getConfigProperty('application.httpPort') === 80
|
||||
? ''
|
||||
: `:${configFunctions.getProperty('application.httpPort')}`) +
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix'));
|
||||
: `:${configFunctions.getConfigProperty('application.httpPort')}`) +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix'));
|
||||
}
|
||||
function getWorkOrderUrl(request, milestone) {
|
||||
return `${getUrlRoot(request)}/workOrders/${milestone.workOrderId}`;
|
||||
|
|
@ -49,15 +49,15 @@ function buildEventDescriptionHTML_occupancies(request, milestone) {
|
|||
if (milestone.workOrderLotOccupancies.length > 0) {
|
||||
const urlRoot = getUrlRoot(request);
|
||||
descriptionHTML = `<h2>
|
||||
Related ${escapeHTML(configFunctions.getProperty('aliases.occupancies'))}
|
||||
Related ${escapeHTML(configFunctions.getConfigProperty('aliases.occupancies'))}
|
||||
</h2>
|
||||
<table border="1">
|
||||
<thead><tr>
|
||||
<th>${escapeHTML(configFunctions.getProperty('aliases.occupancy'))} Type</th>
|
||||
<th>${escapeHTML(configFunctions.getProperty('aliases.lot'))}</th>
|
||||
<th>${escapeHTML(configFunctions.getConfigProperty('aliases.occupancy'))} Type</th>
|
||||
<th>${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))}</th>
|
||||
<th>Start Date</th>
|
||||
<th>End Date</th>
|
||||
<th>${escapeHTML(configFunctions.getProperty('aliases.occupants'))}</th>
|
||||
<th>${escapeHTML(configFunctions.getConfigProperty('aliases.occupants'))}</th>
|
||||
</tr></thead>
|
||||
<tbody>`;
|
||||
for (const occupancy of milestone.workOrderLotOccupancies) {
|
||||
|
|
@ -93,17 +93,17 @@ function buildEventDescriptionHTML_lots(request, milestone) {
|
|||
if (milestone.workOrderLots.length > 0) {
|
||||
const urlRoot = getUrlRoot(request);
|
||||
descriptionHTML += `<h2>
|
||||
Related ${escapeHTML(configFunctions.getProperty('aliases.lots'))}
|
||||
Related ${escapeHTML(configFunctions.getConfigProperty('aliases.lots'))}
|
||||
</h2>
|
||||
<table border="1"><thead><tr>
|
||||
<th>
|
||||
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type
|
||||
${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
|
||||
</th>
|
||||
<th>
|
||||
${escapeHTML(configFunctions.getProperty('aliases.map'))}
|
||||
${escapeHTML(configFunctions.getConfigProperty('aliases.map'))}
|
||||
</th>
|
||||
<th>
|
||||
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type
|
||||
${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
|
||||
</th>
|
||||
<th>Status</th>
|
||||
</tr></thead>
|
||||
|
|
@ -126,7 +126,7 @@ function buildEventDescriptionHTML_lots(request, milestone) {
|
|||
}
|
||||
function buildEventDescriptionHTML_prints(request, milestone) {
|
||||
let descriptionHTML = '';
|
||||
const prints = configFunctions.getProperty('settings.workOrders.prints');
|
||||
const prints = configFunctions.getConfigProperty('settings.workOrders.prints');
|
||||
if (prints.length > 0) {
|
||||
const urlRoot = getUrlRoot(request);
|
||||
descriptionHTML += '<h2>Prints</h2>';
|
||||
|
|
@ -245,13 +245,13 @@ export async function handler(request, response) {
|
|||
if (organizerSet) {
|
||||
calendarEvent.createAttendee({
|
||||
name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`,
|
||||
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
||||
email: configFunctions.getConfigProperty('settings.workOrders.calendarEmailAddress')
|
||||
});
|
||||
}
|
||||
else {
|
||||
calendarEvent.organizer({
|
||||
name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`,
|
||||
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
||||
email: configFunctions.getConfigProperty('settings.workOrders.calendarEmailAddress')
|
||||
});
|
||||
organizerSet = true;
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ export async function handler(request, response) {
|
|||
else {
|
||||
calendarEvent.organizer({
|
||||
name: milestone.recordCreate_userName,
|
||||
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
||||
email: configFunctions.getConfigProperty('settings.workOrders.calendarEmailAddress')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { getPrintConfig } from '../../helpers/functions.print.js'
|
|||
import type { WorkOrderMilestone } from '../../types/recordTypes.js'
|
||||
|
||||
const calendarCompany = 'cityssm.github.io'
|
||||
const calendarProduct = configFunctions.getProperty(
|
||||
const calendarProduct = configFunctions.getConfigProperty(
|
||||
'application.applicationName'
|
||||
)
|
||||
|
||||
|
|
@ -29,10 +29,10 @@ function getUrlRoot(request: Request): string {
|
|||
return (
|
||||
'http://' +
|
||||
request.hostname +
|
||||
(configFunctions.getProperty('application.httpPort') === 80
|
||||
(configFunctions.getConfigProperty('application.httpPort') === 80
|
||||
? ''
|
||||
: `:${configFunctions.getProperty('application.httpPort')}`) +
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix')
|
||||
: `:${configFunctions.getConfigProperty('application.httpPort')}`) +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix')
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -88,17 +88,17 @@ function buildEventDescriptionHTML_occupancies(
|
|||
const urlRoot = getUrlRoot(request)
|
||||
|
||||
descriptionHTML = `<h2>
|
||||
Related ${escapeHTML(configFunctions.getProperty('aliases.occupancies'))}
|
||||
Related ${escapeHTML(configFunctions.getConfigProperty('aliases.occupancies'))}
|
||||
</h2>
|
||||
<table border="1">
|
||||
<thead><tr>
|
||||
<th>${escapeHTML(
|
||||
configFunctions.getProperty('aliases.occupancy')
|
||||
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>End Date</th>
|
||||
<th>${escapeHTML(configFunctions.getProperty('aliases.occupants'))}</th>
|
||||
<th>${escapeHTML(configFunctions.getConfigProperty('aliases.occupants'))}</th>
|
||||
</tr></thead>
|
||||
<tbody>`
|
||||
|
||||
|
|
@ -152,17 +152,17 @@ function buildEventDescriptionHTML_lots(
|
|||
const urlRoot = getUrlRoot(request)
|
||||
|
||||
descriptionHTML += `<h2>
|
||||
Related ${escapeHTML(configFunctions.getProperty('aliases.lots'))}
|
||||
Related ${escapeHTML(configFunctions.getConfigProperty('aliases.lots'))}
|
||||
</h2>
|
||||
<table border="1"><thead><tr>
|
||||
<th>
|
||||
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type
|
||||
${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
|
||||
</th>
|
||||
<th>
|
||||
${escapeHTML(configFunctions.getProperty('aliases.map'))}
|
||||
${escapeHTML(configFunctions.getConfigProperty('aliases.map'))}
|
||||
</th>
|
||||
<th>
|
||||
${escapeHTML(configFunctions.getProperty('aliases.lot'))} Type
|
||||
${escapeHTML(configFunctions.getConfigProperty('aliases.lot'))} Type
|
||||
</th>
|
||||
<th>Status</th>
|
||||
</tr></thead>
|
||||
|
|
@ -194,7 +194,7 @@ function buildEventDescriptionHTML_prints(
|
|||
): string {
|
||||
let descriptionHTML = ''
|
||||
|
||||
const prints = configFunctions.getProperty('settings.workOrders.prints')
|
||||
const prints = configFunctions.getConfigProperty('settings.workOrders.prints')
|
||||
|
||||
if (prints.length > 0) {
|
||||
const urlRoot = getUrlRoot(request)
|
||||
|
|
@ -395,7 +395,7 @@ export async function handler(
|
|||
name: `${occupant.occupantName ?? ''} ${
|
||||
occupant.occupantFamilyName ?? ''
|
||||
}`,
|
||||
email: configFunctions.getProperty(
|
||||
email: configFunctions.getConfigProperty(
|
||||
'settings.workOrders.calendarEmailAddress'
|
||||
)
|
||||
})
|
||||
|
|
@ -404,7 +404,7 @@ export async function handler(
|
|||
name: `${occupant.occupantName ?? ''} ${
|
||||
occupant.occupantFamilyName ?? ''
|
||||
}`,
|
||||
email: configFunctions.getProperty(
|
||||
email: configFunctions.getConfigProperty(
|
||||
'settings.workOrders.calendarEmailAddress'
|
||||
)
|
||||
})
|
||||
|
|
@ -415,7 +415,7 @@ export async function handler(
|
|||
} else {
|
||||
calendarEvent.organizer({
|
||||
name: milestone.recordCreate_userName!,
|
||||
email: configFunctions.getProperty(
|
||||
email: configFunctions.getConfigProperty(
|
||||
'settings.workOrders.calendarEmailAddress'
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
export async function handler(request, response) {
|
||||
const lotOccupancy = await getLotOccupancy(request.params.lotOccupancyId);
|
||||
if (lotOccupancy === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`);
|
||||
return;
|
||||
}
|
||||
const occupancyTypePrints = await getOccupancyTypePrintsById(lotOccupancy.occupancyTypeId);
|
||||
|
|
@ -16,7 +16,7 @@ export async function handler(request, response) {
|
|||
const maps = await getMaps();
|
||||
const workOrderTypes = await getWorkOrderTypes();
|
||||
response.render('lotOccupancy-edit', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Update`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Update`,
|
||||
lotOccupancy,
|
||||
occupancyTypePrints,
|
||||
occupancyTypes,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export async function handler(request: Request, response: Response): Promise<voi
|
|||
|
||||
if (lotOccupancy === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/lotOccupancies/?error=lotOccupancyIdNotFound`
|
||||
)
|
||||
|
|
@ -36,7 +36,7 @@ export async function handler(request: Request, response: Response): Promise<voi
|
|||
const workOrderTypes = await getWorkOrderTypes()
|
||||
|
||||
response.render('lotOccupancy-edit', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Update`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Update`,
|
||||
lotOccupancy,
|
||||
occupancyTypePrints,
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export async function handler(request, response) {
|
|||
const lotStatuses = await getLotStatuses();
|
||||
const maps = await getMaps();
|
||||
response.render('lotOccupancy-edit', {
|
||||
headTitle: `Create a New ${configFunctions.getProperty('aliases.occupancy')} Record`,
|
||||
headTitle: `Create a New ${configFunctions.getConfigProperty('aliases.occupancy')} Record`,
|
||||
lotOccupancy,
|
||||
occupancyTypes,
|
||||
lotOccupantTypes,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export async function handler(
|
|||
const maps = await getMaps()
|
||||
|
||||
response.render('lotOccupancy-edit', {
|
||||
headTitle: `Create a New ${configFunctions.getProperty(
|
||||
headTitle: `Create a New ${configFunctions.getConfigProperty(
|
||||
'aliases.occupancy'
|
||||
)} Record`,
|
||||
lotOccupancy,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export async function handler(request, response) {
|
|||
const lotTypes = await getLotTypes();
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
response.render('lotOccupancy-search', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Search`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Search`,
|
||||
maps,
|
||||
lotTypes,
|
||||
occupancyTypes,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export async function handler(
|
|||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
||||
response.render('lotOccupancy-search', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} Search`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} Search`,
|
||||
maps,
|
||||
lotTypes,
|
||||
occupancyTypes,
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
export async function handler(request, response) {
|
||||
const lotOccupancy = await getLotOccupancy(request.params.lotOccupancyId);
|
||||
if (lotOccupancy === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lotOccupancies/?error=lotOccupancyIdNotFound`);
|
||||
return;
|
||||
}
|
||||
const occupancyTypePrints = await getOccupancyTypePrintsById(lotOccupancy.occupancyTypeId);
|
||||
response.render('lotOccupancy-view', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} View`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} View`,
|
||||
lotOccupancy,
|
||||
occupancyTypePrints
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export async function handler(
|
|||
|
||||
if (lotOccupancy === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/lotOccupancies/?error=lotOccupancyIdNotFound`
|
||||
)
|
||||
|
|
@ -24,7 +24,7 @@ export async function handler(
|
|||
)
|
||||
|
||||
response.render('lotOccupancy-view', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.occupancy')} View`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.occupancy')} View`,
|
||||
lotOccupancy,
|
||||
occupancyTypePrints
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
export async function handler(request, response) {
|
||||
const lot = await getLot(request.params.lotId);
|
||||
if (lot === undefined) {
|
||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/lots/?error=lotIdNotFound');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
|
||||
if (lot === undefined) {
|
||||
response.redirect(
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/lots/?error=lotIdNotFound'
|
||||
)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export async function handler(request, response) {
|
|||
const lotTypes = await cacheFunctions.getLotTypes();
|
||||
const lotStatuses = await cacheFunctions.getLotStatuses();
|
||||
response.render('lot-edit', {
|
||||
headTitle: `Create a New ${configFunctions.getProperty('aliases.lot')}`,
|
||||
headTitle: `Create a New ${configFunctions.getConfigProperty('aliases.lot')}`,
|
||||
lot,
|
||||
isCreate: true,
|
||||
maps,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export async function handler(
|
|||
const lotStatuses = await cacheFunctions.getLotStatuses()
|
||||
|
||||
response.render('lot-edit', {
|
||||
headTitle: `Create a New ${configFunctions.getProperty('aliases.lot')}`,
|
||||
headTitle: `Create a New ${configFunctions.getConfigProperty('aliases.lot')}`,
|
||||
lot,
|
||||
isCreate: true,
|
||||
maps,
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ export async function handler(request, response) {
|
|||
const lotId = Number.parseInt(request.params.lotId, 10);
|
||||
const nextLotId = await getNextLotId(lotId);
|
||||
if (nextLotId === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/?error=noNextLotIdFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/?error=noNextLotIdFound`);
|
||||
return;
|
||||
}
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/${nextLotId.toString()}`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/${nextLotId.toString()}`);
|
||||
}
|
||||
export default handler;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
|
||||
if (nextLotId === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/lots/?error=noNextLotIdFound`
|
||||
)
|
||||
|
|
@ -21,7 +21,7 @@ export async function handler(
|
|||
}
|
||||
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/lots/${nextLotId.toString()}`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ export async function handler(request, response) {
|
|||
const lotId = Number.parseInt(request.params.lotId, 10);
|
||||
const previousLotId = await getPreviousLotId(lotId);
|
||||
if (previousLotId === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/?error=noPreviousLotIdFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/?error=noPreviousLotIdFound`);
|
||||
return;
|
||||
}
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/lots/${previousLotId.toString()}`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/lots/${previousLotId.toString()}`);
|
||||
}
|
||||
export default handler;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
|
||||
if (previousLotId === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/lots/?error=noPreviousLotIdFound`
|
||||
)
|
||||
|
|
@ -21,7 +21,7 @@ export async function handler(
|
|||
}
|
||||
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/lots/${previousLotId.toString()}`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export async function handler(request, response) {
|
|||
const lotTypes = await getLotTypes();
|
||||
const lotStatuses = await getLotStatuses();
|
||||
response.render('lot-search', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.lot')} Search`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Search`,
|
||||
maps,
|
||||
lotTypes,
|
||||
lotStatuses,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
const lotStatuses = await getLotStatuses()
|
||||
|
||||
response.render('lot-search', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.lot')} Search`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.lot')} Search`,
|
||||
maps,
|
||||
lotTypes,
|
||||
lotStatuses,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { getNextLotId, getPreviousLotId } from '../../helpers/functions.lots.js'
|
|||
export async function handler(request, response) {
|
||||
const lot = await getLot(request.params.lotId);
|
||||
if (lot === undefined) {
|
||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/lots/?error=lotIdNotFound');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export async function handler(
|
|||
|
||||
if (lot === undefined) {
|
||||
response.redirect(
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/lots/?error=lotIdNotFound'
|
||||
)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { getMapSVGs } from '../../helpers/functions.map.js';
|
|||
export async function handler(request, response) {
|
||||
const map = await getMap(request.params.mapId);
|
||||
if (map === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`);
|
||||
return;
|
||||
}
|
||||
const mapSVGs = await getMapSVGs();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export async function handler(
|
|||
|
||||
if (map === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/maps/?error=mapIdNotFound`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
import { getMapSVGs } from '../../helpers/functions.map.js';
|
||||
export async function handler(_request, response) {
|
||||
const map = {
|
||||
mapCity: configFunctions.getProperty('settings.map.mapCityDefault'),
|
||||
mapProvince: configFunctions.getProperty('settings.map.mapProvinceDefault')
|
||||
mapCity: configFunctions.getConfigProperty('settings.map.mapCityDefault'),
|
||||
mapProvince: configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
|
||||
};
|
||||
const mapSVGs = await getMapSVGs();
|
||||
response.render('map-edit', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.map')} Create`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.map')} Create`,
|
||||
isCreate: true,
|
||||
map,
|
||||
mapSVGs
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ export async function handler(
|
|||
response: Response
|
||||
): Promise<void> {
|
||||
const map: MapRecord = {
|
||||
mapCity: configFunctions.getProperty('settings.map.mapCityDefault'),
|
||||
mapProvince: configFunctions.getProperty('settings.map.mapProvinceDefault')
|
||||
mapCity: configFunctions.getConfigProperty('settings.map.mapCityDefault'),
|
||||
mapProvince: configFunctions.getConfigProperty('settings.map.mapProvinceDefault')
|
||||
}
|
||||
|
||||
const mapSVGs = await getMapSVGs()
|
||||
|
||||
response.render('map-edit', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.map')} Create`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.map')} Create`,
|
||||
isCreate: true,
|
||||
map,
|
||||
mapSVGs
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ export async function handler(request, response) {
|
|||
const mapId = Number.parseInt(request.params.mapId, 10);
|
||||
const nextMapId = await getNextMapId(mapId);
|
||||
if (nextMapId === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=noNextMapIdFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=noNextMapIdFound`);
|
||||
return;
|
||||
}
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/${nextMapId.toString()}`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/${nextMapId.toString()}`);
|
||||
}
|
||||
export default handler;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
|
||||
if (nextMapId === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/maps/?error=noNextMapIdFound`
|
||||
)
|
||||
|
|
@ -21,7 +21,7 @@ export async function handler(
|
|||
}
|
||||
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/maps/${nextMapId.toString()}`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ export async function handler(request, response) {
|
|||
const mapId = Number.parseInt(request.params.mapId, 10);
|
||||
const previousMapId = await getPreviousMapId(mapId);
|
||||
if (previousMapId === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=noPreviousMapIdFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=noPreviousMapIdFound`);
|
||||
return;
|
||||
}
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/${previousMapId.toString()}`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/${previousMapId.toString()}`);
|
||||
}
|
||||
export default handler;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
|
||||
if (previousMapId === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/maps/?error=noPreviousMapIdFound`
|
||||
)
|
||||
|
|
@ -21,7 +21,7 @@ export async function handler(
|
|||
}
|
||||
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/maps/${previousMapId.toString()}`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
export async function handler(_request, response) {
|
||||
const maps = await getMaps();
|
||||
response.render('map-search', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.map')} Search`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.map')} Search`,
|
||||
maps
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export async function handler(_request: Request, response: Response): Promise<vo
|
|||
const maps = await getMaps()
|
||||
|
||||
response.render('map-search', {
|
||||
headTitle: `${configFunctions.getProperty('aliases.map')} Search`,
|
||||
headTitle: `${configFunctions.getConfigProperty('aliases.map')} Search`,
|
||||
maps
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import * as configFunctions from '../../helpers/functions.config.js';
|
|||
export async function handler(request, response) {
|
||||
const map = await getMap(request.params.mapId);
|
||||
if (map === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`);
|
||||
return;
|
||||
}
|
||||
const lotTypeSummary = await getLotTypeSummary({
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function handler(
|
|||
|
||||
if (map === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`
|
||||
`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/maps/?error=mapIdNotFound`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as configFunctions from '../helpers/functions.config.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 forbiddenJSON = {
|
||||
success: false,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Request, Response, NextFunction } from 'express'
|
|||
import * as configFunctions from '../helpers/functions.config.js'
|
||||
import * as userFunctions from '../helpers/functions.user.js'
|
||||
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix')
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix')
|
||||
|
||||
const forbiddenStatus = 403
|
||||
|
||||
|
|
|
|||
|
|
@ -6,21 +6,21 @@ import * as ejs from 'ejs';
|
|||
import * as configFunctions from '../../helpers/functions.config.js';
|
||||
import * as lotOccupancyFunctions from '../../helpers/functions.lotOccupancy.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) {
|
||||
const printName = request.params.printName;
|
||||
if (!configFunctions
|
||||
.getProperty('settings.lotOccupancy.prints')
|
||||
.getConfigProperty('settings.lotOccupancy.prints')
|
||||
.includes(`pdf/${printName}`) &&
|
||||
!configFunctions
|
||||
.getProperty('settings.workOrders.prints')
|
||||
.getConfigProperty('settings.workOrders.prints')
|
||||
.includes(`pdf/${printName}`)) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`);
|
||||
return;
|
||||
}
|
||||
const printConfig = getPdfPrintConfig(printName);
|
||||
if (printConfig === undefined) {
|
||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/dashboard/?error=printConfigNotFound');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
getReportData
|
||||
} from '../../helpers/functions.print.js'
|
||||
|
||||
const attachmentOrInline = configFunctions.getProperty(
|
||||
const attachmentOrInline = configFunctions.getConfigProperty(
|
||||
'settings.printPdf.contentDisposition'
|
||||
)
|
||||
|
||||
|
|
@ -26,14 +26,14 @@ export async function handler(
|
|||
|
||||
if (
|
||||
!configFunctions
|
||||
.getProperty('settings.lotOccupancy.prints')
|
||||
.getConfigProperty('settings.lotOccupancy.prints')
|
||||
.includes(`pdf/${printName}`) &&
|
||||
!configFunctions
|
||||
.getProperty('settings.workOrders.prints')
|
||||
.getConfigProperty('settings.workOrders.prints')
|
||||
.includes(`pdf/${printName}`)
|
||||
) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/dashboard/?error=printConfigNotAllowed`
|
||||
)
|
||||
|
|
@ -44,7 +44,7 @@ export async function handler(
|
|||
|
||||
if (printConfig === undefined) {
|
||||
response.redirect(
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/dashboard/?error=printConfigNotFound'
|
||||
)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ import { getReportData, getScreenPrintConfig } from '../../helpers/functions.pri
|
|||
export async function handler(request, response) {
|
||||
const printName = request.params.printName;
|
||||
if (!configFunctions
|
||||
.getProperty('settings.lotOccupancy.prints')
|
||||
.getConfigProperty('settings.lotOccupancy.prints')
|
||||
.includes(`screen/${printName}`) &&
|
||||
!configFunctions
|
||||
.getProperty('settings.workOrders.prints')
|
||||
.getConfigProperty('settings.workOrders.prints')
|
||||
.includes(`screen/${printName}`)) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/dashboard/?error=printConfigNotAllowed`);
|
||||
return;
|
||||
}
|
||||
const printConfig = getScreenPrintConfig(printName);
|
||||
if (printConfig === undefined) {
|
||||
response.redirect(configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
response.redirect(configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/dashboard/?error=printConfigNotFound');
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ export async function handler(
|
|||
|
||||
if (
|
||||
!configFunctions
|
||||
.getProperty('settings.lotOccupancy.prints')
|
||||
.getConfigProperty('settings.lotOccupancy.prints')
|
||||
.includes(`screen/${printName}`) &&
|
||||
!configFunctions
|
||||
.getProperty('settings.workOrders.prints')
|
||||
.getConfigProperty('settings.workOrders.prints')
|
||||
.includes(`screen/${printName}`)
|
||||
) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/dashboard/?error=printConfigNotAllowed`
|
||||
)
|
||||
|
|
@ -32,7 +32,7 @@ export async function handler(
|
|||
|
||||
if (printConfig === undefined) {
|
||||
response.redirect(
|
||||
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
||||
configFunctions.getConfigProperty('reverseProxy.urlPrefix') +
|
||||
'/dashboard/?error=printConfigNotFound'
|
||||
)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ export async function handler(request, response) {
|
|||
includeMilestones: true
|
||||
});
|
||||
if (workOrder === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`);
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
const workOrderTypes = await getWorkOrderTypes();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export async function handler(
|
|||
|
||||
if (workOrder === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/workOrders/?error=workOrderIdNotFound`
|
||||
)
|
||||
|
|
@ -29,7 +29,7 @@ export async function handler(
|
|||
|
||||
if (workOrder.workOrderCloseDate) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/workOrders/${workOrder.workOrderId!.toString()}/?error=workOrderIsClosed`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export async function handler(request, response) {
|
|||
includeMilestones: true
|
||||
});
|
||||
if (workOrder === undefined) {
|
||||
response.redirect(`${configFunctions.getProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`);
|
||||
response.redirect(`${configFunctions.getConfigProperty('reverseProxy.urlPrefix')}/workOrders/?error=workOrderIdNotFound`);
|
||||
return;
|
||||
}
|
||||
response.render('workOrder-view', {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export async function handler(
|
|||
|
||||
if (workOrder === undefined) {
|
||||
response.redirect(
|
||||
`${configFunctions.getProperty(
|
||||
`${configFunctions.getConfigProperty(
|
||||
'reverseProxy.urlPrefix'
|
||||
)}/workOrders/?error=workOrderIdNotFound`
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ActiveDirectory from 'activedirectory2';
|
||||
import * as configFunctions from './functions.config.js';
|
||||
const userDomain = configFunctions.getProperty('application.userDomain');
|
||||
const activeDirectoryConfig = configFunctions.getProperty('activeDirectory');
|
||||
const userDomain = configFunctions.getConfigProperty('application.userDomain');
|
||||
const activeDirectoryConfig = configFunctions.getConfigProperty('activeDirectory');
|
||||
async function authenticateViaActiveDirectory(userName, password) {
|
||||
return await new Promise((resolve) => {
|
||||
try {
|
||||
|
|
@ -46,7 +46,7 @@ const safeRedirects = new Set([
|
|||
const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/;
|
||||
const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/;
|
||||
export function getSafeRedirectURL(possibleRedirectURL = '') {
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix');
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
|
||||
if (typeof possibleRedirectURL === 'string') {
|
||||
const urlToCheck = possibleRedirectURL.startsWith(urlPrefix)
|
||||
? possibleRedirectURL.slice(urlPrefix.length)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ import ActiveDirectory from 'activedirectory2'
|
|||
|
||||
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: string,
|
||||
|
|
@ -64,7 +64,7 @@ const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/
|
|||
const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/
|
||||
|
||||
export function getSafeRedirectURL(possibleRedirectURL = ''): string {
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix')
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix')
|
||||
|
||||
if (typeof possibleRedirectURL === 'string') {
|
||||
const urlToCheck = possibleRedirectURL.startsWith(urlPrefix)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ export async function getOccupancyTypePrintsById(occupancyTypeId) {
|
|||
return [];
|
||||
}
|
||||
if (occupancyType.occupancyTypePrints.includes('*')) {
|
||||
return configFunctions.getProperty('settings.lotOccupancy.prints');
|
||||
return configFunctions.getConfigProperty('settings.lotOccupancy.prints');
|
||||
}
|
||||
return occupancyType.occupancyTypePrints ?? [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ export async function getOccupancyTypePrintsById(
|
|||
}
|
||||
|
||||
if (occupancyType.occupancyTypePrints.includes('*')) {
|
||||
return configFunctions.getProperty('settings.lotOccupancy.prints')
|
||||
return configFunctions.getConfigProperty('settings.lotOccupancy.prints')
|
||||
}
|
||||
|
||||
return occupancyType.occupancyTypePrints ?? []
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import type { config as MSSQLConfig } from 'mssql';
|
||||
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 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 getProperty(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 getProperty(propertyName: 'application.ntfyStartup'): ConfigNtfyStartup | undefined;
|
||||
export declare function getProperty(propertyName: 'activeDirectory'): ConfigActiveDirectory;
|
||||
export declare function getProperty(propertyName: 'settings.lot.lotNamePattern'): RegExp;
|
||||
export declare function getProperty(propertyName: 'settings.lot.lotNameSortNameFunction'): (lotName: string) => string;
|
||||
export declare function getProperty(propertyName: 'settings.printPdf.contentDisposition'): 'attachment' | 'inline';
|
||||
export declare function getProperty(propertyName: 'settings.dynamicsGP.mssqlConfig'): MSSQLConfig;
|
||||
export declare function getProperty(propertyName: 'settings.dynamicsGP.lookupOrder'): DynamicsGPLookup[];
|
||||
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 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 getConfigProperty(propertyName: 'application.useTestDatabases' | 'reverseProxy.disableCompression' | 'reverseProxy.disableEtag' | 'session.doKeepAlive' | 'settings.lotOccupancy.occupancyEndDateIsRequired' | 'settings.dynamicsGP.integrationIsEnabled'): boolean;
|
||||
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 getConfigProperty(propertyName: 'application.ntfyStartup'): ConfigNtfyStartup | undefined;
|
||||
export declare function getConfigProperty(propertyName: 'activeDirectory'): ConfigActiveDirectory;
|
||||
export declare function getConfigProperty(propertyName: 'settings.lot.lotNamePattern'): RegExp;
|
||||
export declare function getConfigProperty(propertyName: 'settings.lot.lotNameSortNameFunction'): (lotName: string) => string;
|
||||
export declare function getConfigProperty(propertyName: 'settings.printPdf.contentDisposition'): 'attachment' | 'inline';
|
||||
export declare function getConfigProperty(propertyName: 'settings.dynamicsGP.mssqlConfig'): MSSQLConfig;
|
||||
export declare function getConfigProperty(propertyName: 'settings.dynamicsGP.lookupOrder'): DynamicsGPLookup[];
|
||||
export declare const keepAliveMillis: number;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ configFallbackValues.set('settings.dynamicsGP.lookupOrder', ['invoice']);
|
|||
configFallbackValues.set('settings.dynamicsGP.accountCodes', []);
|
||||
configFallbackValues.set('settings.dynamicsGP.itemNumbers', []);
|
||||
configFallbackValues.set('settings.dynamicsGP.trialBalanceCodes', []);
|
||||
export function getProperty(propertyName) {
|
||||
export function getConfigProperty(propertyName) {
|
||||
const propertyNameSplit = propertyName.split('.');
|
||||
let currentObject = config;
|
||||
for (const propertyNamePiece of propertyNameSplit) {
|
||||
|
|
@ -66,6 +66,6 @@ export function getProperty(propertyName) {
|
|||
}
|
||||
return currentObject;
|
||||
}
|
||||
export const keepAliveMillis = getProperty('session.doKeepAlive')
|
||||
? Math.max(getProperty('session.maxAgeMillis') / 2, getProperty('session.maxAgeMillis') - 10 * 60 * 1000)
|
||||
export const keepAliveMillis = getConfigProperty('session.doKeepAlive')
|
||||
? Math.max(getConfigProperty('session.maxAgeMillis') / 2, getConfigProperty('session.maxAgeMillis') - 10 * 60 * 1000)
|
||||
: 0;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ configFallbackValues.set('settings.dynamicsGP.trialBalanceCodes', [])
|
|||
* Set up function overloads
|
||||
*/
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName:
|
||||
| 'application.applicationName'
|
||||
| 'application.logoURL'
|
||||
|
|
@ -134,7 +134,7 @@ export function getProperty(
|
|||
| 'settings.workOrders.calendarEmailAddress'
|
||||
): string
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName:
|
||||
| 'application.httpPort'
|
||||
| 'application.maximumProcesses'
|
||||
|
|
@ -146,7 +146,7 @@ export function getProperty(
|
|||
| 'settings.adminCleanup.recordDeleteAgeDays'
|
||||
): number
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName:
|
||||
| 'application.useTestDatabases'
|
||||
| 'reverseProxy.disableCompression'
|
||||
|
|
@ -156,7 +156,7 @@ export function getProperty(
|
|||
| 'settings.dynamicsGP.integrationIsEnabled'
|
||||
): boolean
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName:
|
||||
| 'users.testing'
|
||||
| 'users.canLogin'
|
||||
|
|
@ -169,33 +169,33 @@ export function getProperty(
|
|||
| 'settings.workOrders.prints'
|
||||
): string[]
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName: 'application.ntfyStartup'
|
||||
): ConfigNtfyStartup | undefined
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName: 'activeDirectory'
|
||||
): 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'
|
||||
): (lotName: string) => string
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName: 'settings.printPdf.contentDisposition'
|
||||
): 'attachment' | 'inline'
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName: 'settings.dynamicsGP.mssqlConfig'
|
||||
): MSSQLConfig
|
||||
|
||||
export function getProperty(
|
||||
export function getConfigProperty(
|
||||
propertyName: 'settings.dynamicsGP.lookupOrder'
|
||||
): DynamicsGPLookup[]
|
||||
|
||||
export function getProperty(propertyName: string): unknown {
|
||||
export function getConfigProperty(propertyName: string): unknown {
|
||||
const propertyNameSplit = propertyName.split('.')
|
||||
|
||||
let currentObject = config
|
||||
|
|
@ -212,9 +212,9 @@ export function getProperty(propertyName: string): unknown {
|
|||
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
|
||||
getConfigProperty('session.maxAgeMillis') / 2,
|
||||
getConfigProperty('session.maxAgeMillis') - 10 * 60 * 1000
|
||||
)
|
||||
: 0
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { DynamicsGP } from '@cityssm/dynamics-gp';
|
||||
import * as configFunctions from './functions.config.js';
|
||||
let gp;
|
||||
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
gp = new DynamicsGP(configFunctions.getProperty('settings.dynamicsGP.mssqlConfig'));
|
||||
if (configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
gp = new DynamicsGP(configFunctions.getConfigProperty('settings.dynamicsGP.mssqlConfig'));
|
||||
}
|
||||
function filterCashReceipt(cashReceipt) {
|
||||
const accountCodes = configFunctions.getProperty('settings.dynamicsGP.accountCodes');
|
||||
const accountCodes = configFunctions.getConfigProperty('settings.dynamicsGP.accountCodes');
|
||||
if (accountCodes.length > 0) {
|
||||
for (const detail of cashReceipt.details) {
|
||||
if (accountCodes.includes(detail.accountCode)) {
|
||||
|
|
@ -22,7 +22,7 @@ function filterCashReceipt(cashReceipt) {
|
|||
return cashReceipt;
|
||||
}
|
||||
function filterInvoice(invoice) {
|
||||
const itemNumbers = configFunctions.getProperty('settings.dynamicsGP.itemNumbers');
|
||||
const itemNumbers = configFunctions.getConfigProperty('settings.dynamicsGP.itemNumbers');
|
||||
for (const itemNumber of itemNumbers) {
|
||||
const found = invoice.lineItems.some((itemRecord) => {
|
||||
return itemRecord.itemNumber === itemNumber;
|
||||
|
|
@ -37,7 +37,7 @@ function filterExtendedInvoice(invoice) {
|
|||
if (filterInvoice(invoice) === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const trialBalanceCodes = configFunctions.getProperty('settings.dynamicsGP.trialBalanceCodes');
|
||||
const trialBalanceCodes = configFunctions.getConfigProperty('settings.dynamicsGP.trialBalanceCodes');
|
||||
if (trialBalanceCodes.length > 0 &&
|
||||
trialBalanceCodes.includes(invoice.trialBalanceCode ?? '')) {
|
||||
return invoice;
|
||||
|
|
@ -115,11 +115,11 @@ async function _getDynamicsGPDocument(documentNumber, lookupType) {
|
|||
return document;
|
||||
}
|
||||
export async function getDynamicsGPDocument(documentNumber) {
|
||||
if (!configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
if (!configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
return undefined;
|
||||
}
|
||||
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);
|
||||
if (document !== undefined) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ import * as configFunctions from './functions.config.js'
|
|||
|
||||
let gp: DynamicsGP
|
||||
|
||||
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
if (configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||
gp = new DynamicsGP(
|
||||
configFunctions.getProperty('settings.dynamicsGP.mssqlConfig')
|
||||
configFunctions.getConfigProperty('settings.dynamicsGP.mssqlConfig')
|
||||
)
|
||||
}
|
||||
|
||||
function filterCashReceipt(
|
||||
cashReceipt: DiamondCashReceipt
|
||||
): DiamondCashReceipt | undefined {
|
||||
const accountCodes = configFunctions.getProperty(
|
||||
const accountCodes = configFunctions.getConfigProperty(
|
||||
'settings.dynamicsGP.accountCodes'
|
||||
)
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ function filterCashReceipt(
|
|||
}
|
||||
|
||||
function filterInvoice(invoice: GPInvoice): GPInvoice | undefined {
|
||||
const itemNumbers = configFunctions.getProperty(
|
||||
const itemNumbers = configFunctions.getConfigProperty(
|
||||
'settings.dynamicsGP.itemNumbers'
|
||||
)
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ function filterExtendedInvoice(
|
|||
return undefined
|
||||
}
|
||||
|
||||
const trialBalanceCodes = configFunctions.getProperty(
|
||||
const trialBalanceCodes = configFunctions.getConfigProperty(
|
||||
'settings.dynamicsGP.trialBalanceCodes'
|
||||
)
|
||||
|
||||
|
|
@ -177,14 +177,14 @@ export async function getDynamicsGPDocument(
|
|||
documentNumber: string
|
||||
): Promise<DynamicsGPDocument | undefined> {
|
||||
if (
|
||||
!configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')
|
||||
!configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')
|
||||
) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let document: DynamicsGPDocument | undefined
|
||||
|
||||
for (const lookupType of configFunctions.getProperty(
|
||||
for (const lookupType of configFunctions.getConfigProperty(
|
||||
'settings.dynamicsGP.lookupOrder'
|
||||
)) {
|
||||
document = await _getDynamicsGPDocument(documentNumber, lookupType)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { getWorkOrder } from '../database/getWorkOrder.js';
|
|||
import * as configFunctions from './functions.config.js';
|
||||
const screenPrintConfigs = {
|
||||
lotOccupancy: {
|
||||
title: `${configFunctions.getProperty('aliases.lot')} ${configFunctions.getProperty('aliases.occupancy')} Print`,
|
||||
title: `${configFunctions.getConfigProperty('aliases.lot')} ${configFunctions.getConfigProperty('aliases.occupancy')} Print`,
|
||||
params: ['lotOccupancyId']
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ interface PrintConfig {
|
|||
|
||||
const screenPrintConfigs: Record<string, PrintConfig> = {
|
||||
lotOccupancy: {
|
||||
title: `${configFunctions.getProperty(
|
||||
title: `${configFunctions.getConfigProperty(
|
||||
'aliases.lot'
|
||||
)} ${configFunctions.getProperty('aliases.occupancy')} Print`,
|
||||
)} ${configFunctions.getConfigProperty('aliases.occupancy')} Print`,
|
||||
params: ['lotOccupancyId']
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue