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