import { Body, Controller, HttpCode, Post } from "@nestjs/common"; import { ApiExcludeController } from "@nestjs/swagger"; import { Public } from "@edr/api-common"; import { EimsBulkCallbackItem } from "./eims-registration.types"; import { EimsBulkRegistrationService } from "./eims-bulk-registration.service"; /** * MoR's own callback for `POST /v1/bulkRegister`, not a route a person calls. Public — MoR has no * JWT to send — so the conversation id embedded in the payload is the only thing standing between * this and a forged callback: `EimsBulkRegistrationService.handleBulkCallback` only ever touches * invoices actually holding that exact id, and an unrecognised one is logged and ignored. See the * "Callback Mechanism" section of the collection's own docs for the payload shape. */ @ApiExcludeController() @Controller("eims/webhook") export class EimsWebhookController { constructor(private readonly bulk: EimsBulkRegistrationService) {} @Public() @Post("bulk-register") @HttpCode(200) bulkRegisterCallback(@Body() items: EimsBulkCallbackItem[]) { return this.bulk.handleBulkCallback(items); } }