linting
parent
c5ef5cbeba
commit
b10fbde530
4
app.js
4
app.js
|
|
@ -14,7 +14,7 @@ import * as permissionHandlers from './handlers/permissions.js';
|
||||||
import { getSafeRedirectURL } from './helpers/functions.authentication.js';
|
import { getSafeRedirectURL } from './helpers/functions.authentication.js';
|
||||||
import * as configFunctions from './helpers/functions.config.js';
|
import * as configFunctions from './helpers/functions.config.js';
|
||||||
import * as printFunctions from './helpers/functions.print.js';
|
import * as printFunctions from './helpers/functions.print.js';
|
||||||
import * as databaseInitializer from './helpers/initializer.database.js';
|
import { initializeDatabase } from './helpers/initializer.database.js';
|
||||||
import routerAdmin from './routes/admin.js';
|
import routerAdmin from './routes/admin.js';
|
||||||
import routerApi from './routes/api.js';
|
import routerApi from './routes/api.js';
|
||||||
import routerDashboard from './routes/dashboard.js';
|
import routerDashboard from './routes/dashboard.js';
|
||||||
|
|
@ -27,7 +27,7 @@ import routerReports from './routes/reports.js';
|
||||||
import routerWorkOrders from './routes/workOrders.js';
|
import routerWorkOrders from './routes/workOrders.js';
|
||||||
import { version } from './version.js';
|
import { version } from './version.js';
|
||||||
const debug = Debug(`lot-occupancy-system:app:${process.pid}`);
|
const debug = Debug(`lot-occupancy-system:app:${process.pid}`);
|
||||||
databaseInitializer.initializeDatabase();
|
initializeDatabase();
|
||||||
const _dirname = '.';
|
const _dirname = '.';
|
||||||
export const app = express();
|
export const app = express();
|
||||||
app.disable('X-Powered-By');
|
app.disable('X-Powered-By');
|
||||||
|
|
|
||||||
4
app.ts
4
app.ts
|
|
@ -16,7 +16,7 @@ import * as permissionHandlers from './handlers/permissions.js'
|
||||||
import { getSafeRedirectURL } from './helpers/functions.authentication.js'
|
import { getSafeRedirectURL } from './helpers/functions.authentication.js'
|
||||||
import * as configFunctions from './helpers/functions.config.js'
|
import * as configFunctions from './helpers/functions.config.js'
|
||||||
import * as printFunctions from './helpers/functions.print.js'
|
import * as printFunctions from './helpers/functions.print.js'
|
||||||
import * as databaseInitializer from './helpers/initializer.database.js'
|
import { initializeDatabase } from './helpers/initializer.database.js'
|
||||||
import routerAdmin from './routes/admin.js'
|
import routerAdmin from './routes/admin.js'
|
||||||
import routerApi from './routes/api.js'
|
import routerApi from './routes/api.js'
|
||||||
import routerDashboard from './routes/dashboard.js'
|
import routerDashboard from './routes/dashboard.js'
|
||||||
|
|
@ -35,7 +35,7 @@ const debug = Debug(`lot-occupancy-system:app:${process.pid}`)
|
||||||
* INITIALIZE THE DATABASE
|
* INITIALIZE THE DATABASE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
databaseInitializer.initializeDatabase()
|
initializeDatabase()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* INITIALIZE APP
|
* INITIALIZE APP
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
import { dateToInteger, dateToTimeInteger } from '@cityssm/utils-datetime';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export default async function addLotComment(lotCommentForm, user) {
|
export default async function addLotComment(lotCommentForm, user) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
|
|
@ -10,7 +10,7 @@ export default async function addLotComment(lotCommentForm, user) {
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(lotCommentForm.lotId, dateTimeFunctions.dateToInteger(rightNow), dateTimeFunctions.dateToTimeInteger(rightNow), lotCommentForm.lotComment, user.userName, rightNow.getTime(), user.userName, rightNow.getTime());
|
.run(lotCommentForm.lotId, dateToInteger(rightNow), dateToTimeInteger(rightNow), lotCommentForm.lotComment, user.userName, rightNow.getTime(), user.userName, rightNow.getTime());
|
||||||
database.release();
|
database.release();
|
||||||
return result.lastInsertRowid;
|
return result.lastInsertRowid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime'
|
import { dateToInteger, dateToTimeInteger } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
|
|
@ -26,8 +26,8 @@ export default async function addLotComment(
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
lotCommentForm.lotId,
|
lotCommentForm.lotId,
|
||||||
dateTimeFunctions.dateToInteger(rightNow),
|
dateToInteger(rightNow),
|
||||||
dateTimeFunctions.dateToTimeInteger(rightNow),
|
dateToTimeInteger(rightNow),
|
||||||
lotCommentForm.lotComment,
|
lotCommentForm.lotComment,
|
||||||
user.userName,
|
user.userName,
|
||||||
rightNow.getTime(),
|
rightNow.getTime(),
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
import { dateStringToInteger } from '@cityssm/utils-datetime';
|
||||||
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js';
|
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js';
|
||||||
import addOrUpdateLotOccupancyField from './addOrUpdateLotOccupancyField.js';
|
import addOrUpdateLotOccupancyField from './addOrUpdateLotOccupancyField.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export default async function addLotOccupancy(lotOccupancyForm, user, connectedDatabase) {
|
export default async function addLotOccupancy(lotOccupancyForm, user, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const rightNowMillis = Date.now();
|
const rightNowMillis = Date.now();
|
||||||
const occupancyStartDate = dateTimeFunctions.dateStringToInteger(lotOccupancyForm.occupancyStartDateString);
|
const occupancyStartDate = dateStringToInteger(lotOccupancyForm.occupancyStartDateString);
|
||||||
if (occupancyStartDate <= 0) {
|
if (occupancyStartDate <= 0) {
|
||||||
console.error(lotOccupancyForm);
|
console.error(lotOccupancyForm);
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,7 @@ export default async function addLotOccupancy(lotOccupancyForm, user, connectedD
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(lotOccupancyForm.occupancyTypeId, lotOccupancyForm.lotId === '' ? undefined : lotOccupancyForm.lotId, occupancyStartDate, lotOccupancyForm.occupancyEndDateString === ''
|
.run(lotOccupancyForm.occupancyTypeId, lotOccupancyForm.lotId === '' ? undefined : lotOccupancyForm.lotId, occupancyStartDate, lotOccupancyForm.occupancyEndDateString === ''
|
||||||
? undefined
|
? undefined
|
||||||
: dateTimeFunctions.dateStringToInteger(lotOccupancyForm.occupancyEndDateString), user.userName, rightNowMillis, user.userName, rightNowMillis);
|
: dateStringToInteger(lotOccupancyForm.occupancyEndDateString), user.userName, rightNowMillis, user.userName, rightNowMillis);
|
||||||
const lotOccupancyId = result.lastInsertRowid;
|
const lotOccupancyId = result.lastInsertRowid;
|
||||||
const occupancyTypeFieldIds = (lotOccupancyForm.occupancyTypeFieldIds ?? '').split(',');
|
const occupancyTypeFieldIds = (lotOccupancyForm.occupancyTypeFieldIds ?? '').split(',');
|
||||||
for (const occupancyTypeFieldId of occupancyTypeFieldIds) {
|
for (const occupancyTypeFieldId of occupancyTypeFieldIds) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime'
|
import { type DateString, dateStringToInteger } from '@cityssm/utils-datetime'
|
||||||
import type { PoolConnection } from 'better-sqlite-pool'
|
import type { PoolConnection } from 'better-sqlite-pool'
|
||||||
|
|
||||||
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js'
|
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js'
|
||||||
|
|
@ -37,8 +37,8 @@ export default async function addLotOccupancy(
|
||||||
|
|
||||||
const rightNowMillis = Date.now()
|
const rightNowMillis = Date.now()
|
||||||
|
|
||||||
const occupancyStartDate = dateTimeFunctions.dateStringToInteger(
|
const occupancyStartDate = dateStringToInteger(
|
||||||
lotOccupancyForm.occupancyStartDateString as dateTimeFunctions.DateString
|
lotOccupancyForm.occupancyStartDateString as DateString
|
||||||
)
|
)
|
||||||
|
|
||||||
if (occupancyStartDate <= 0) {
|
if (occupancyStartDate <= 0) {
|
||||||
|
|
@ -60,8 +60,8 @@ export default async function addLotOccupancy(
|
||||||
occupancyStartDate,
|
occupancyStartDate,
|
||||||
lotOccupancyForm.occupancyEndDateString === ''
|
lotOccupancyForm.occupancyEndDateString === ''
|
||||||
? undefined
|
? undefined
|
||||||
: dateTimeFunctions.dateStringToInteger(
|
: dateStringToInteger(
|
||||||
lotOccupancyForm.occupancyEndDateString as dateTimeFunctions.DateString
|
lotOccupancyForm.occupancyEndDateString as DateString
|
||||||
),
|
),
|
||||||
user.userName,
|
user.userName,
|
||||||
rightNowMillis,
|
rightNowMillis,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
import { dateToInteger, dateToTimeInteger } from '@cityssm/utils-datetime';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export default async function addWorkOrderComment(workOrderCommentForm, user) {
|
export default async function addWorkOrderComment(workOrderCommentForm, user) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
|
|
@ -11,7 +11,7 @@ export default async function addWorkOrderComment(workOrderCommentForm, user) {
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(workOrderCommentForm.workOrderId, dateTimeFunctions.dateToInteger(rightNow), dateTimeFunctions.dateToTimeInteger(rightNow), workOrderCommentForm.workOrderComment, user.userName, rightNow.getTime(), user.userName, rightNow.getTime());
|
.run(workOrderCommentForm.workOrderId, dateToInteger(rightNow), dateToTimeInteger(rightNow), workOrderCommentForm.workOrderComment, user.userName, rightNow.getTime(), user.userName, rightNow.getTime());
|
||||||
database.release();
|
database.release();
|
||||||
return result.lastInsertRowid;
|
return result.lastInsertRowid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime'
|
import { dateToInteger, dateToTimeInteger } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
|
|
@ -27,8 +27,8 @@ export default async function addWorkOrderComment(
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
workOrderCommentForm.workOrderId,
|
workOrderCommentForm.workOrderId,
|
||||||
dateTimeFunctions.dateToInteger(rightNow),
|
dateToInteger(rightNow),
|
||||||
dateTimeFunctions.dateToTimeInteger(rightNow),
|
dateToTimeInteger(rightNow),
|
||||||
workOrderCommentForm.workOrderComment,
|
workOrderCommentForm.workOrderComment,
|
||||||
user.userName,
|
user.userName,
|
||||||
rightNow.getTime(),
|
rightNow.getTime(),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
import { dateIntegerToString, dateStringToInteger, dateToInteger, timeIntegerToString } from '@cityssm/utils-datetime';
|
||||||
import camelCase from 'camelcase';
|
import camelCase from 'camelcase';
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
|
|
@ -132,7 +132,7 @@ export default async function getReportData(reportName, reportParameters = {}) {
|
||||||
where o.recordDelete_timeMillis is null
|
where o.recordDelete_timeMillis is null
|
||||||
and (o.occupancyEndDate is null or o.occupancyEndDate >= ?)
|
and (o.occupancyEndDate is null or o.occupancyEndDate >= ?)
|
||||||
and l.mapId = ?`;
|
and l.mapId = ?`;
|
||||||
sqlParameters.push(dateTimeFunctions.dateToInteger(new Date()), reportParameters.mapId);
|
sqlParameters.push(dateToInteger(new Date()), reportParameters.mapId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'lotOccupancyComments-all': {
|
case 'lotOccupancyComments-all': {
|
||||||
|
|
@ -184,7 +184,7 @@ export default async function getReportData(reportName, reportParameters = {}) {
|
||||||
from LotOccupancyTransactions t
|
from LotOccupancyTransactions t
|
||||||
where t.recordDelete_timeMillis is null
|
where t.recordDelete_timeMillis is null
|
||||||
and t.transactionDate = ?`;
|
and t.transactionDate = ?`;
|
||||||
sqlParameters.push(dateTimeFunctions.dateStringToInteger(reportParameters.transactionDateString));
|
sqlParameters.push(dateStringToInteger(reportParameters.transactionDateString));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'workOrders-all': {
|
case 'workOrders-all': {
|
||||||
|
|
@ -281,8 +281,8 @@ export default async function getReportData(reportName, reportParameters = {}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
database.function('userFn_dateIntegerToString', dateTimeFunctions.dateIntegerToString);
|
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||||
database.function('userFn_timeIntegerToString', dateTimeFunctions.timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
const rows = database.prepare(sql).all(sqlParameters);
|
const rows = database.prepare(sql).all(sqlParameters);
|
||||||
database.release();
|
database.release();
|
||||||
return rows;
|
return rows;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||||
/* eslint-disable no-case-declarations */
|
/* eslint-disable no-case-declarations */
|
||||||
|
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime'
|
import {
|
||||||
|
type DateString,
|
||||||
|
dateIntegerToString,
|
||||||
|
dateStringToInteger,
|
||||||
|
dateToInteger,
|
||||||
|
timeIntegerToString
|
||||||
|
} from '@cityssm/utils-datetime'
|
||||||
import camelCase from 'camelcase'
|
import camelCase from 'camelcase'
|
||||||
|
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js'
|
import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
|
|
@ -166,10 +172,7 @@ export default async function getReportData(
|
||||||
and (o.occupancyEndDate is null or o.occupancyEndDate >= ?)
|
and (o.occupancyEndDate is null or o.occupancyEndDate >= ?)
|
||||||
and l.mapId = ?`
|
and l.mapId = ?`
|
||||||
|
|
||||||
sqlParameters.push(
|
sqlParameters.push(dateToInteger(new Date()), reportParameters.mapId)
|
||||||
dateTimeFunctions.dateToInteger(new Date()),
|
|
||||||
reportParameters.mapId
|
|
||||||
)
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -231,8 +234,8 @@ export default async function getReportData(
|
||||||
and t.transactionDate = ?`
|
and t.transactionDate = ?`
|
||||||
|
|
||||||
sqlParameters.push(
|
sqlParameters.push(
|
||||||
dateTimeFunctions.dateStringToInteger(
|
dateStringToInteger(
|
||||||
reportParameters.transactionDateString as dateTimeFunctions.DateString
|
reportParameters.transactionDateString as DateString
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
@ -350,14 +353,8 @@ export default async function getReportData(
|
||||||
|
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
database.function(
|
database.function('userFn_dateIntegerToString', dateIntegerToString)
|
||||||
'userFn_dateIntegerToString',
|
database.function('userFn_timeIntegerToString', timeIntegerToString)
|
||||||
dateTimeFunctions.dateIntegerToString
|
|
||||||
)
|
|
||||||
database.function(
|
|
||||||
'userFn_timeIntegerToString',
|
|
||||||
dateTimeFunctions.timeIntegerToString
|
|
||||||
)
|
|
||||||
|
|
||||||
const rows = database.prepare(sql).all(sqlParameters)
|
const rows = database.prepare(sql).all(sqlParameters)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||||
/* eslint-disable n/no-unpublished-import */
|
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, n/no-unpublished-import */
|
||||||
|
|
||||||
import gulp from 'gulp'
|
import gulp from 'gulp'
|
||||||
import changed from 'gulp-changed'
|
import changed from 'gulp-changed'
|
||||||
|
|
@ -22,6 +22,7 @@ function publicSCSSFunction(): NodeJS.ReadWriteStream {
|
||||||
.pipe(
|
.pipe(
|
||||||
sass({ outputStyle: 'compressed', includePaths: ['node_modules'] }).on(
|
sass({ outputStyle: 'compressed', includePaths: ['node_modules'] }).on(
|
||||||
'error',
|
'error',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
sass.logError
|
sass.logError
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
import * as userFunctions from '../helpers/functions.user.js';
|
import { apiKeyIsValid, userCanUpdate, userIsAdmin } from '../helpers/functions.user.js';
|
||||||
const urlPrefix = getConfigProperty('reverseProxy.urlPrefix');
|
const urlPrefix = getConfigProperty('reverseProxy.urlPrefix');
|
||||||
const forbiddenStatus = 403;
|
const forbiddenStatus = 403;
|
||||||
const forbiddenJSON = {
|
const forbiddenJSON = {
|
||||||
|
|
@ -8,35 +8,35 @@ const forbiddenJSON = {
|
||||||
};
|
};
|
||||||
const forbiddenRedirectURL = `${urlPrefix}/dashboard/?error=accessDenied`;
|
const forbiddenRedirectURL = `${urlPrefix}/dashboard/?error=accessDenied`;
|
||||||
export function adminGetHandler(request, response, next) {
|
export function adminGetHandler(request, response, next) {
|
||||||
if (userFunctions.userIsAdmin(request)) {
|
if (userIsAdmin(request)) {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.redirect(forbiddenRedirectURL);
|
response.redirect(forbiddenRedirectURL);
|
||||||
}
|
}
|
||||||
export function adminPostHandler(request, response, next) {
|
export function adminPostHandler(request, response, next) {
|
||||||
if (userFunctions.userIsAdmin(request)) {
|
if (userIsAdmin(request)) {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.status(forbiddenStatus).json(forbiddenJSON);
|
response.status(forbiddenStatus).json(forbiddenJSON);
|
||||||
}
|
}
|
||||||
export function updateGetHandler(request, response, next) {
|
export function updateGetHandler(request, response, next) {
|
||||||
if (userFunctions.userCanUpdate(request)) {
|
if (userCanUpdate(request)) {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.redirect(forbiddenRedirectURL);
|
response.redirect(forbiddenRedirectURL);
|
||||||
}
|
}
|
||||||
export function updatePostHandler(request, response, next) {
|
export function updatePostHandler(request, response, next) {
|
||||||
if (userFunctions.userCanUpdate(request)) {
|
if (userCanUpdate(request)) {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.status(forbiddenStatus).json(forbiddenJSON);
|
response.status(forbiddenStatus).json(forbiddenJSON);
|
||||||
}
|
}
|
||||||
export async function apiGetHandler(request, response, next) {
|
export async function apiGetHandler(request, response, next) {
|
||||||
if (await userFunctions.apiKeyIsValid(request)) {
|
if (await apiKeyIsValid(request)) {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
import type { NextFunction, Request, Response } from 'express'
|
import type { NextFunction, Request, Response } from 'express'
|
||||||
|
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js'
|
import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
import * as userFunctions from '../helpers/functions.user.js'
|
import {
|
||||||
|
apiKeyIsValid,
|
||||||
|
userCanUpdate,
|
||||||
|
userIsAdmin
|
||||||
|
} from '../helpers/functions.user.js'
|
||||||
|
|
||||||
const urlPrefix = getConfigProperty('reverseProxy.urlPrefix')
|
const urlPrefix = getConfigProperty('reverseProxy.urlPrefix')
|
||||||
|
|
||||||
|
|
@ -19,7 +23,7 @@ export function adminGetHandler(
|
||||||
response: Response,
|
response: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
): void {
|
): void {
|
||||||
if (userFunctions.userIsAdmin(request)) {
|
if (userIsAdmin(request)) {
|
||||||
next()
|
next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +36,7 @@ export function adminPostHandler(
|
||||||
response: Response,
|
response: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
): void {
|
): void {
|
||||||
if (userFunctions.userIsAdmin(request)) {
|
if (userIsAdmin(request)) {
|
||||||
next()
|
next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +49,7 @@ export function updateGetHandler(
|
||||||
response: Response,
|
response: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
): void {
|
): void {
|
||||||
if (userFunctions.userCanUpdate(request)) {
|
if (userCanUpdate(request)) {
|
||||||
next()
|
next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +62,7 @@ export function updatePostHandler(
|
||||||
response: Response,
|
response: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
): void {
|
): void {
|
||||||
if (userFunctions.userCanUpdate(request)) {
|
if (userCanUpdate(request)) {
|
||||||
next()
|
next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +75,7 @@ export async function apiGetHandler(
|
||||||
response: Response,
|
response: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (await userFunctions.apiKeyIsValid(request)) {
|
if (await apiKeyIsValid(request)) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
response.redirect(`${urlPrefix}/login`)
|
response.redirect(`${urlPrefix}/login`)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
import { dateToString } from '@cityssm/utils-datetime';
|
||||||
import getMaps from '../../database/getMaps.js';
|
import getMaps from '../../database/getMaps.js';
|
||||||
import { getLotStatuses, getLotTypes } from '../../helpers/functions.cache.js';
|
import { getLotStatuses, getLotTypes } from '../../helpers/functions.cache.js';
|
||||||
export default async function handler(_request, response) {
|
export default async function handler(_request, response) {
|
||||||
|
|
@ -8,7 +8,7 @@ export default async function handler(_request, response) {
|
||||||
const lotStatuses = await getLotStatuses();
|
const lotStatuses = await getLotStatuses();
|
||||||
response.render('report-search', {
|
response.render('report-search', {
|
||||||
headTitle: 'Reports',
|
headTitle: 'Reports',
|
||||||
todayDateString: dateTimeFunctions.dateToString(rightNow),
|
todayDateString: dateToString(rightNow),
|
||||||
maps,
|
maps,
|
||||||
lotTypes,
|
lotTypes,
|
||||||
lotStatuses
|
lotStatuses
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as dateTimeFunctions from '@cityssm/utils-datetime'
|
import { dateToString } from '@cityssm/utils-datetime'
|
||||||
import type { Request, Response } from 'express'
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
import getMaps from '../../database/getMaps.js'
|
import getMaps from '../../database/getMaps.js'
|
||||||
|
|
@ -16,7 +16,7 @@ export default async function handler(
|
||||||
|
|
||||||
response.render('report-search', {
|
response.render('report-search', {
|
||||||
headTitle: 'Reports',
|
headTitle: 'Reports',
|
||||||
todayDateString: dateTimeFunctions.dateToString(rightNow),
|
todayDateString: dateToString(rightNow),
|
||||||
maps,
|
maps,
|
||||||
lotTypes,
|
lotTypes,
|
||||||
lotStatuses
|
lotStatuses
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type * as recordTypes from '../types/recordTypes';
|
import type { LotOccupancy, LotOccupancyFee, LotOccupancyOccupant } from '../types/recordTypes';
|
||||||
export declare function filterOccupantsByLotOccupantType(lotOccupancy: recordTypes.LotOccupancy, lotOccupantType: string): recordTypes.LotOccupancyOccupant[];
|
export declare function filterOccupantsByLotOccupantType(lotOccupancy: LotOccupancy, lotOccupantType: string): LotOccupancyOccupant[];
|
||||||
export declare function getFieldValueByOccupancyTypeField(lotOccupancy: recordTypes.LotOccupancy, occupancyTypeField: string): string | undefined;
|
export declare function getFieldValueByOccupancyTypeField(lotOccupancy: LotOccupancy, occupancyTypeField: string): string | undefined;
|
||||||
export declare function getFeesByFeeCategory(lotOccupancy: recordTypes.LotOccupancy, feeCategory: string, feeCategoryContains?: boolean): recordTypes.LotOccupancyFee[];
|
export declare function getFeesByFeeCategory(lotOccupancy: LotOccupancy, feeCategory: string, feeCategoryContains?: boolean): LotOccupancyFee[];
|
||||||
export declare function getTransactionTotal(lotOccupancy: recordTypes.LotOccupancy): number;
|
export declare function getTransactionTotal(lotOccupancy: LotOccupancy): number;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import type * as recordTypes from '../types/recordTypes'
|
import type { LotOccupancy, LotOccupancyFee, LotOccupancyOccupant } from '../types/recordTypes'
|
||||||
|
|
||||||
export function filterOccupantsByLotOccupantType(
|
export function filterOccupantsByLotOccupantType(
|
||||||
lotOccupancy: recordTypes.LotOccupancy,
|
lotOccupancy: LotOccupancy,
|
||||||
lotOccupantType: string
|
lotOccupantType: string
|
||||||
): recordTypes.LotOccupancyOccupant[] {
|
): LotOccupancyOccupant[] {
|
||||||
const lotOccupantTypeLowerCase = lotOccupantType.toLowerCase()
|
const lotOccupantTypeLowerCase = lotOccupantType.toLowerCase()
|
||||||
|
|
||||||
return (lotOccupancy.lotOccupancyOccupants ?? []).filter(
|
return (lotOccupancy.lotOccupancyOccupants ?? []).filter(
|
||||||
|
|
@ -17,7 +17,7 @@ export function filterOccupantsByLotOccupantType(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFieldValueByOccupancyTypeField(
|
export function getFieldValueByOccupancyTypeField(
|
||||||
lotOccupancy: recordTypes.LotOccupancy,
|
lotOccupancy: LotOccupancy,
|
||||||
occupancyTypeField: string
|
occupancyTypeField: string
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
const occupancyTypeFieldLowerCase = occupancyTypeField.toLowerCase()
|
const occupancyTypeFieldLowerCase = occupancyTypeField.toLowerCase()
|
||||||
|
|
@ -39,10 +39,10 @@ export function getFieldValueByOccupancyTypeField(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFeesByFeeCategory(
|
export function getFeesByFeeCategory(
|
||||||
lotOccupancy: recordTypes.LotOccupancy,
|
lotOccupancy: LotOccupancy,
|
||||||
feeCategory: string,
|
feeCategory: string,
|
||||||
feeCategoryContains = false
|
feeCategoryContains = false
|
||||||
): recordTypes.LotOccupancyFee[] {
|
): LotOccupancyFee[] {
|
||||||
const feeCategoryLowerCase = feeCategory.toLowerCase()
|
const feeCategoryLowerCase = feeCategory.toLowerCase()
|
||||||
|
|
||||||
return (lotOccupancy.lotOccupancyFees ?? []).filter((possibleFee) => {
|
return (lotOccupancy.lotOccupancyFees ?? []).filter((possibleFee) => {
|
||||||
|
|
@ -56,7 +56,7 @@ export function getFeesByFeeCategory(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTransactionTotal(
|
export function getTransactionTotal(
|
||||||
lotOccupancy: recordTypes.LotOccupancy
|
lotOccupancy: LotOccupancy
|
||||||
): number {
|
): number {
|
||||||
let transactionTotal = 0
|
let transactionTotal = 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { getUserNameFromApiKey } from './functions.api.js';
|
import { getUserNameFromApiKey } from './functions.api.js';
|
||||||
import * as configFunctions from './functions.config.js';
|
import { getConfigProperty } from './functions.config.js';
|
||||||
export function userIsAdmin(request) {
|
export function userIsAdmin(request) {
|
||||||
return request.session?.user?.userProperties?.isAdmin ?? false;
|
return request.session?.user?.userProperties?.isAdmin ?? false;
|
||||||
}
|
}
|
||||||
|
|
@ -15,9 +15,7 @@ export async function apiKeyIsValid(request) {
|
||||||
if (userName === undefined) {
|
if (userName === undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return configFunctions
|
return getConfigProperty('users.canLogin').some((currentUserName) => {
|
||||||
.getConfigProperty('users.canLogin')
|
|
||||||
.some((currentUserName) => {
|
|
||||||
return userName === currentUserName.toLowerCase();
|
return userName === currentUserName.toLowerCase();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { getUserNameFromApiKey } from './functions.api.js'
|
import { getUserNameFromApiKey } from './functions.api.js'
|
||||||
import * as configFunctions from './functions.config.js'
|
import { getConfigProperty } from './functions.config.js'
|
||||||
|
|
||||||
export interface UserRequest {
|
export interface UserRequest {
|
||||||
session?: {
|
session?: {
|
||||||
|
|
@ -34,9 +34,7 @@ export async function apiKeyIsValid(request: APIRequest): Promise<boolean> {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return configFunctions
|
return getConfigProperty('users.canLogin').some((currentUserName) => {
|
||||||
.getConfigProperty('users.canLogin')
|
|
||||||
.some((currentUserName) => {
|
|
||||||
return userName === currentUserName.toLowerCase()
|
return userName === currentUserName.toLowerCase()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const user = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export async function initializeCemeteryDatabase() {
|
export async function initializeCemeteryDatabase() {
|
||||||
debug('Checking for ' + databasePath + '...');
|
debug(`Checking for ${databasePath}...`);
|
||||||
const databaseInitialized = initializeDatabase();
|
const databaseInitialized = initializeDatabase();
|
||||||
if (!databaseInitialized) {
|
if (!databaseInitialized) {
|
||||||
debug('Database already created.\n' +
|
debug('Database already created.\n' +
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
|
||||||
/*
|
/*
|
||||||
* Ensure database does not already exist
|
* Ensure database does not already exist
|
||||||
*/
|
*/
|
||||||
debug('Checking for ' + databasePath + '...')
|
debug(`Checking for ${databasePath}...`)
|
||||||
|
|
||||||
const databaseInitialized = initializeDatabase()
|
const databaseInitialized = initializeDatabase()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import Debug from 'debug';
|
||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import { useTestDatabases } from '../data/databasePaths.js';
|
import { useTestDatabases } from '../data/databasePaths.js';
|
||||||
import { getApiKey } from '../helpers/functions.api.js';
|
import { getApiKey } from '../helpers/functions.api.js';
|
||||||
import * as authenticationFunctions from '../helpers/functions.authentication.js';
|
import { authenticate, getSafeRedirectURL } from '../helpers/functions.authentication.js';
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
const debug = Debug('lot-occupancy-system:login');
|
const debug = Debug('lot-occupancy-system:login');
|
||||||
export const router = Router();
|
export const router = Router();
|
||||||
|
|
@ -10,7 +10,7 @@ function getHandler(request, response) {
|
||||||
const sessionCookieName = getConfigProperty('session.cookieName');
|
const sessionCookieName = getConfigProperty('session.cookieName');
|
||||||
if (request.session.user !== undefined &&
|
if (request.session.user !== undefined &&
|
||||||
request.cookies[sessionCookieName] !== undefined) {
|
request.cookies[sessionCookieName] !== undefined) {
|
||||||
const redirectURL = authenticationFunctions.getSafeRedirectURL((request.query.redirect ?? ''));
|
const redirectURL = getSafeRedirectURL((request.query.redirect ?? ''));
|
||||||
response.redirect(redirectURL);
|
response.redirect(redirectURL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -26,7 +26,7 @@ async function postHandler(request, response) {
|
||||||
const userName = (typeof request.body.userName === 'string' ? request.body.userName : '');
|
const userName = (typeof request.body.userName === 'string' ? request.body.userName : '');
|
||||||
const passwordPlain = (typeof request.body.password === 'string' ? request.body.password : '');
|
const passwordPlain = (typeof request.body.password === 'string' ? request.body.password : '');
|
||||||
const unsafeRedirectURL = request.body.redirect;
|
const unsafeRedirectURL = request.body.redirect;
|
||||||
const redirectURL = authenticationFunctions.getSafeRedirectURL(typeof unsafeRedirectURL === 'string' ? unsafeRedirectURL : '');
|
const redirectURL = getSafeRedirectURL(typeof unsafeRedirectURL === 'string' ? unsafeRedirectURL : '');
|
||||||
let isAuthenticated = false;
|
let isAuthenticated = false;
|
||||||
if (userName.startsWith('*')) {
|
if (userName.startsWith('*')) {
|
||||||
if (useTestDatabases && userName === passwordPlain) {
|
if (useTestDatabases && userName === passwordPlain) {
|
||||||
|
|
@ -37,7 +37,7 @@ async function postHandler(request, response) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (userName !== '' && passwordPlain !== '') {
|
else if (userName !== '' && passwordPlain !== '') {
|
||||||
isAuthenticated = await authenticationFunctions.authenticate(userName, passwordPlain);
|
isAuthenticated = await authenticate(userName, passwordPlain);
|
||||||
}
|
}
|
||||||
let userObject;
|
let userObject;
|
||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ import {
|
||||||
|
|
||||||
import { useTestDatabases } from '../data/databasePaths.js'
|
import { useTestDatabases } from '../data/databasePaths.js'
|
||||||
import { getApiKey } from '../helpers/functions.api.js'
|
import { getApiKey } from '../helpers/functions.api.js'
|
||||||
import * as authenticationFunctions from '../helpers/functions.authentication.js'
|
import {
|
||||||
|
authenticate,
|
||||||
|
getSafeRedirectURL
|
||||||
|
} from '../helpers/functions.authentication.js'
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js'
|
import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
|
|
||||||
const debug = Debug('lot-occupancy-system:login')
|
const debug = Debug('lot-occupancy-system:login')
|
||||||
|
|
@ -22,7 +25,7 @@ function getHandler(request: Request, response: Response): void {
|
||||||
request.session.user !== undefined &&
|
request.session.user !== undefined &&
|
||||||
request.cookies[sessionCookieName] !== undefined
|
request.cookies[sessionCookieName] !== undefined
|
||||||
) {
|
) {
|
||||||
const redirectURL = authenticationFunctions.getSafeRedirectURL(
|
const redirectURL = getSafeRedirectURL(
|
||||||
(request.query.redirect ?? '') as string
|
(request.query.redirect ?? '') as string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -51,7 +54,7 @@ async function postHandler(
|
||||||
|
|
||||||
const unsafeRedirectURL = request.body.redirect
|
const unsafeRedirectURL = request.body.redirect
|
||||||
|
|
||||||
const redirectURL = authenticationFunctions.getSafeRedirectURL(
|
const redirectURL = getSafeRedirectURL(
|
||||||
typeof unsafeRedirectURL === 'string' ? unsafeRedirectURL : ''
|
typeof unsafeRedirectURL === 'string' ? unsafeRedirectURL : ''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -66,10 +69,7 @@ async function postHandler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (userName !== '' && passwordPlain !== '') {
|
} else if (userName !== '' && passwordPlain !== '') {
|
||||||
isAuthenticated = await authenticationFunctions.authenticate(
|
isAuthenticated = await authenticate(userName, passwordPlain)
|
||||||
userName,
|
|
||||||
passwordPlain
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let userObject: User | undefined
|
let userObject: User | undefined
|
||||||
|
|
|
||||||
|
|
@ -24,34 +24,34 @@ import handler_doUpdateLotOccupancyComment from '../handlers/lotOccupancies-post
|
||||||
import handler_doUpdateLotOccupancyFeeQuantity from '../handlers/lotOccupancies-post/doUpdateLotOccupancyFeeQuantity.js';
|
import handler_doUpdateLotOccupancyFeeQuantity from '../handlers/lotOccupancies-post/doUpdateLotOccupancyFeeQuantity.js';
|
||||||
import handler_doUpdateLotOccupancyOccupant from '../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js';
|
import handler_doUpdateLotOccupancyOccupant from '../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js';
|
||||||
import handler_doUpdateLotOccupancyTransaction from '../handlers/lotOccupancies-post/doUpdateLotOccupancyTransaction.js';
|
import handler_doUpdateLotOccupancyTransaction from '../handlers/lotOccupancies-post/doUpdateLotOccupancyTransaction.js';
|
||||||
import * as permissionHandlers from '../handlers/permissions.js';
|
import { updateGetHandler, updatePostHandler } from '../handlers/permissions.js';
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
export const router = Router();
|
export const router = Router();
|
||||||
router.get('/', handler_search);
|
router.get('/', handler_search);
|
||||||
router.post('/doSearchLotOccupancies', handler_doSearchLotOccupancies);
|
router.post('/doSearchLotOccupancies', handler_doSearchLotOccupancies);
|
||||||
router.get('/new', permissionHandlers.updateGetHandler, handler_new);
|
router.get('/new', updateGetHandler, handler_new);
|
||||||
router.post('/doGetOccupancyTypeFields', permissionHandlers.updatePostHandler, handler_doGetOccupancyTypeFields);
|
router.post('/doGetOccupancyTypeFields', updatePostHandler, handler_doGetOccupancyTypeFields);
|
||||||
router.post('/doCreateLotOccupancy', permissionHandlers.updatePostHandler, handler_doCreateLotOccupancy);
|
router.post('/doCreateLotOccupancy', updatePostHandler, handler_doCreateLotOccupancy);
|
||||||
router.get('/:lotOccupancyId', handler_view);
|
router.get('/:lotOccupancyId', handler_view);
|
||||||
router.get('/:lotOccupancyId/edit', permissionHandlers.updateGetHandler, handler_edit);
|
router.get('/:lotOccupancyId/edit', updateGetHandler, handler_edit);
|
||||||
router.post('/doUpdateLotOccupancy', permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancy);
|
router.post('/doUpdateLotOccupancy', updatePostHandler, handler_doUpdateLotOccupancy);
|
||||||
router.post('/doCopyLotOccupancy', permissionHandlers.updatePostHandler, handler_doCopyLotOccupancy);
|
router.post('/doCopyLotOccupancy', updatePostHandler, handler_doCopyLotOccupancy);
|
||||||
router.post('/doDeleteLotOccupancy', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancy);
|
router.post('/doDeleteLotOccupancy', updatePostHandler, handler_doDeleteLotOccupancy);
|
||||||
router.post('/doSearchPastOccupants', permissionHandlers.updatePostHandler, handler_doSearchPastOccupants);
|
router.post('/doSearchPastOccupants', updatePostHandler, handler_doSearchPastOccupants);
|
||||||
router.post('/doAddLotOccupancyOccupant', permissionHandlers.updatePostHandler, handler_doAddLotOccupancyOccupant);
|
router.post('/doAddLotOccupancyOccupant', updatePostHandler, handler_doAddLotOccupancyOccupant);
|
||||||
router.post('/doUpdateLotOccupancyOccupant', permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyOccupant);
|
router.post('/doUpdateLotOccupancyOccupant', updatePostHandler, handler_doUpdateLotOccupancyOccupant);
|
||||||
router.post('/doDeleteLotOccupancyOccupant', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyOccupant);
|
router.post('/doDeleteLotOccupancyOccupant', updatePostHandler, handler_doDeleteLotOccupancyOccupant);
|
||||||
router.post('/doAddLotOccupancyComment', permissionHandlers.updatePostHandler, handler_doAddLotOccupancyComment);
|
router.post('/doAddLotOccupancyComment', updatePostHandler, handler_doAddLotOccupancyComment);
|
||||||
router.post('/doUpdateLotOccupancyComment', permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyComment);
|
router.post('/doUpdateLotOccupancyComment', updatePostHandler, handler_doUpdateLotOccupancyComment);
|
||||||
router.post('/doDeleteLotOccupancyComment', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyComment);
|
router.post('/doDeleteLotOccupancyComment', updatePostHandler, handler_doDeleteLotOccupancyComment);
|
||||||
router.post('/doGetFees', permissionHandlers.updatePostHandler, handler_doGetFees);
|
router.post('/doGetFees', updatePostHandler, handler_doGetFees);
|
||||||
router.post('/doAddLotOccupancyFee', permissionHandlers.updatePostHandler, handler_doAddLotOccupancyFee);
|
router.post('/doAddLotOccupancyFee', updatePostHandler, handler_doAddLotOccupancyFee);
|
||||||
router.post('/doUpdateLotOccupancyFeeQuantity', permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyFeeQuantity);
|
router.post('/doUpdateLotOccupancyFeeQuantity', updatePostHandler, handler_doUpdateLotOccupancyFeeQuantity);
|
||||||
router.post('/doDeleteLotOccupancyFee', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyFee);
|
router.post('/doDeleteLotOccupancyFee', updatePostHandler, handler_doDeleteLotOccupancyFee);
|
||||||
if (getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
if (getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||||
router.post('/doGetDynamicsGPDocument', permissionHandlers.updatePostHandler, handler_doGetDynamicsGPDocument);
|
router.post('/doGetDynamicsGPDocument', updatePostHandler, handler_doGetDynamicsGPDocument);
|
||||||
}
|
}
|
||||||
router.post('/doAddLotOccupancyTransaction', permissionHandlers.updatePostHandler, handler_doAddLotOccupancyTransaction);
|
router.post('/doAddLotOccupancyTransaction', updatePostHandler, handler_doAddLotOccupancyTransaction);
|
||||||
router.post('/doUpdateLotOccupancyTransaction', permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyTransaction);
|
router.post('/doUpdateLotOccupancyTransaction', updatePostHandler, handler_doUpdateLotOccupancyTransaction);
|
||||||
router.post('/doDeleteLotOccupancyTransaction', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyTransaction);
|
router.post('/doDeleteLotOccupancyTransaction', updatePostHandler, handler_doDeleteLotOccupancyTransaction);
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import handler_doUpdateLotOccupancyComment from '../handlers/lotOccupancies-post
|
||||||
import handler_doUpdateLotOccupancyFeeQuantity from '../handlers/lotOccupancies-post/doUpdateLotOccupancyFeeQuantity.js'
|
import handler_doUpdateLotOccupancyFeeQuantity from '../handlers/lotOccupancies-post/doUpdateLotOccupancyFeeQuantity.js'
|
||||||
import handler_doUpdateLotOccupancyOccupant from '../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js'
|
import handler_doUpdateLotOccupancyOccupant from '../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js'
|
||||||
import handler_doUpdateLotOccupancyTransaction from '../handlers/lotOccupancies-post/doUpdateLotOccupancyTransaction.js'
|
import handler_doUpdateLotOccupancyTransaction from '../handlers/lotOccupancies-post/doUpdateLotOccupancyTransaction.js'
|
||||||
import * as permissionHandlers from '../handlers/permissions.js'
|
import { updateGetHandler, updatePostHandler } from '../handlers/permissions.js'
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js'
|
import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
|
|
||||||
export const router = Router()
|
export const router = Router()
|
||||||
|
|
@ -41,21 +41,17 @@ router.post(
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
|
|
||||||
router.get(
|
router.get('/new', updateGetHandler, handler_new as RequestHandler)
|
||||||
'/new',
|
|
||||||
permissionHandlers.updateGetHandler,
|
|
||||||
handler_new as RequestHandler
|
|
||||||
)
|
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doGetOccupancyTypeFields',
|
'/doGetOccupancyTypeFields',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doGetOccupancyTypeFields as RequestHandler
|
handler_doGetOccupancyTypeFields as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doCreateLotOccupancy',
|
'/doCreateLotOccupancy',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doCreateLotOccupancy as RequestHandler
|
handler_doCreateLotOccupancy as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -67,25 +63,25 @@ router.get('/:lotOccupancyId', handler_view as RequestHandler)
|
||||||
|
|
||||||
router.get(
|
router.get(
|
||||||
'/:lotOccupancyId/edit',
|
'/:lotOccupancyId/edit',
|
||||||
permissionHandlers.updateGetHandler,
|
updateGetHandler,
|
||||||
handler_edit as RequestHandler
|
handler_edit as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doUpdateLotOccupancy',
|
'/doUpdateLotOccupancy',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doUpdateLotOccupancy as RequestHandler
|
handler_doUpdateLotOccupancy as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doCopyLotOccupancy',
|
'/doCopyLotOccupancy',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doCopyLotOccupancy as RequestHandler
|
handler_doCopyLotOccupancy as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doDeleteLotOccupancy',
|
'/doDeleteLotOccupancy',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doDeleteLotOccupancy as RequestHandler
|
handler_doDeleteLotOccupancy as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -93,25 +89,25 @@ router.post(
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doSearchPastOccupants',
|
'/doSearchPastOccupants',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doSearchPastOccupants as RequestHandler
|
handler_doSearchPastOccupants as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doAddLotOccupancyOccupant',
|
'/doAddLotOccupancyOccupant',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doAddLotOccupancyOccupant as RequestHandler
|
handler_doAddLotOccupancyOccupant as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doUpdateLotOccupancyOccupant',
|
'/doUpdateLotOccupancyOccupant',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doUpdateLotOccupancyOccupant as RequestHandler
|
handler_doUpdateLotOccupancyOccupant as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doDeleteLotOccupancyOccupant',
|
'/doDeleteLotOccupancyOccupant',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doDeleteLotOccupancyOccupant as RequestHandler
|
handler_doDeleteLotOccupancyOccupant as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -119,19 +115,19 @@ router.post(
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doAddLotOccupancyComment',
|
'/doAddLotOccupancyComment',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doAddLotOccupancyComment as RequestHandler
|
handler_doAddLotOccupancyComment as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doUpdateLotOccupancyComment',
|
'/doUpdateLotOccupancyComment',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doUpdateLotOccupancyComment as RequestHandler
|
handler_doUpdateLotOccupancyComment as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doDeleteLotOccupancyComment',
|
'/doDeleteLotOccupancyComment',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doDeleteLotOccupancyComment as RequestHandler
|
handler_doDeleteLotOccupancyComment as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -139,25 +135,25 @@ router.post(
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doGetFees',
|
'/doGetFees',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doGetFees as RequestHandler
|
handler_doGetFees as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doAddLotOccupancyFee',
|
'/doAddLotOccupancyFee',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doAddLotOccupancyFee as RequestHandler
|
handler_doAddLotOccupancyFee as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doUpdateLotOccupancyFeeQuantity',
|
'/doUpdateLotOccupancyFeeQuantity',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doUpdateLotOccupancyFeeQuantity as RequestHandler
|
handler_doUpdateLotOccupancyFeeQuantity as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doDeleteLotOccupancyFee',
|
'/doDeleteLotOccupancyFee',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doDeleteLotOccupancyFee as RequestHandler
|
handler_doDeleteLotOccupancyFee as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -166,26 +162,26 @@ router.post(
|
||||||
if (getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
if (getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||||
router.post(
|
router.post(
|
||||||
'/doGetDynamicsGPDocument',
|
'/doGetDynamicsGPDocument',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doGetDynamicsGPDocument as RequestHandler
|
handler_doGetDynamicsGPDocument as RequestHandler
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doAddLotOccupancyTransaction',
|
'/doAddLotOccupancyTransaction',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doAddLotOccupancyTransaction as RequestHandler
|
handler_doAddLotOccupancyTransaction as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doUpdateLotOccupancyTransaction',
|
'/doUpdateLotOccupancyTransaction',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doUpdateLotOccupancyTransaction as RequestHandler
|
handler_doUpdateLotOccupancyTransaction as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doDeleteLotOccupancyTransaction',
|
'/doDeleteLotOccupancyTransaction',
|
||||||
permissionHandlers.updatePostHandler,
|
updatePostHandler,
|
||||||
handler_doDeleteLotOccupancyTransaction as RequestHandler
|
handler_doDeleteLotOccupancyTransaction as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue