apps/recallassess/recallassess-api/src/api/client/contact-support/contact-support.controller.ts
api/client/contact-support
Methods |
|
| Async submitEnquiry | ||||||
submitEnquiry(dto: CreateContactEnquiryDto)
|
||||||
Decorators :
@Public()
|
||||||
|
Public form-submission endpoint. Called by the website's Contact Support modal. No auth — intentionally open so visitors can reach us. Rate-limit at the gateway.
Parameters :
Returns :
Promise<literal type>
|
| Async submitInboundEmail | ||||||
submitInboundEmail(dto: InboundEmailWebhookDto)
|
||||||
Decorators :
@Public()
|
||||||
|
Inbound-email webhook. Called by the AWS SES Lambda after it parses an email sent directly to enquiry@recallsolutions.ai (i.e. not via the website form). Authenticated via ContactInboundApiKeyGuard which checks the X-API-Key header against CONTACT_INBOUND_EMAIL_API_KEY. The @Public() decorator bypasses the default JWT guard; the API-key guard is the actual protection.
Parameters :
Returns :
Promise<literal type>
|
import { Public } from "@bish-nest/core/auth/decorator/public.decorator";
import { Body, Controller, HttpCode, HttpStatus, Post, UseGuards } from "@nestjs/common";
import { ApiOperation, ApiResponse, ApiSecurity, ApiTags } from "@nestjs/swagger";
import { CreateContactEnquiryDto } from "./dto/create-contact-enquiry.dto";
import { InboundEmailWebhookDto } from "./dto/inbound-email-webhook.dto";
import { ContactInboundApiKeyGuard } from "./guards/contact-inbound-api-key.guard";
import { CLContactSupportService } from "./contact-support.service";
@ApiTags("Client - Contact Support")
@Controller("api/client/contact-support")
export class CLContactSupportController {
constructor(private readonly contactSupportService: CLContactSupportService) {}
/**
* Public form-submission endpoint. Called by the website's Contact Support modal.
* No auth — intentionally open so visitors can reach us. Rate-limit at the gateway.
*/
@Public()
@Post("enquiry")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Submit public contact support enquiry" })
@ApiResponse({ status: 200, description: "Enquiry submitted and confirmation email sent." })
async submitEnquiry(@Body() dto: CreateContactEnquiryDto): Promise<{ success: boolean; message: string }> {
return this.contactSupportService.submitEnquiry(dto);
}
/**
* Inbound-email webhook. Called by the AWS SES Lambda after it parses an email
* sent directly to enquiry@recallsolutions.ai (i.e. not via the website form).
*
* Authenticated via ContactInboundApiKeyGuard which checks the X-API-Key header
* against CONTACT_INBOUND_EMAIL_API_KEY. The @Public() decorator bypasses the
* default JWT guard; the API-key guard is the actual protection.
*/
@Public()
@UseGuards(ContactInboundApiKeyGuard)
@ApiSecurity("ApiKey")
@Post("inbound-email")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Webhook: ingest a parsed inbound email and treat it as an enquiry" })
@ApiResponse({ status: 200, description: "Inbound email ingested; visitor acknowledgement sent if applicable." })
async submitInboundEmail(
@Body() dto: InboundEmailWebhookDto,
): Promise<{ success: boolean; message: string; enquiryId?: number; skipped?: boolean }> {
return this.contactSupportService.submitFromInboundEmail(dto);
}
}