code cleanup

deepsource-autofix-76c6eb20
Dan Gowans 2023-12-11 13:49:55 -05:00
parent c1982f4ec9
commit 6525e2b98d
8 changed files with 309 additions and 517 deletions

View File

@ -1,7 +1,7 @@
import ical, { ICalEventStatus } from 'ical-generator';
import { getWorkOrderMilestones } from '../../database/getWorkOrderMilestones.js';
import * as configFunctions from '../../helpers/functions.config.js';
import { getPrintConfig } from '../../helpers/functions.print.js';
import { getWorkOrderMilestones } from '../../database/getWorkOrderMilestones.js';
const calendarCompany = 'cityssm.github.io';
const calendarProduct = configFunctions.getProperty('application.applicationName');
const timeStringSplitRegex = /[ :-]/;

View File

@ -3,12 +3,12 @@
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 '../../database/getWorkOrderMilestones.js'
import * as configFunctions from '../../helpers/functions.config.js'
import { getPrintConfig } from '../../helpers/functions.print.js'
import type { WorkOrderMilestone } from '../../types/recordTypes.js'
const calendarCompany = 'cityssm.github.io'

View File

@ -50,4 +50,5 @@ export async function getUserNameFromApiKey(apiKey) {
return userName;
}
}
return undefined;
}

View File

@ -63,4 +63,6 @@ export async function getUserNameFromApiKey(
return userName
}
}
return undefined
}

View File

@ -1,9 +1,8 @@
import * as gp from '@cityssm/dynamics-gp/gp.js';
import * as diamond from '@cityssm/dynamics-gp/diamond.js';
import { DynamicsGP } from '@cityssm/dynamics-gp';
import * as configFunctions from './functions.config.js';
let gp;
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
gp.setMSSQLConfig(configFunctions.getProperty('settings.dynamicsGP.mssqlConfig'));
diamond.setMSSQLConfig(configFunctions.getProperty('settings.dynamicsGP.mssqlConfig'));
gp = new DynamicsGP(configFunctions.getProperty('settings.dynamicsGP.mssqlConfig'));
}
function filterCashReceipt(cashReceipt) {
const accountCodes = configFunctions.getProperty('settings.dynamicsGP.accountCodes');
@ -70,7 +69,7 @@ async function _getDynamicsGPDocument(documentNumber, lookupType) {
break;
}
case 'diamond/cashReceipt': {
let receipt = await diamond.getCashReceiptByDocumentNumber(documentNumber);
let receipt = await gp.getDiamondCashReceiptByDocumentNumber(documentNumber);
if (receipt !== undefined) {
receipt = filterCashReceipt(receipt);
}
@ -92,7 +91,7 @@ async function _getDynamicsGPDocument(documentNumber, lookupType) {
break;
}
case 'diamond/extendedInvoice': {
let invoice = await diamond.getDiamondExtendedGPInvoice(documentNumber);
let invoice = await gp.getDiamondExtendedInvoiceByInvoiceNumber(documentNumber);
if (invoice !== undefined) {
invoice = filterExtendedInvoice(invoice);
}
@ -117,7 +116,7 @@ async function _getDynamicsGPDocument(documentNumber, lookupType) {
}
export async function getDynamicsGPDocument(documentNumber) {
if (!configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
return;
return undefined;
}
let document;
for (const lookupType of configFunctions.getProperty('settings.dynamicsGP.lookupOrder')) {

View File

@ -1,25 +1,21 @@
/* eslint-disable unicorn/filename-case */
/* eslint-disable unicorn/filename-case, eslint-comments/disable-enable-pair */
import * as gp from '@cityssm/dynamics-gp/gp.js'
import * as diamond from '@cityssm/dynamics-gp/diamond.js'
import {
DynamicsGP,
type DiamondCashReceipt,
type DiamondExtendedGPInvoice,
type GPInvoice
} from '@cityssm/dynamics-gp'
import type { DynamicsGPLookup } from '../types/configTypes.js'
import type { DynamicsGPDocument } from '../types/recordTypes.js'
import * as configFunctions from './functions.config.js'
import type { DynamicsGPLookup } from '../types/configTypes'
import type { DynamicsGPDocument } from '../types/recordTypes.js'
import type {
DiamondExtendedGPInvoice,
DiamondCashReceipt
} from '@cityssm/dynamics-gp/diamond/types'
import type { GPInvoice } from '@cityssm/dynamics-gp/gp/types'
let gp: DynamicsGP
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
gp.setMSSQLConfig(
configFunctions.getProperty('settings.dynamicsGP.mssqlConfig')
)
diamond.setMSSQLConfig(
gp = new DynamicsGP(
configFunctions.getProperty('settings.dynamicsGP.mssqlConfig')
)
}
@ -122,7 +118,7 @@ async function _getDynamicsGPDocument(
}
case 'diamond/cashReceipt': {
let receipt: DiamondCashReceipt | undefined =
await diamond.getCashReceiptByDocumentNumber(documentNumber)
await gp.getDiamondCashReceiptByDocumentNumber(documentNumber)
if (receipt !== undefined) {
receipt = filterCashReceipt(receipt)
@ -147,7 +143,9 @@ async function _getDynamicsGPDocument(
break
}
case 'diamond/extendedInvoice': {
let invoice = await diamond.getDiamondExtendedGPInvoice(documentNumber)
let invoice = await gp.getDiamondExtendedInvoiceByInvoiceNumber(
documentNumber
)
if (invoice !== undefined) {
invoice = filterExtendedInvoice(invoice)
@ -181,7 +179,7 @@ export async function getDynamicsGPDocument(
if (
!configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')
) {
return
return undefined
}
let document: DynamicsGPDocument | undefined

756
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@
"@cityssm/bulma-js": "^0.4.0",
"@cityssm/bulma-webapp-js": "^1.5.0",
"@cityssm/date-diff": "^2.2.3",
"@cityssm/dynamics-gp": "^0.5.1",
"@cityssm/dynamics-gp": "^1.0.3",
"@cityssm/expressjs-server-js": "^2.3.3",
"@cityssm/ntfy-publish": "^1.0.0",
"@cityssm/pdf-puppeteer": "^2.0.0",
@ -44,7 +44,7 @@
"@fortawesome/fontawesome-free": "^5.15.4",
"activedirectory2": "^2.2.0",
"better-sqlite-pool": "^0.3.2",
"better-sqlite3": "^9.1.1",
"better-sqlite3": "^9.2.2",
"bulma-calendar": "^6.1.19",
"camelcase": "^8.0.0",
"compression": "^1.7.4",
@ -53,7 +53,7 @@
"csurf": "^1.11.0",
"debug": "^4.3.4",
"ejs": "^3.1.9",
"eslint-config-cityssm": "^1.1.1",
"eslint-config-cityssm": "^1.2.1",
"exit-hook": "^4.0.0",
"express": "^4.18.2",
"express-rate-limit": "^7.1.5",
@ -105,14 +105,14 @@
"bulma-steps": "^2.2.1",
"bulma-switch": "^2.0.4",
"bulma-tooltip": "^3.0.2",
"cypress": "^13.6.0",
"cypress": "^13.6.1",
"cypress-axe": "^1.5.0",
"gulp": "^4.0.2",
"gulp-changed": "^5.0.1",
"gulp-changed": "^5.0.2",
"gulp-include": "^2.4.1",
"gulp-minify": "^3.1.0",
"gulp-sass": "^5.1.0",
"nodemon": "^3.0.1",
"nodemon": "^3.0.2",
"sass": "^1.69.5"
}
}