code updates for node 18+
parent
c5837f27b4
commit
18a5eb729a
|
|
@ -1,75 +1,10 @@
|
|||
{
|
||||
"root": true,
|
||||
"env": {
|
||||
"es6": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": ["./tsconfig.json", "./tsconfig.client.json"],
|
||||
"ecmaVersion": 2020,
|
||||
"ecmaVersion": 2022,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "unicorn"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"standard-with-typescript",
|
||||
"plugin:import/recommended",
|
||||
"plugin:import/typescript",
|
||||
"plugin:node/recommended",
|
||||
"plugin:promise/recommended",
|
||||
"plugin:unicorn/recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/member-delimiter-style": [
|
||||
"error",
|
||||
{
|
||||
"multiline": {
|
||||
"delimiter": "none"
|
||||
},
|
||||
"singleline": {
|
||||
"delimiter": "semi"
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-extra-semi": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-misused-promises": "warn",
|
||||
"@typescript-eslint/restrict-plus-operands": "warn",
|
||||
"@typescript-eslint/space-before-function-paren": "off",
|
||||
"@typescript-eslint/strict-boolean-expressions": "warn",
|
||||
"node/no-missing-import": "off",
|
||||
"node/no-unpublished-import": "off",
|
||||
"unicorn/consistent-function-scoping": "warn",
|
||||
"unicorn/empty-brace-spaces": "off",
|
||||
"unicorn/filename-case": [
|
||||
"error",
|
||||
{
|
||||
"case": "camelCase",
|
||||
"ignore": ["DB", "URL"]
|
||||
}
|
||||
],
|
||||
"unicorn/prevent-abbreviations": [
|
||||
"error",
|
||||
{
|
||||
"replacements": {
|
||||
"def": {
|
||||
"definition": true
|
||||
},
|
||||
"ele": {
|
||||
"element": true
|
||||
},
|
||||
"eles": {
|
||||
"elements": true
|
||||
},
|
||||
"fns": {
|
||||
"functions": true
|
||||
},
|
||||
"res": {
|
||||
"result": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"extends": ["eslint-config-cityssm"]
|
||||
}
|
||||
|
|
@ -1,3 +1,2 @@
|
|||
import './helpers/polyfills.js';
|
||||
export declare const app: import("express-serve-static-core").Express;
|
||||
export default app;
|
||||
|
|
|
|||
44
app.js
44
app.js
|
|
@ -1,35 +1,33 @@
|
|||
import './helpers/polyfills.js';
|
||||
import createError from 'http-errors';
|
||||
import express from 'express';
|
||||
import compression from 'compression';
|
||||
import path from 'node:path';
|
||||
import * as htmlFns from '@cityssm/expressjs-server-js/htmlFns.js';
|
||||
import * as stringFns from '@cityssm/expressjs-server-js/stringFns.js';
|
||||
import * as dateTimeFns from '@cityssm/utils-datetime';
|
||||
import compression from 'compression';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import csurf from 'csurf';
|
||||
import Debug from 'debug';
|
||||
import express from 'express';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
import session from 'express-session';
|
||||
import createError from 'http-errors';
|
||||
import FileStore from 'session-file-store';
|
||||
import { useTestDatabases } from './data/databasePaths.js';
|
||||
import * as permissionHandlers from './handlers/permissions.js';
|
||||
import routerLogin from './routes/login.js';
|
||||
import routerDashboard from './routes/dashboard.js';
|
||||
import routerApi from './routes/api.js';
|
||||
import routerPrint from './routes/print.js';
|
||||
import routerMaps from './routes/maps.js';
|
||||
import routerLots from './routes/lots.js';
|
||||
import routerLotOccupancies from './routes/lotOccupancies.js';
|
||||
import routerWorkOrders from './routes/workOrders.js';
|
||||
import routerReports from './routes/reports.js';
|
||||
import routerAdmin from './routes/admin.js';
|
||||
import { getSafeRedirectURL } from './helpers/functions.authentication.js';
|
||||
import * as configFunctions from './helpers/functions.config.js';
|
||||
import * as printFunctions from './helpers/functions.print.js';
|
||||
import * as dateTimeFns from '@cityssm/utils-datetime';
|
||||
import * as stringFns from '@cityssm/expressjs-server-js/stringFns.js';
|
||||
import * as htmlFns from '@cityssm/expressjs-server-js/htmlFns.js';
|
||||
import { version } from './version.js';
|
||||
import * as databaseInitializer from './helpers/initializer.database.js';
|
||||
import { apiGetHandler } from './handlers/permissions.js';
|
||||
import { getSafeRedirectURL } from './helpers/functions.authentication.js';
|
||||
import { useTestDatabases } from './data/databasePaths.js';
|
||||
import Debug from 'debug';
|
||||
import routerAdmin from './routes/admin.js';
|
||||
import routerApi from './routes/api.js';
|
||||
import routerDashboard from './routes/dashboard.js';
|
||||
import routerLogin from './routes/login.js';
|
||||
import routerLotOccupancies from './routes/lotOccupancies.js';
|
||||
import routerLots from './routes/lots.js';
|
||||
import routerMaps from './routes/maps.js';
|
||||
import routerPrint from './routes/print.js';
|
||||
import routerReports from './routes/reports.js';
|
||||
import routerWorkOrders from './routes/workOrders.js';
|
||||
import { version } from './version.js';
|
||||
const debug = Debug(`lot-occupancy-system:app:${process.pid}`);
|
||||
databaseInitializer.initializeDatabase();
|
||||
const _dirname = '.';
|
||||
|
|
@ -120,7 +118,7 @@ app.get(urlPrefix + '/', sessionChecker, (_request, response) => {
|
|||
response.redirect(urlPrefix + '/dashboard');
|
||||
});
|
||||
app.use(urlPrefix + '/dashboard', sessionChecker, routerDashboard);
|
||||
app.use(urlPrefix + '/api/:apiKey', apiGetHandler, routerApi);
|
||||
app.use(urlPrefix + '/api/:apiKey', permissionHandlers.apiGetHandler, routerApi);
|
||||
app.use(urlPrefix + '/print', sessionChecker, routerPrint);
|
||||
app.use(urlPrefix + '/maps', sessionChecker, routerMaps);
|
||||
app.use(urlPrefix + '/lots', sessionChecker, routerLots);
|
||||
|
|
|
|||
57
app.ts
57
app.ts
|
|
@ -1,45 +1,36 @@
|
|||
import './helpers/polyfills.js'
|
||||
|
||||
import createError from 'http-errors'
|
||||
import express, { type RequestHandler } from 'express'
|
||||
|
||||
import compression from 'compression'
|
||||
import path from 'node:path'
|
||||
|
||||
import * as htmlFns from '@cityssm/expressjs-server-js/htmlFns.js'
|
||||
import * as stringFns from '@cityssm/expressjs-server-js/stringFns.js'
|
||||
import * as dateTimeFns from '@cityssm/utils-datetime'
|
||||
import compression from 'compression'
|
||||
import cookieParser from 'cookie-parser'
|
||||
import csurf from 'csurf'
|
||||
import Debug from 'debug'
|
||||
import express, { type RequestHandler } from 'express'
|
||||
import rateLimit from 'express-rate-limit'
|
||||
|
||||
import session from 'express-session'
|
||||
import createError from 'http-errors'
|
||||
import FileStore from 'session-file-store'
|
||||
|
||||
import { useTestDatabases } from './data/databasePaths.js'
|
||||
import * as permissionHandlers from './handlers/permissions.js'
|
||||
import routerLogin from './routes/login.js'
|
||||
import routerDashboard from './routes/dashboard.js'
|
||||
import routerApi from './routes/api.js'
|
||||
import routerPrint from './routes/print.js'
|
||||
import routerMaps from './routes/maps.js'
|
||||
import routerLots from './routes/lots.js'
|
||||
import routerLotOccupancies from './routes/lotOccupancies.js'
|
||||
import routerWorkOrders from './routes/workOrders.js'
|
||||
import routerReports from './routes/reports.js'
|
||||
import routerAdmin from './routes/admin.js'
|
||||
|
||||
import { getSafeRedirectURL } from './helpers/functions.authentication.js'
|
||||
import * as configFunctions from './helpers/functions.config.js'
|
||||
import * as printFunctions from './helpers/functions.print.js'
|
||||
import * as dateTimeFns from '@cityssm/utils-datetime'
|
||||
import * as stringFns from '@cityssm/expressjs-server-js/stringFns.js'
|
||||
import * as htmlFns from '@cityssm/expressjs-server-js/htmlFns.js'
|
||||
|
||||
import * as databaseInitializer from './helpers/initializer.database.js'
|
||||
import routerAdmin from './routes/admin.js'
|
||||
import routerApi from './routes/api.js'
|
||||
import routerDashboard from './routes/dashboard.js'
|
||||
import routerLogin from './routes/login.js'
|
||||
import routerLotOccupancies from './routes/lotOccupancies.js'
|
||||
import routerLots from './routes/lots.js'
|
||||
import routerMaps from './routes/maps.js'
|
||||
import routerPrint from './routes/print.js'
|
||||
import routerReports from './routes/reports.js'
|
||||
import routerWorkOrders from './routes/workOrders.js'
|
||||
import { version } from './version.js'
|
||||
|
||||
import * as databaseInitializer from './helpers/initializer.database.js'
|
||||
|
||||
import { apiGetHandler } from './handlers/permissions.js'
|
||||
import { getSafeRedirectURL } from './helpers/functions.authentication.js'
|
||||
|
||||
import { useTestDatabases } from './data/databasePaths.js'
|
||||
|
||||
import Debug from 'debug'
|
||||
const debug = Debug(`lot-occupancy-system:app:${process.pid}`)
|
||||
|
||||
/*
|
||||
|
|
@ -240,7 +231,11 @@ app.get(urlPrefix + '/', sessionChecker, (_request, response) => {
|
|||
|
||||
app.use(urlPrefix + '/dashboard', sessionChecker, routerDashboard)
|
||||
|
||||
app.use(urlPrefix + '/api/:apiKey', apiGetHandler as RequestHandler, routerApi)
|
||||
app.use(
|
||||
urlPrefix + '/api/:apiKey',
|
||||
permissionHandlers.apiGetHandler as RequestHandler,
|
||||
routerApi
|
||||
)
|
||||
|
||||
app.use(urlPrefix + '/print', sessionChecker, routerPrint)
|
||||
app.use(urlPrefix + '/maps', sessionChecker, routerMaps)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import '../helpers/polyfills.js';
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import '../helpers/polyfills.js';
|
||||
import cluster from 'node:cluster';
|
||||
import os from 'node:os';
|
||||
import { dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as configFunctions from '../helpers/functions.config.js';
|
||||
import exitHook from 'exit-hook';
|
||||
import ntfyPublish from '@cityssm/ntfy-publish';
|
||||
import Debug from 'debug';
|
||||
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);
|
||||
|
|
|
|||
23
bin/www.ts
23
bin/www.ts
|
|
@ -1,22 +1,15 @@
|
|||
import '../helpers/polyfills.js'
|
||||
|
||||
import cluster from 'node:cluster'
|
||||
import type { Worker } from 'node:cluster'
|
||||
|
||||
import cluster, { type Worker } from 'node:cluster'
|
||||
import os from 'node:os'
|
||||
import { dirname } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import * as configFunctions from '../helpers/functions.config.js'
|
||||
|
||||
import ntfyPublish, { type NtfyMessageOptions } from '@cityssm/ntfy-publish'
|
||||
import Debug from 'debug'
|
||||
import exitHook from 'exit-hook'
|
||||
|
||||
import ntfyPublish from '@cityssm/ntfy-publish'
|
||||
import type * as ntfyTypes from '@cityssm/ntfy-publish/types'
|
||||
import * as configFunctions from '../helpers/functions.config.js'
|
||||
import type { WorkerMessage } from '../types/applicationTypes.js'
|
||||
|
||||
import type { WorkerMessage } from '../types/applicationTypes'
|
||||
|
||||
import Debug from 'debug'
|
||||
const debug = Debug(`lot-occupancy-system:www:${process.pid}`)
|
||||
|
||||
const directoryName = dirname(fileURLToPath(import.meta.url))
|
||||
|
|
@ -71,14 +64,14 @@ if (ntfyStartupConfig !== undefined) {
|
|||
const topic = ntfyStartupConfig.topic
|
||||
const server = ntfyStartupConfig.server
|
||||
|
||||
const ntfyStartupMessage: ntfyTypes.NtfyMessageOptions = {
|
||||
const ntfyStartupMessage: NtfyMessageOptions = {
|
||||
topic,
|
||||
title: configFunctions.getProperty('application.applicationName'),
|
||||
message: 'Application Started',
|
||||
tags: ['arrow_up']
|
||||
}
|
||||
|
||||
const ntfyShutdownMessage: ntfyTypes.NtfyMessageOptions = {
|
||||
const ntfyShutdownMessage: NtfyMessageOptions = {
|
||||
topic,
|
||||
title: configFunctions.getProperty('application.applicationName'),
|
||||
message: 'Application Shut Down',
|
||||
|
|
@ -106,7 +99,7 @@ if (process.env.STARTUP_TEST === 'true') {
|
|||
setTimeout(() => {
|
||||
debug('Killing processes')
|
||||
|
||||
// eslint-disable-next-line no-process-exit, unicorn/no-process-exit
|
||||
// eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
|
||||
process.exit(0)
|
||||
}, 10_000)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { app } from '../app.js';
|
||||
import http from 'node:http';
|
||||
import * as configFunctions from '../helpers/functions.config.js';
|
||||
import exitHook from 'exit-hook';
|
||||
import Debug from 'debug';
|
||||
import exitHook from 'exit-hook';
|
||||
import { app } from '../app.js';
|
||||
import * as configFunctions from '../helpers/functions.config.js';
|
||||
const debug = Debug(`lot-occupancy-system:wwwProcess:${process.pid}`);
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
|
|
@ -29,7 +29,8 @@ function onListening(server) {
|
|||
debug('HTTP Listening on ' + bind);
|
||||
}
|
||||
}
|
||||
process.title = configFunctions.getProperty('application.applicationName') + ' (Worker)';
|
||||
process.title =
|
||||
configFunctions.getProperty('application.applicationName') + ' (Worker)';
|
||||
const httpPort = configFunctions.getProperty('application.httpPort');
|
||||
const httpServer = http.createServer(app);
|
||||
httpServer.listen(httpPort);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
/* eslint-disable no-process-exit, unicorn/no-process-exit */
|
||||
|
||||
import { app } from '../app.js'
|
||||
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
||||
/* eslint-disable n/no-process-exit, unicorn/no-process-exit */
|
||||
|
||||
import http from 'node:http'
|
||||
|
||||
import * as configFunctions from '../helpers/functions.config.js'
|
||||
|
||||
import Debug from 'debug'
|
||||
import exitHook from 'exit-hook'
|
||||
|
||||
import Debug from 'debug'
|
||||
import { app } from '../app.js'
|
||||
import * as configFunctions from '../helpers/functions.config.js'
|
||||
|
||||
const debug = Debug(`lot-occupancy-system:wwwProcess:${process.pid}`)
|
||||
|
||||
interface ServerError extends Error {
|
||||
|
|
@ -58,7 +58,8 @@ function onListening(server: http.Server): void {
|
|||
* Initialize HTTP
|
||||
*/
|
||||
|
||||
process.title = configFunctions.getProperty('application.applicationName') + ' (Worker)'
|
||||
process.title =
|
||||
configFunctions.getProperty('application.applicationName') + ' (Worker)'
|
||||
|
||||
const httpPort = configFunctions.getProperty('application.httpPort')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addFee } from '../../helpers/lotOccupancyDB/addFee.js';
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js';
|
||||
export async function handler(request, response) {
|
||||
const feeId = await addFee(request.body, request.session);
|
||||
const feeId = await addFee(request.body, request.session.user);
|
||||
const feeCategories = await getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addFee } from '../../helpers/lotOccupancyDB/addFee.js'
|
||||
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const feeId = await addFee(request.body, request.session)
|
||||
const feeId = await addFee(request.body, request.session.user as User)
|
||||
|
||||
const feeCategories = await getFeeCategories(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js';
|
||||
export async function handler(request, response) {
|
||||
const feeCategoryId = await addRecord('FeeCategories', request.body.feeCategory, request.body.orderNumber ?? -1, request.session);
|
||||
const feeCategoryId = await addRecord('FeeCategories', request.body.feeCategory, request.body.orderNumber ?? -1, request.session.user);
|
||||
const feeCategories = await getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js'
|
||||
|
||||
export async function handler(
|
||||
|
|
@ -12,7 +11,7 @@ export async function handler(
|
|||
'FeeCategories',
|
||||
request.body.feeCategory,
|
||||
request.body.orderNumber ?? -1,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const feeCategories = await getFeeCategories(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotOccupantType } from '../../helpers/lotOccupancyDB/addLotOccupantType.js';
|
||||
import { getLotOccupantTypes } from '../../helpers/functions.cache.js';
|
||||
import { addLotOccupantType } from '../../helpers/lotOccupancyDB/addLotOccupantType.js';
|
||||
export async function handler(request, response) {
|
||||
const lotOccupantTypeId = await addLotOccupantType(request.body, request.session);
|
||||
const lotOccupantTypeId = await addLotOccupantType(request.body, request.session.user);
|
||||
const lotOccupantTypes = await getLotOccupantTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addLotOccupantType } from '../../helpers/lotOccupancyDB/addLotOccupantType.js'
|
||||
|
||||
import { getLotOccupantTypes } from '../../helpers/functions.cache.js'
|
||||
import { addLotOccupantType } from '../../helpers/lotOccupancyDB/addLotOccupantType.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -10,7 +9,7 @@ export async function handler(
|
|||
): Promise<void> {
|
||||
const lotOccupantTypeId = await addLotOccupantType(
|
||||
request.body,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotOccupantTypes = await getLotOccupantTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
import { getLotStatuses } from '../../helpers/functions.cache.js';
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const lotStatusId = await addRecord('LotStatuses', request.body.lotStatus, request.body.orderNumber ?? -1, request.session);
|
||||
const lotStatusId = await addRecord('LotStatuses', request.body.lotStatus, request.body.orderNumber ?? -1, request.session.user);
|
||||
const lotStatuses = await getLotStatuses();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
import { getLotStatuses } from '../../helpers/functions.cache.js'
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'LotStatuses',
|
||||
request.body.lotStatus,
|
||||
request.body.orderNumber ?? -1,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotStatuses = await getLotStatuses()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js';
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const lotTypeId = await addRecord('LotTypes', request.body.lotType, request.body.orderNumber ?? -1, request.session);
|
||||
const lotTypeId = await addRecord('LotTypes', request.body.lotType, request.body.orderNumber ?? -1, request.session.user);
|
||||
const lotTypes = await getLotTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js'
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'LotTypes',
|
||||
request.body.lotType,
|
||||
request.body.orderNumber ?? -1,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotTypes = await getLotTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotTypeField } from '../../helpers/lotOccupancyDB/addLotTypeField.js';
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js';
|
||||
import { addLotTypeField } from '../../helpers/lotOccupancyDB/addLotTypeField.js';
|
||||
export async function handler(request, response) {
|
||||
const lotTypeFieldId = await addLotTypeField(request.body, request.session);
|
||||
const lotTypeFieldId = await addLotTypeField(request.body, request.session.user);
|
||||
const lotTypes = await getLotTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addLotTypeField } from '../../helpers/lotOccupancyDB/addLotTypeField.js'
|
||||
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js'
|
||||
import { addLotTypeField } from '../../helpers/lotOccupancyDB/addLotTypeField.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const lotTypeFieldId = await addLotTypeField(request.body, request.session)
|
||||
const lotTypeFieldId = await addLotTypeField(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotTypes = await getLotTypes()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const occupancyTypeId = await addRecord('OccupancyTypes', request.body.occupancyType, request.body.orderNumber ?? -1, request.session);
|
||||
const occupancyTypeId = await addRecord('OccupancyTypes', request.body.occupancyType, request.body.orderNumber ?? -1, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -14,7 +14,7 @@ export async function handler(
|
|||
'OccupancyTypes',
|
||||
request.body.occupancyType,
|
||||
request.body.orderNumber ?? -1,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addOccupancyTypeField } from '../../helpers/lotOccupancyDB/addOccupancyTypeField.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { addOccupancyTypeField } from '../../helpers/lotOccupancyDB/addOccupancyTypeField.js';
|
||||
export async function handler(request, response) {
|
||||
const occupancyTypeFieldId = await addOccupancyTypeField(request.body, request.session);
|
||||
const occupancyTypeFieldId = await addOccupancyTypeField(request.body, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addOccupancyTypeField } from '../../helpers/lotOccupancyDB/addOccupancyTypeField.js'
|
||||
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { addOccupancyTypeField } from '../../helpers/lotOccupancyDB/addOccupancyTypeField.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -13,7 +12,7 @@ export async function handler(
|
|||
): Promise<void> {
|
||||
const occupancyTypeFieldId = await addOccupancyTypeField(
|
||||
request.body,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addOccupancyTypePrint } from '../../helpers/lotOccupancyDB/addOccupancyTypePrint.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { addOccupancyTypePrint } from '../../helpers/lotOccupancyDB/addOccupancyTypePrint.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await addOccupancyTypePrint(request.body, request.session);
|
||||
const success = await addOccupancyTypePrint(request.body, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addOccupancyTypePrint } from '../../helpers/lotOccupancyDB/addOccupancyTypePrint.js'
|
||||
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { addOccupancyTypePrint } from '../../helpers/lotOccupancyDB/addOccupancyTypePrint.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await addOccupancyTypePrint(request.body, request.session)
|
||||
const success = await addOccupancyTypePrint(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { getWorkOrderMilestoneTypes } from '../../helpers/functions.cache.js';
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const workOrderMilestoneTypeId = await addRecord('WorkOrderMilestoneTypes', request.body.workOrderMilestoneType, request.body.orderNumber ?? -1, request.session);
|
||||
const workOrderMilestoneTypeId = await addRecord('WorkOrderMilestoneTypes', request.body.workOrderMilestoneType, request.body.orderNumber ?? -1, request.session.user);
|
||||
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'WorkOrderMilestoneTypes',
|
||||
request.body.workOrderMilestoneType,
|
||||
request.body.orderNumber ?? -1,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js';
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const workOrderTypeId = await addRecord('WorkOrderTypes', request.body.workOrderType, request.body.orderNumber ?? -1, request.session);
|
||||
const workOrderTypeId = await addRecord('WorkOrderTypes', request.body.workOrderType, request.body.orderNumber ?? -1, request.session.user);
|
||||
const workOrderTypes = await getWorkOrderTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
|
||||
import { addRecord } from '../../helpers/lotOccupancyDB/addRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'WorkOrderTypes',
|
||||
request.body.workOrderType,
|
||||
request.body.orderNumber ?? -1,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const workOrderTypes = await getWorkOrderTypes()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ export async function handler(_request, response) {
|
|||
const backupDatabasePath = await backupDatabase();
|
||||
if (typeof backupDatabasePath === 'string') {
|
||||
const backupDatabasePathSplit = backupDatabasePath.split(/[/\\]/g);
|
||||
const fileName = backupDatabasePathSplit[backupDatabasePathSplit.length - 1];
|
||||
const fileName = backupDatabasePathSplit.at(-1);
|
||||
response.json({
|
||||
success: true,
|
||||
fileName
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
if (typeof backupDatabasePath === 'string') {
|
||||
const backupDatabasePathSplit = backupDatabasePath.split(/[/\\]/g)
|
||||
|
||||
const fileName = backupDatabasePathSplit[backupDatabasePathSplit.length - 1]
|
||||
const fileName = backupDatabasePathSplit.at(-1)
|
||||
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { cleanupDatabase } from '../../helpers/lotOccupancyDB/cleanupDatabase.js';
|
||||
export async function handler(request, response) {
|
||||
const recordCounts = await cleanupDatabase(request.session);
|
||||
const recordCounts = await cleanupDatabase(request.session.user);
|
||||
response.json({
|
||||
success: true,
|
||||
inactivatedRecordCount: recordCounts.inactivatedRecordCount,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export async function handler(
|
|||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const recordCounts = await cleanupDatabase(request.session)
|
||||
const recordCounts = await cleanupDatabase(request.session.user as User)
|
||||
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('Fees', request.body.feeId, request.session);
|
||||
const success = await deleteRecord('Fees', request.body.feeId, request.session.user);
|
||||
const feeCategories = await getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await deleteRecord('Fees', request.body.feeId, request.session)
|
||||
const success = await deleteRecord('Fees', request.body.feeId, request.session.user as User)
|
||||
|
||||
const feeCategories = await getFeeCategories(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('FeeCategories', request.body.feeCategoryId, request.session);
|
||||
const success = await deleteRecord('FeeCategories', request.body.feeCategoryId, request.session.user);
|
||||
const feeCategories = await getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js'
|
||||
|
||||
export async function handler(
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'FeeCategories',
|
||||
request.body.feeCategoryId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const feeCategories = await getFeeCategories(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getLotOccupantTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('LotOccupantTypes', request.body.lotOccupantTypeId, request.session);
|
||||
const success = await deleteRecord('LotOccupantTypes', request.body.lotOccupantTypeId, request.session.user);
|
||||
const lotOccupantTypes = await getLotOccupantTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getLotOccupantTypes } from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'LotOccupantTypes',
|
||||
request.body.lotOccupantTypeId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotOccupantTypes = await getLotOccupantTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getLotStatuses } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('LotStatuses', request.body.lotStatusId, request.session);
|
||||
const success = await deleteRecord('LotStatuses', request.body.lotStatusId, request.session.user);
|
||||
const lotStatuses = await getLotStatuses();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getLotStatuses } from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'LotStatuses',
|
||||
request.body.lotStatusId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotStatuses = await getLotStatuses()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('LotTypes', request.body.lotTypeId, request.session);
|
||||
const success = await deleteRecord('LotTypes', request.body.lotTypeId, request.session.user);
|
||||
const lotTypes = await getLotTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'LotTypes',
|
||||
request.body.lotTypeId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotTypes = await getLotTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('LotTypeFields', request.body.lotTypeFieldId, request.session);
|
||||
const success = await deleteRecord('LotTypeFields', request.body.lotTypeFieldId, request.session.user);
|
||||
const lotTypes = await getLotTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'LotTypeFields',
|
||||
request.body.lotTypeFieldId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotTypes = await getLotTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('OccupancyTypes', request.body.occupancyTypeId, request.session);
|
||||
const success = await deleteRecord('OccupancyTypes', request.body.occupancyTypeId, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -14,7 +13,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'OccupancyTypes',
|
||||
request.body.occupancyTypeId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('OccupancyTypeFields', request.body.occupancyTypeFieldId, request.session);
|
||||
const success = await deleteRecord('OccupancyTypeFields', request.body.occupancyTypeFieldId, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -14,7 +13,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'OccupancyTypeFields',
|
||||
request.body.occupancyTypeFieldId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteOccupancyTypePrint } from '../../helpers/lotOccupancyDB/deleteOccupancyTypePrint.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteOccupancyTypePrint } from '../../helpers/lotOccupancyDB/deleteOccupancyTypePrint.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteOccupancyTypePrint(request.body.occupancyTypeId, request.body.printEJS, request.session);
|
||||
const success = await deleteOccupancyTypePrint(request.body.occupancyTypeId, request.body.printEJS, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteOccupancyTypePrint } from '../../helpers/lotOccupancyDB/deleteOccupancyTypePrint.js'
|
||||
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { deleteOccupancyTypePrint } from '../../helpers/lotOccupancyDB/deleteOccupancyTypePrint.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -14,7 +13,7 @@ export async function handler(
|
|||
const success = await deleteOccupancyTypePrint(
|
||||
request.body.occupancyTypeId,
|
||||
request.body.printEJS,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getWorkOrderMilestoneTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('WorkOrderMilestoneTypes', request.body.workOrderMilestoneTypeId, request.session);
|
||||
const success = await deleteRecord('WorkOrderMilestoneTypes', request.body.workOrderMilestoneTypeId, request.session.user);
|
||||
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getWorkOrderMilestoneTypes } from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'WorkOrderMilestoneTypes',
|
||||
request.body.workOrderMilestoneTypeId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js';
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('WorkOrderTypes', request.body.workOrderTypeId, request.session);
|
||||
const success = await deleteRecord('WorkOrderTypes', request.body.workOrderTypeId, request.session.user);
|
||||
const workOrderTypes = await getWorkOrderTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'WorkOrderTypes',
|
||||
request.body.workOrderTypeId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const workOrderTypes = await getWorkOrderTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateFee } from '../../helpers/lotOccupancyDB/updateFee.js';
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js';
|
||||
import { updateFee } from '../../helpers/lotOccupancyDB/updateFee.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateFee(request.body, request.session);
|
||||
const success = await updateFee(request.body, request.session.user);
|
||||
const feeCategories = await getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateFee } from '../../helpers/lotOccupancyDB/updateFee.js'
|
||||
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js'
|
||||
import { updateFee } from '../../helpers/lotOccupancyDB/updateFee.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await updateFee(request.body, request.session)
|
||||
const success = await updateFee(request.body, request.session.user as User)
|
||||
|
||||
const feeCategories = await getFeeCategories(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateFeeCategory } from '../../helpers/lotOccupancyDB/updateFeeCategory.js';
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js';
|
||||
import { updateFeeCategory } from '../../helpers/lotOccupancyDB/updateFeeCategory.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateFeeCategory(request.body, request.session);
|
||||
const success = await updateFeeCategory(request.body, request.session.user);
|
||||
const feeCategories = await getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateFeeCategory } from '../../helpers/lotOccupancyDB/updateFeeCategory.js'
|
||||
|
||||
import { getFeeCategories } from '../../helpers/lotOccupancyDB/getFeeCategories.js'
|
||||
import { updateFeeCategory } from '../../helpers/lotOccupancyDB/updateFeeCategory.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await updateFeeCategory(request.body, request.session)
|
||||
const success = await updateFeeCategory(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const feeCategories = await getFeeCategories(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateLotOccupantType } from '../../helpers/lotOccupancyDB/updateLotOccupantType.js';
|
||||
import { getLotOccupantTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateLotOccupantType } from '../../helpers/lotOccupancyDB/updateLotOccupantType.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateLotOccupantType(request.body, request.session);
|
||||
const success = await updateLotOccupantType(request.body, request.session.user);
|
||||
const lotOccupantTypes = await getLotOccupantTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateLotOccupantType } from '../../helpers/lotOccupancyDB/updateLotOccupantType.js'
|
||||
|
||||
import { getLotOccupantTypes } from '../../helpers/functions.cache.js'
|
||||
import { updateLotOccupantType } from '../../helpers/lotOccupancyDB/updateLotOccupantType.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await updateLotOccupantType(request.body, request.session)
|
||||
const success = await updateLotOccupantType(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotOccupantTypes = await getLotOccupantTypes()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
import { getLotStatuses } from '../../helpers/functions.cache.js';
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateRecord('LotStatuses', request.body.lotStatusId, request.body.lotStatus, request.session);
|
||||
const success = await updateRecord('LotStatuses', request.body.lotStatusId, request.body.lotStatus, request.session.user);
|
||||
const lotStatuses = await getLotStatuses();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
import { getLotStatuses } from '../../helpers/functions.cache.js'
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'LotStatuses',
|
||||
request.body.lotStatusId,
|
||||
request.body.lotStatus,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotStatuses = await getLotStatuses()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateRecord('LotTypes', request.body.lotTypeId, request.body.lotType, request.session);
|
||||
const success = await updateRecord('LotTypes', request.body.lotTypeId, request.body.lotType, request.session.user);
|
||||
const lotTypes = await getLotTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js'
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'LotTypes',
|
||||
request.body.lotTypeId,
|
||||
request.body.lotType,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotTypes = await getLotTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateLotTypeField } from '../../helpers/lotOccupancyDB/updateLotTypeField.js';
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateLotTypeField } from '../../helpers/lotOccupancyDB/updateLotTypeField.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateLotTypeField(request.body, request.session);
|
||||
const success = await updateLotTypeField(request.body, request.session.user);
|
||||
const lotTypes = await getLotTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateLotTypeField } from '../../helpers/lotOccupancyDB/updateLotTypeField.js'
|
||||
|
||||
import { getLotTypes } from '../../helpers/functions.cache.js'
|
||||
import { updateLotTypeField } from '../../helpers/lotOccupancyDB/updateLotTypeField.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await updateLotTypeField(request.body, request.session)
|
||||
const success = await updateLotTypeField(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotTypes = await getLotTypes()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateRecord('OccupancyTypes', request.body.occupancyTypeId, request.body.occupancyType, request.session);
|
||||
const success = await updateRecord('OccupancyTypes', request.body.occupancyTypeId, request.body.occupancyType, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -14,7 +14,7 @@ export async function handler(
|
|||
'OccupancyTypes',
|
||||
request.body.occupancyTypeId,
|
||||
request.body.occupancyType,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateOccupancyTypeField } from '../../helpers/lotOccupancyDB/updateOccupancyTypeField.js';
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateOccupancyTypeField } from '../../helpers/lotOccupancyDB/updateOccupancyTypeField.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateOccupancyTypeField(request.body, request.session);
|
||||
const success = await updateOccupancyTypeField(request.body, request.session.user);
|
||||
const occupancyTypes = await getOccupancyTypes();
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateOccupancyTypeField } from '../../helpers/lotOccupancyDB/updateOccupancyTypeField.js'
|
||||
|
||||
import {
|
||||
getAllOccupancyTypeFields,
|
||||
getOccupancyTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { updateOccupancyTypeField } from '../../helpers/lotOccupancyDB/updateOccupancyTypeField.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const success = await updateOccupancyTypeField(request.body, request.session)
|
||||
const success = await updateOccupancyTypeField(
|
||||
request.body,
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const occupancyTypes = await getOccupancyTypes()
|
||||
const allOccupancyTypeFields = await getAllOccupancyTypeFields()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
import { getWorkOrderMilestoneTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateRecord('WorkOrderMilestoneTypes', request.body.workOrderMilestoneTypeId, request.body.workOrderMilestoneType, request.session);
|
||||
const success = await updateRecord('WorkOrderMilestoneTypes', request.body.workOrderMilestoneTypeId, request.body.workOrderMilestoneType, request.session.user);
|
||||
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
import { getWorkOrderMilestoneTypes } from '../../helpers/functions.cache.js'
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'WorkOrderMilestoneTypes',
|
||||
request.body.workOrderMilestoneTypeId,
|
||||
request.body.workOrderMilestoneType,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js';
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await updateRecord('WorkOrderTypes', request.body.workOrderTypeId, request.body.workOrderType, request.session);
|
||||
const success = await updateRecord('WorkOrderTypes', request.body.workOrderTypeId, request.body.workOrderType, request.session.user);
|
||||
const workOrderTypes = await getWorkOrderTypes();
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
|
||||
import { updateRecord } from '../../helpers/lotOccupancyDB/updateRecord.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
|
|
@ -11,7 +11,7 @@ export async function handler(
|
|||
'WorkOrderTypes',
|
||||
request.body.workOrderTypeId,
|
||||
request.body.workOrderType,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const workOrderTypes = await getWorkOrderTypes()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import ical, { ICalEventStatus } from 'ical-generator';
|
||||
import { getWorkOrderMilestones } from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js';
|
||||
import * as configFunctions from '../../helpers/functions.config.js';
|
||||
import { getPrintConfig } from '../../helpers/functions.print.js';
|
||||
import { getWorkOrderMilestones } from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js';
|
||||
const calendarCompany = 'cityssm.github.io';
|
||||
const calendarProduct = configFunctions.getProperty('application.applicationName');
|
||||
const timeStringSplitRegex = /[ :-]/;
|
||||
function escapeHTML(stringToEscape) {
|
||||
return stringToEscape.replace(/[^\d A-Za-z]/g, (c) => `&#${c.codePointAt(0)};`);
|
||||
return stringToEscape.replaceAll(/[^\d a-z]/gi, (c) => `&#${c.codePointAt(0)};`);
|
||||
}
|
||||
function getUrlRoot(request) {
|
||||
return ('http://' +
|
||||
|
|
|
|||
|
|
@ -1,18 +1,15 @@
|
|||
/* eslint-disable unicorn/filename-case */
|
||||
/* eslint-disable unicorn/filename-case, eslint-comments/disable-enable-pair */
|
||||
|
||||
import type { Request, Response } from 'express'
|
||||
import ical, { type ICalEventData, ICalEventStatus } from 'ical-generator'
|
||||
|
||||
import * as configFunctions from '../../helpers/functions.config.js'
|
||||
import { getPrintConfig } from '../../helpers/functions.print.js'
|
||||
import {
|
||||
getWorkOrderMilestones,
|
||||
type WorkOrderMilestoneFilters
|
||||
} from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js'
|
||||
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import * as configFunctions from '../../helpers/functions.config.js'
|
||||
import { getPrintConfig } from '../../helpers/functions.print.js'
|
||||
|
||||
import type * as recordTypes from '../../types/recordTypes'
|
||||
import type { WorkOrderMilestone } from '../../types/recordTypes.js'
|
||||
|
||||
const calendarCompany = 'cityssm.github.io'
|
||||
const calendarProduct = configFunctions.getProperty(
|
||||
|
|
@ -22,8 +19,8 @@ const calendarProduct = configFunctions.getProperty(
|
|||
const timeStringSplitRegex = /[ :-]/
|
||||
|
||||
function escapeHTML(stringToEscape: string): string {
|
||||
return stringToEscape.replace(
|
||||
/[^\d A-Za-z]/g,
|
||||
return stringToEscape.replaceAll(
|
||||
/[^\d a-z]/gi,
|
||||
(c) => `&#${c.codePointAt(0)!};`
|
||||
)
|
||||
}
|
||||
|
|
@ -41,12 +38,12 @@ function getUrlRoot(request: Request): string {
|
|||
|
||||
function getWorkOrderUrl(
|
||||
request: Request,
|
||||
milestone: recordTypes.WorkOrderMilestone
|
||||
milestone: WorkOrderMilestone
|
||||
): string {
|
||||
return `${getUrlRoot(request)}/workOrders/${milestone.workOrderId!}`
|
||||
}
|
||||
|
||||
function buildEventSummary(milestone: recordTypes.WorkOrderMilestone): string {
|
||||
function buildEventSummary(milestone: WorkOrderMilestone): string {
|
||||
let summary =
|
||||
(milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') +
|
||||
((milestone.workOrderMilestoneTypeId ?? -1) === -1
|
||||
|
|
@ -83,7 +80,7 @@ function buildEventSummary(milestone: recordTypes.WorkOrderMilestone): string {
|
|||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function buildEventDescriptionHTML_occupancies(
|
||||
request: Request,
|
||||
milestone: recordTypes.WorkOrderMilestone
|
||||
milestone: WorkOrderMilestone
|
||||
): string {
|
||||
let descriptionHTML = ''
|
||||
|
||||
|
|
@ -149,7 +146,7 @@ function buildEventDescriptionHTML_occupancies(
|
|||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function buildEventDescriptionHTML_lots(
|
||||
request: Request,
|
||||
milestone: recordTypes.WorkOrderMilestone
|
||||
milestone: WorkOrderMilestone
|
||||
): string {
|
||||
let descriptionHTML = ''
|
||||
|
||||
|
|
@ -196,7 +193,7 @@ function buildEventDescriptionHTML_lots(
|
|||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function buildEventDescriptionHTML_prints(
|
||||
request: Request,
|
||||
milestone: recordTypes.WorkOrderMilestone
|
||||
milestone: WorkOrderMilestone
|
||||
): string {
|
||||
let descriptionHTML = ''
|
||||
|
||||
|
|
@ -230,7 +227,7 @@ function buildEventDescriptionHTML_prints(
|
|||
|
||||
function buildEventDescriptionHTML(
|
||||
request: Request,
|
||||
milestone: recordTypes.WorkOrderMilestone
|
||||
milestone: WorkOrderMilestone
|
||||
): string {
|
||||
const workOrderUrl = getWorkOrderUrl(request, milestone)
|
||||
|
||||
|
|
@ -247,9 +244,7 @@ function buildEventDescriptionHTML(
|
|||
return descriptionHTML
|
||||
}
|
||||
|
||||
function buildEventCategoryList(
|
||||
milestone: recordTypes.WorkOrderMilestone
|
||||
): string[] {
|
||||
function buildEventCategoryList(milestone: WorkOrderMilestone): string[] {
|
||||
const categories: string[] = []
|
||||
|
||||
if (milestone.workOrderMilestoneTypeId) {
|
||||
|
|
@ -266,7 +261,7 @@ function buildEventCategoryList(
|
|||
return categories
|
||||
}
|
||||
|
||||
function buildEventLocation(milestone: recordTypes.WorkOrderMilestone): string {
|
||||
function buildEventLocation(milestone: WorkOrderMilestone): string {
|
||||
const lotNames: string[] = []
|
||||
|
||||
if (milestone.workOrderLots!.length > 0) {
|
||||
|
|
@ -316,7 +311,9 @@ export async function handler(
|
|||
|
||||
if (request.query.workOrderId && workOrderMilestones.length > 0) {
|
||||
calendar.name(`Work Order #${workOrderMilestones[0].workOrderNumber!}`)
|
||||
calendar.url(urlRoot + '/workOrders/' + workOrderMilestones[0].workOrderId!.toString())
|
||||
calendar.url(
|
||||
urlRoot + '/workOrders/' + workOrderMilestones[0].workOrderId!.toString()
|
||||
)
|
||||
}
|
||||
|
||||
calendar.prodId({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotOccupancyComment } from '../../helpers/lotOccupancyDB/addLotOccupancyComment.js';
|
||||
import { getLotOccupancyComments } from '../../helpers/lotOccupancyDB/getLotOccupancyComments.js';
|
||||
export async function handler(request, response) {
|
||||
await addLotOccupancyComment(request.body, request.session);
|
||||
await addLotOccupancyComment(request.body, request.session.user);
|
||||
const lotOccupancyComments = await getLotOccupancyComments(request.body.lotOccupancyId);
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addLotOccupancyComment } from '../../helpers/lotOccupancyDB/addLotOccupancyComment.js'
|
||||
|
||||
import { getLotOccupancyComments } from '../../helpers/lotOccupancyDB/getLotOccupancyComments.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
await addLotOccupancyComment(request.body, request.session)
|
||||
await addLotOccupancyComment(request.body, request.session.user as User)
|
||||
|
||||
const lotOccupancyComments = await getLotOccupancyComments(
|
||||
request.body.lotOccupancyId
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotOccupancyFee } from '../../helpers/lotOccupancyDB/addLotOccupancyFee.js';
|
||||
import { getLotOccupancyFees } from '../../helpers/lotOccupancyDB/getLotOccupancyFees.js';
|
||||
export async function handler(request, response) {
|
||||
await addLotOccupancyFee(request.body, request.session);
|
||||
await addLotOccupancyFee(request.body, request.session.user);
|
||||
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId);
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addLotOccupancyFee } from '../../helpers/lotOccupancyDB/addLotOccupancyFee.js'
|
||||
|
||||
import { getLotOccupancyFees } from '../../helpers/lotOccupancyDB/getLotOccupancyFees.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
await addLotOccupancyFee(request.body, request.session)
|
||||
await addLotOccupancyFee(request.body, request.session.user as User)
|
||||
|
||||
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotOccupancyOccupant } from '../../helpers/lotOccupancyDB/addLotOccupancyOccupant.js';
|
||||
import { getLotOccupancyOccupants } from '../../helpers/lotOccupancyDB/getLotOccupancyOccupants.js';
|
||||
export async function handler(request, response) {
|
||||
await addLotOccupancyOccupant(request.body, request.session);
|
||||
await addLotOccupancyOccupant(request.body, request.session.user);
|
||||
const lotOccupancyOccupants = await getLotOccupancyOccupants(request.body.lotOccupancyId);
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addLotOccupancyOccupant } from '../../helpers/lotOccupancyDB/addLotOccupancyOccupant.js'
|
||||
|
||||
import { getLotOccupancyOccupants } from '../../helpers/lotOccupancyDB/getLotOccupancyOccupants.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
await addLotOccupancyOccupant(request.body, request.session)
|
||||
await addLotOccupancyOccupant(request.body, request.session.user as User)
|
||||
|
||||
const lotOccupancyOccupants = await getLotOccupancyOccupants(
|
||||
request.body.lotOccupancyId
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotOccupancyTransaction } from '../../helpers/lotOccupancyDB/addLotOccupancyTransaction.js';
|
||||
import { getLotOccupancyTransactions } from '../../helpers/lotOccupancyDB/getLotOccupancyTransactions.js';
|
||||
export async function handler(request, response) {
|
||||
await addLotOccupancyTransaction(request.body, request.session);
|
||||
await addLotOccupancyTransaction(request.body, request.session.user);
|
||||
const lotOccupancyTransactions = await getLotOccupancyTransactions(request.body.lotOccupancyId, { includeIntegrations: true });
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { addLotOccupancyTransaction } from '../../helpers/lotOccupancyDB/addLotOccupancyTransaction.js'
|
||||
|
||||
import { getLotOccupancyTransactions } from '../../helpers/lotOccupancyDB/getLotOccupancyTransactions.js'
|
||||
|
||||
export async function handler(
|
||||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
await addLotOccupancyTransaction(request.body, request.session)
|
||||
await addLotOccupancyTransaction(request.body, request.session.user as User)
|
||||
|
||||
const lotOccupancyTransactions = await getLotOccupancyTransactions(
|
||||
request.body.lotOccupancyId,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { copyLotOccupancy } from '../../helpers/lotOccupancyDB/copyLotOccupancy.js';
|
||||
export async function handler(request, response) {
|
||||
const lotOccupancyId = await copyLotOccupancy(request.body.lotOccupancyId, request.session);
|
||||
const lotOccupancyId = await copyLotOccupancy(request.body.lotOccupancyId, request.session.user);
|
||||
response.json({
|
||||
success: true,
|
||||
lotOccupancyId
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export async function handler(
|
|||
): Promise<void> {
|
||||
const lotOccupancyId = await copyLotOccupancy(
|
||||
request.body.lotOccupancyId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { addLotOccupancy } from '../../helpers/lotOccupancyDB/addLotOccupancy.js';
|
||||
export async function handler(request, response) {
|
||||
const lotOccupancyId = await addLotOccupancy(request.body, request.session);
|
||||
const lotOccupancyId = await addLotOccupancy(request.body, request.session.user);
|
||||
response.json({
|
||||
success: true,
|
||||
lotOccupancyId
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export async function handler(
|
|||
request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const lotOccupancyId = await addLotOccupancy(request.body, request.session)
|
||||
const lotOccupancyId = await addLotOccupancy(request.body, request.session.user as User)
|
||||
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('LotOccupancies', request.body.lotOccupancyId, request.session);
|
||||
const success = await deleteRecord('LotOccupancies', request.body.lotOccupancyId, request.session.user);
|
||||
response.json({
|
||||
success
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'LotOccupancies',
|
||||
request.body.lotOccupancyId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js';
|
||||
import { getLotOccupancyComments } from '../../helpers/lotOccupancyDB/getLotOccupancyComments.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteRecord('LotOccupancyComments', request.body.lotOccupancyCommentId, request.session);
|
||||
const success = await deleteRecord('LotOccupancyComments', request.body.lotOccupancyCommentId, request.session.user);
|
||||
const lotOccupancyComments = await getLotOccupancyComments(request.body.lotOccupancyId);
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteRecord } from '../../helpers/lotOccupancyDB/deleteRecord.js'
|
||||
|
||||
import { getLotOccupancyComments } from '../../helpers/lotOccupancyDB/getLotOccupancyComments.js'
|
||||
|
||||
export async function handler(
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteRecord(
|
||||
'LotOccupancyComments',
|
||||
request.body.lotOccupancyCommentId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotOccupancyComments = await getLotOccupancyComments(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteLotOccupancyFee } from '../../helpers/lotOccupancyDB/deleteLotOccupancyFee.js';
|
||||
import { getLotOccupancyFees } from '../../helpers/lotOccupancyDB/getLotOccupancyFees.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteLotOccupancyFee(request.body.lotOccupancyId, request.body.feeId, request.session);
|
||||
const success = await deleteLotOccupancyFee(request.body.lotOccupancyId, request.body.feeId, request.session.user);
|
||||
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId);
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteLotOccupancyFee } from '../../helpers/lotOccupancyDB/deleteLotOccupancyFee.js'
|
||||
|
||||
import { getLotOccupancyFees } from '../../helpers/lotOccupancyDB/getLotOccupancyFees.js'
|
||||
|
||||
export async function handler(
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteLotOccupancyFee(
|
||||
request.body.lotOccupancyId,
|
||||
request.body.feeId,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteLotOccupancyOccupant } from '../../helpers/lotOccupancyDB/deleteLotOccupancyOccupant.js';
|
||||
import { getLotOccupancyOccupants } from '../../helpers/lotOccupancyDB/getLotOccupancyOccupants.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteLotOccupancyOccupant(request.body.lotOccupancyId, request.body.lotOccupantIndex, request.session);
|
||||
const success = await deleteLotOccupancyOccupant(request.body.lotOccupancyId, request.body.lotOccupantIndex, request.session.user);
|
||||
const lotOccupancyOccupants = await getLotOccupancyOccupants(request.body.lotOccupancyId);
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { deleteLotOccupancyOccupant } from '../../helpers/lotOccupancyDB/deleteLotOccupancyOccupant.js'
|
||||
|
||||
import { getLotOccupancyOccupants } from '../../helpers/lotOccupancyDB/getLotOccupancyOccupants.js'
|
||||
|
||||
export async function handler(
|
||||
|
|
@ -11,7 +10,7 @@ export async function handler(
|
|||
const success = await deleteLotOccupancyOccupant(
|
||||
request.body.lotOccupancyId,
|
||||
request.body.lotOccupantIndex,
|
||||
request.session
|
||||
request.session.user as User
|
||||
)
|
||||
|
||||
const lotOccupancyOccupants = await getLotOccupancyOccupants(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { deleteLotOccupancyTransaction } from '../../helpers/lotOccupancyDB/deleteLotOccupancyTransaction.js';
|
||||
import { getLotOccupancyTransactions } from '../../helpers/lotOccupancyDB/getLotOccupancyTransactions.js';
|
||||
export async function handler(request, response) {
|
||||
const success = await deleteLotOccupancyTransaction(request.body.lotOccupancyId, request.body.transactionIndex, request.session);
|
||||
const success = await deleteLotOccupancyTransaction(request.body.lotOccupancyId, request.body.transactionIndex, request.session.user);
|
||||
const lotOccupancyTransactions = await getLotOccupancyTransactions(request.body.lotOccupancyId, { includeIntegrations: true });
|
||||
response.json({
|
||||
success,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue