type linting
parent
5a9074eb20
commit
66f4e7d3bf
|
|
@ -49,14 +49,12 @@ function buildWhereClause(filters) {
|
||||||
if ((filters.workOrderTypeIds ?? '') !== '' &&
|
if ((filters.workOrderTypeIds ?? '') !== '' &&
|
||||||
commaSeparatedNumbersRegex.test(filters.workOrderTypeIds)) {
|
commaSeparatedNumbersRegex.test(filters.workOrderTypeIds)) {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and w.workOrderTypeId in (' + filters.workOrderTypeIds + ')';
|
` and w.workOrderTypeId in (${filters.workOrderTypeIds})`;
|
||||||
}
|
}
|
||||||
if ((filters.workOrderMilestoneTypeIds ?? '') !== '' &&
|
if (filters.workOrderMilestoneTypeIds !== undefined &&
|
||||||
|
filters.workOrderMilestoneTypeIds !== '' &&
|
||||||
commaSeparatedNumbersRegex.test(filters.workOrderMilestoneTypeIds)) {
|
commaSeparatedNumbersRegex.test(filters.workOrderMilestoneTypeIds)) {
|
||||||
sqlWhereClause +=
|
sqlWhereClause += ` and m.workOrderMilestoneTypeId in (${filters.workOrderMilestoneTypeIds})`;
|
||||||
' and m.workOrderMilestoneTypeId in (' +
|
|
||||||
filters.workOrderMilestoneTypeIds +
|
|
||||||
')';
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
sqlWhereClause,
|
sqlWhereClause,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
type DateString,
|
||||||
dateIntegerToString,
|
dateIntegerToString,
|
||||||
dateStringToInteger,
|
dateStringToInteger,
|
||||||
dateToInteger,
|
dateToInteger,
|
||||||
|
|
@ -100,7 +101,7 @@ function buildWhereClause(filters: WorkOrderMilestoneFilters): {
|
||||||
if ((filters.workOrderMilestoneDateString ?? '') !== '') {
|
if ((filters.workOrderMilestoneDateString ?? '') !== '') {
|
||||||
sqlWhereClause += ' and m.workOrderMilestoneDate = ?'
|
sqlWhereClause += ' and m.workOrderMilestoneDate = ?'
|
||||||
sqlParameters.push(
|
sqlParameters.push(
|
||||||
dateStringToInteger(filters.workOrderMilestoneDateString!)
|
dateStringToInteger(filters.workOrderMilestoneDateString as DateString)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,17 +110,15 @@ function buildWhereClause(filters: WorkOrderMilestoneFilters): {
|
||||||
commaSeparatedNumbersRegex.test(filters.workOrderTypeIds!)
|
commaSeparatedNumbersRegex.test(filters.workOrderTypeIds!)
|
||||||
) {
|
) {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and w.workOrderTypeId in (' + filters.workOrderTypeIds! + ')'
|
` and w.workOrderTypeId in (${filters.workOrderTypeIds})`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(filters.workOrderMilestoneTypeIds ?? '') !== '' &&
|
filters.workOrderMilestoneTypeIds !== undefined &&
|
||||||
|
filters.workOrderMilestoneTypeIds !== '' &&
|
||||||
commaSeparatedNumbersRegex.test(filters.workOrderMilestoneTypeIds!)
|
commaSeparatedNumbersRegex.test(filters.workOrderMilestoneTypeIds!)
|
||||||
) {
|
) {
|
||||||
sqlWhereClause +=
|
sqlWhereClause += ` and m.workOrderMilestoneTypeId in (${filters.workOrderMilestoneTypeIds})`
|
||||||
' and m.workOrderMilestoneTypeId in (' +
|
|
||||||
filters.workOrderMilestoneTypeIds! +
|
|
||||||
')'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ let apiKeys: Record<string, string>
|
||||||
async function loadApiKeys(): Promise<void> {
|
async function loadApiKeys(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const fileData = await fs.readFile(apiKeyPath, 'utf8')
|
const fileData = await fs.readFile(apiKeyPath, 'utf8')
|
||||||
apiKeys = JSON.parse(fileData)
|
apiKeys = JSON.parse(fileData) as Record<string, string>
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debug(error)
|
debug(error)
|
||||||
apiKeys = {}
|
apiKeys = {}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ async function authenticateViaActiveDirectory(userName, password) {
|
||||||
return await new Promise((resolve) => {
|
return await new Promise((resolve) => {
|
||||||
try {
|
try {
|
||||||
const ad = new ActiveDirectory(activeDirectoryConfig);
|
const ad = new ActiveDirectory(activeDirectoryConfig);
|
||||||
ad.authenticate(userDomain + '\\' + userName, password, (error, auth) => {
|
ad.authenticate(`${userDomain}\\${userName}`, password, (error, auth) => {
|
||||||
let authenticated = false;
|
let authenticated = false;
|
||||||
if ((error ?? '') === '') {
|
if ((error ?? '') === '') {
|
||||||
authenticated = auth;
|
authenticated = auth;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ import * as configFunctions from './functions.config.js'
|
||||||
|
|
||||||
const userDomain = configFunctions.getConfigProperty('application.userDomain')
|
const userDomain = configFunctions.getConfigProperty('application.userDomain')
|
||||||
|
|
||||||
const activeDirectoryConfig = configFunctions.getConfigProperty('activeDirectory')
|
const activeDirectoryConfig =
|
||||||
|
configFunctions.getConfigProperty('activeDirectory')
|
||||||
|
|
||||||
async function authenticateViaActiveDirectory(
|
async function authenticateViaActiveDirectory(
|
||||||
userName: string,
|
userName: string,
|
||||||
|
|
@ -14,7 +15,7 @@ async function authenticateViaActiveDirectory(
|
||||||
try {
|
try {
|
||||||
const ad = new ActiveDirectory(activeDirectoryConfig)
|
const ad = new ActiveDirectory(activeDirectoryConfig)
|
||||||
|
|
||||||
ad.authenticate(userDomain + '\\' + userName, password, (error, auth) => {
|
ad.authenticate(`${userDomain}\\${userName}`, password, (error, auth) => {
|
||||||
let authenticated = false
|
let authenticated = false
|
||||||
|
|
||||||
if ((error ?? '') === '') {
|
if ((error ?? '') === '') {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ describe('config.cemetery.ssm', () => {
|
||||||
|
|
||||||
describe('functions.cache', () => {
|
describe('functions.cache', () => {
|
||||||
const badId = -3
|
const badId = -3
|
||||||
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
const badName = 'qwertyuiopasdfghjklzxcvbnm'
|
const badName = 'qwertyuiopasdfghjklzxcvbnm'
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
|
|
@ -477,7 +478,7 @@ describe('functions.user', () => {
|
||||||
it('authenticates with a valid API key', async () => {
|
it('authenticates with a valid API key', async () => {
|
||||||
const apiKeysJSON: Record<string, string> = JSON.parse(
|
const apiKeysJSON: Record<string, string> = JSON.parse(
|
||||||
fs.readFileSync('data/apiKeys.json', 'utf8')
|
fs.readFileSync('data/apiKeys.json', 'utf8')
|
||||||
)
|
) as Record<string, string>
|
||||||
|
|
||||||
const apiKey = Object.values(apiKeysJSON)[0]
|
const apiKey = Object.values(apiKeysJSON)[0]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue