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