fix : test email : more detail
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Query } from "@nestjs/common";
|
||||
import { Body, Controller, Get, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation, ApiResponse } from "@nestjs/swagger";
|
||||
|
||||
import { EmailSpamService } from "./services/email-spam.service";
|
||||
@@ -28,4 +28,26 @@ export class EmailBlockingController {
|
||||
const shouldUnblock = unblock === "true" || unblock === "1";
|
||||
return this.emailSpamService.diagnoseEmailBlocking(recipientEmail, senderDomain, shouldUnblock);
|
||||
}
|
||||
|
||||
@Post("allowlist")
|
||||
@AdminRoute()
|
||||
@ApiOperation({
|
||||
summary: "Add domain to allowlist (Admin only)",
|
||||
description: "Add a sender domain to the allowlist for a recipient's business",
|
||||
})
|
||||
@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 },
|
||||
) {
|
||||
if (!body.recipientEmail || !body.senderDomain) {
|
||||
throw new Error("Both recipientEmail and senderDomain are required");
|
||||
}
|
||||
return this.emailSpamService.addDomainToAllowlistForUser(
|
||||
body.recipientEmail,
|
||||
body.senderDomain,
|
||||
body.description,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user