import prisma from "../prisma/client.js";

export const getEmailsByType = async (type) => {
	try {
		const emails = await prisma.emailConfig.findMany({
			where: {
				type,
				isActive: true,
			},
		});

		return emails.map((e) => e.email).join(",");
	} catch (error) {
		console.error("Fetch email config error:", error);
		return "";
	}
};
