linting
parent
84f3574240
commit
2323250627
|
|
@ -43,8 +43,8 @@ const safeRedirects = new Set([
|
|||
'/workorders/outlook',
|
||||
'/reports'
|
||||
]);
|
||||
const recordUrl = /^(\/(maps|lots|lotoccupancies|workorders)\/)\d+(\/edit)?$/;
|
||||
const printUrl = /^\/print\/(pdf|screen)\/[\d/=?A-Za-z-]+$/;
|
||||
const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/;
|
||||
const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/;
|
||||
export function getSafeRedirectURL(possibleRedirectURL = '') {
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix');
|
||||
if (typeof possibleRedirectURL === 'string') {
|
||||
|
|
@ -58,5 +58,5 @@ export function getSafeRedirectURL(possibleRedirectURL = '') {
|
|||
return urlPrefix + urlToCheck;
|
||||
}
|
||||
}
|
||||
return urlPrefix + '/dashboard/';
|
||||
return `${urlPrefix}/dashboard/`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,11 +59,9 @@ const safeRedirects = new Set([
|
|||
'/reports'
|
||||
])
|
||||
|
||||
// eslint-disable-next-line regexp/no-unused-capturing-group
|
||||
const recordUrl = /^(\/(maps|lots|lotoccupancies|workorders)\/)\d+(\/edit)?$/
|
||||
const recordUrl = /^\/(?:maps|lots|lotoccupancies|workorders)\/\d+(?:\/edit)?$/
|
||||
|
||||
// eslint-disable-next-line regexp/no-unused-capturing-group
|
||||
const printUrl = /^\/print\/(pdf|screen)\/[\d/=?A-Za-z-]+$/
|
||||
const printUrl = /^\/print\/(?:pdf|screen)\/[\d/=?A-Za-z-]+$/
|
||||
|
||||
export function getSafeRedirectURL(possibleRedirectURL = ''): string {
|
||||
const urlPrefix = configFunctions.getProperty('reverseProxy.urlPrefix')
|
||||
|
|
@ -84,5 +82,5 @@ export function getSafeRedirectURL(possibleRedirectURL = ''): string {
|
|||
}
|
||||
}
|
||||
|
||||
return urlPrefix + '/dashboard/'
|
||||
return `${urlPrefix}/dashboard/`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,14 +109,14 @@ export async function getOccupancyTypeByOccupancyType(occupancyTypeString) {
|
|||
}
|
||||
export async function getOccupancyTypePrintsById(occupancyTypeId) {
|
||||
const occupancyType = await getOccupancyTypeById(occupancyTypeId);
|
||||
if (occupancyType === undefined ||
|
||||
(occupancyType.occupancyTypePrints ?? []).length === 0) {
|
||||
if (occupancyType?.occupancyTypePrints === undefined ||
|
||||
occupancyType.occupancyTypePrints.length === 0) {
|
||||
return [];
|
||||
}
|
||||
if (occupancyType.occupancyTypePrints.includes('*')) {
|
||||
return configFunctions.getProperty('settings.lotOccupancy.prints');
|
||||
}
|
||||
return occupancyType.occupancyTypePrints;
|
||||
return occupancyType.occupancyTypePrints ?? [];
|
||||
}
|
||||
function clearOccupancyTypesCache() {
|
||||
occupancyTypes = undefined;
|
||||
|
|
|
|||
|
|
@ -198,17 +198,17 @@ export async function getOccupancyTypePrintsById(
|
|||
const occupancyType = await getOccupancyTypeById(occupancyTypeId)
|
||||
|
||||
if (
|
||||
occupancyType === undefined ||
|
||||
(occupancyType.occupancyTypePrints ?? []).length === 0
|
||||
occupancyType?.occupancyTypePrints === undefined ||
|
||||
occupancyType.occupancyTypePrints.length === 0
|
||||
) {
|
||||
return []
|
||||
}
|
||||
|
||||
if (occupancyType.occupancyTypePrints!.includes('*')) {
|
||||
if (occupancyType.occupancyTypePrints.includes('*')) {
|
||||
return configFunctions.getProperty('settings.lotOccupancy.prints')
|
||||
}
|
||||
|
||||
return occupancyType.occupancyTypePrints!
|
||||
return occupancyType.occupancyTypePrints ?? []
|
||||
}
|
||||
|
||||
function clearOccupancyTypesCache(): void {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ configFallbackValues.set(
|
|||
)
|
||||
|
||||
configFallbackValues.set(
|
||||
// eslint-disable-next-line no-secrets/no-secrets
|
||||
'settings.lotOccupancy.occupancyEndDateIsRequired',
|
||||
true
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
import fs from 'node:fs/promises';
|
||||
import { lotOccupancyDB as databasePath, backupFolder } from '../data/databasePaths.js';
|
||||
import { backupFolder, lotOccupancyDB as databasePath } from '../data/databasePaths.js';
|
||||
export const backupDatabase = async () => {
|
||||
const databasePathSplit = databasePath.split(/[/\\]/g);
|
||||
const backupDatabasePath = backupFolder +
|
||||
'/' +
|
||||
databasePathSplit[databasePathSplit.length - 1] +
|
||||
'.' +
|
||||
Date.now().toString();
|
||||
const backupDatabasePath = `${backupFolder}/${databasePathSplit.at(-1)}.${Date.now().toString()}`;
|
||||
try {
|
||||
await fs.copyFile(databasePath, backupDatabasePath);
|
||||
return backupDatabasePath;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
import fs from 'node:fs/promises'
|
||||
|
||||
import {
|
||||
lotOccupancyDB as databasePath,
|
||||
backupFolder
|
||||
backupFolder,
|
||||
lotOccupancyDB as databasePath
|
||||
} from '../data/databasePaths.js'
|
||||
|
||||
export const backupDatabase = async (): Promise<string | false> => {
|
||||
const databasePathSplit = databasePath.split(/[/\\]/g)
|
||||
|
||||
const backupDatabasePath =
|
||||
backupFolder +
|
||||
'/' +
|
||||
databasePathSplit[databasePathSplit.length - 1] +
|
||||
'.' +
|
||||
Date.now().toString()
|
||||
const backupDatabasePath = `${backupFolder}/${databasePathSplit.at(-1)}.${Date.now().toString()}`
|
||||
|
||||
try {
|
||||
await fs.copyFile(databasePath, backupDatabasePath)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* eslint-disable unicorn/filename-case, @eslint-community/eslint-comments/disable-enable-pair */
|
||||
|
||||
import {
|
||||
DynamicsGP,
|
||||
type DiamondCashReceipt,
|
||||
type DiamondExtendedGPInvoice,
|
||||
DynamicsGP,
|
||||
type GPInvoice
|
||||
} from '@cityssm/dynamics-gp'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue