|
|
@ -2,12 +2,27 @@ import { RequestHandler } from 'express'; |
|
|
|
|
|
|
|
|
|
|
|
import { DELETED } from '../../consts'; |
|
|
|
import { DELETED } from '../../consts'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { buildUnknownIDCondition } from '../../buildCondition'; |
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
import buildGetRequestHandler from '../buildGetRequestHandler'; |
|
|
|
import { buildQueryResultReducer } from '../../buildQueryResultModifier'; |
|
|
|
import { buildQueryResultReducer } from '../../buildQueryResultModifier'; |
|
|
|
import { getShortHostName } from '../../disassembleHostName'; |
|
|
|
import { getShortHostName } from '../../disassembleHostName'; |
|
|
|
|
|
|
|
|
|
|
|
export const getAlertOverride: RequestHandler = buildGetRequestHandler( |
|
|
|
export const getAlertOverride: RequestHandler< |
|
|
|
(request, options) => { |
|
|
|
AlertOverrideReqParams, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
AlertOverrideReqQuery |
|
|
|
|
|
|
|
> = buildGetRequestHandler((request, options) => { |
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
query: { 'mail-recipient': mailRecipient }, |
|
|
|
|
|
|
|
} = request; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { after: mailRecipientCond } = buildUnknownIDCondition( |
|
|
|
|
|
|
|
mailRecipient, |
|
|
|
|
|
|
|
'b.recipient_uuid', |
|
|
|
|
|
|
|
{ onFallback: () => 'TRUE' }, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const query = ` |
|
|
|
const query = ` |
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
a.alert_override_uuid, |
|
|
|
a.alert_override_uuid, |
|
|
@ -24,6 +39,7 @@ export const getAlertOverride: RequestHandler = buildGetRequestHandler( |
|
|
|
ON a.alert_override_host_uuid = c.host_uuid |
|
|
|
ON a.alert_override_host_uuid = c.host_uuid |
|
|
|
WHERE a.alert_override_alert_level != -1 |
|
|
|
WHERE a.alert_override_alert_level != -1 |
|
|
|
AND b.recipient_name != '${DELETED}' |
|
|
|
AND b.recipient_name != '${DELETED}' |
|
|
|
|
|
|
|
AND ${mailRecipientCond} |
|
|
|
ORDER BY b.recipient_name ASC;`;
|
|
|
|
ORDER BY b.recipient_name ASC;`;
|
|
|
|
|
|
|
|
|
|
|
|
const afterQueryReturn: QueryResultModifierFunction = |
|
|
|
const afterQueryReturn: QueryResultModifierFunction = |
|
|
@ -65,5 +81,4 @@ export const getAlertOverride: RequestHandler = buildGetRequestHandler( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return query; |
|
|
|
return query; |
|
|
|
}, |
|
|
|
}); |
|
|
|
); |
|
|
|
|
|
|
|