email settings

This commit is contained in:
Alex Holliday committed 2025-11-19 23:55:29 +00:00
1 parent 819c0ca05a
commit 3faff5dc54
16 files changed
+665 -33

No files matched your search

+23 -2
View File
@@ -1,16 +1,22 @@
import { Request, Response, NextFunction } from "express";
import ApiError from "@/utils/ApiError.js";
import SettingsService from "@/services/system/SettingsService.js";
import { NotificationService, SettingsService } from "@/services/index.js";
export interface ISettingsController {
get: (req: Request, res: Response, next: NextFunction) => void;
update: (req: Request, res: Response, next: NextFunction) => void;
testTransport: (req: Request, res: Response, next: NextFunction) => void;
}
class SettingsController implements ISettingsController {
private settingsService: SettingsService;
constructor(settingsService: SettingsService) {
private notificationService: NotificationService;
constructor(
settingsService: SettingsService,
notificationService: NotificationService
) {
this.settingsService = settingsService;
this.notificationService = notificationService;
}
get = async (req: Request, res: Response, next: NextFunction) => {
@@ -36,6 +42,21 @@ class SettingsController implements ISettingsController {
next(error);
}
};
testTransport = async (req: Request, res: Response, next: NextFunction) => {
try {
const testResult = await this.notificationService.testEmailTransport(
req.body
);
res.status(200).json({
message: "Test transport successful",
data: testResult,
});
} catch (error) {
next(error);
}
};
}
export default SettingsController;