import { db } from "@/helpers/api/db"; 

export default async function handler(req, res) {
     if (req.method !== "GET") {
          return res.status(405).json({ error: "Method not allowed" });
     }

	if (!db.initialized) await db.initialize();

	try {
		const fetchSettings = await db.Settings.findAll({raw:true});

		return res.status(200).json({
			settings: fetchSettings, 
 		});
	} catch (error) {
		console.error("Eroare la preluarea statisticilor:", error);
		return res.status(500).json({ error: "Eroare la preluarea statisticilor" });
	}
}
