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