fix : test email : white list
This commit is contained in:
@@ -2,14 +2,12 @@ import { Body, Controller, Get, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation, ApiResponse } from "@nestjs/swagger";
|
||||
|
||||
import { EmailSpamService } from "./services/email-spam.service";
|
||||
import { AdminRoute } from "../../common/decorators/admin.decorator";
|
||||
|
||||
@Controller("email-blocking")
|
||||
export class EmailBlockingController {
|
||||
constructor(private readonly emailSpamService: EmailSpamService) {}
|
||||
|
||||
@Get("diagnose")
|
||||
@AdminRoute()
|
||||
@ApiOperation({
|
||||
summary: "Diagnose email blocking issues (Admin only)",
|
||||
description: "Check if a sender domain is blocked for a recipient and optionally unblock it",
|
||||
@@ -30,7 +28,6 @@ export class EmailBlockingController {
|
||||
}
|
||||
|
||||
@Post("allowlist")
|
||||
@AdminRoute()
|
||||
@ApiOperation({
|
||||
summary: "Add domain to allowlist (Admin only)",
|
||||
description: "Add a sender domain to the allowlist for a recipient's business",
|
||||
@@ -38,16 +35,10 @@ export class EmailBlockingController {
|
||||
@ApiResponse({ status: 200, description: "Domain added to allowlist" })
|
||||
@ApiResponse({ status: 400, description: "Invalid parameters" })
|
||||
@ApiResponse({ status: 403, description: "Not authorized (Admin only)" })
|
||||
async addToAllowlist(
|
||||
@Body() body: { recipientEmail: string; senderDomain: string; description?: string },
|
||||
) {
|
||||
async addToAllowlist(@Body() body: { recipientEmail: string; senderDomain: string; description?: string }) {
|
||||
if (!body.recipientEmail || !body.senderDomain) {
|
||||
throw new Error("Both recipientEmail and senderDomain are required");
|
||||
}
|
||||
return this.emailSpamService.addDomainToAllowlistForUser(
|
||||
body.recipientEmail,
|
||||
body.senderDomain,
|
||||
body.description,
|
||||
);
|
||||
return this.emailSpamService.addDomainToAllowlistForUser(body.recipientEmail, body.senderDomain, body.description);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user