import { Request, Response } from "express"; import { BaseController } from "./BaseController"; import MetricService, { BucketSet } from "../services/metric.service"; import constants from "../utils/constants"; import { ExternalInventoryService } from "../funnels/external.funnel"; export class ExternalApiController extends BaseController { metricService: MetricService; constructor(private readonly externalInventoryService: ExternalInventoryService) { super(); this.post("/context", this.chooseRealTimeBidding); this.metricService = MetricService.getInstance(); this.metricService.addSection( constants.CHOICES_REQUEST_SECTION, constants.CHOICES_REQUEST_SECTION_LABELS, BucketSet.zeroTo100ms ); } async chooseRealTimeBidding(req: Request, res: Response) { return this.externalInventoryService.handle(req, res); } }