import { Installation } from "../models" ; import { NextFunction , Request , Response } from "express" ; param req param res param next export default async ( req , res , next ) => { if ( ! req . body ?. clientKey ) { res . status ( 401 ) ; return ; } const installation = await Installation . getForClientKey ( req . body . clientKey ) ; if ( ! installation ) { res . status ( 404 ) ; return ; } const { jiraHost , clientKey } = installation ; req . addLogFields ( { jiraHost , jiraClientKey : `${ clientKey . substr ( 0 , 5 ) }***}` } ) ; res . locals . installation = installation ; next ( ) ; } ;