import { collection, getDocs } from "firebase/firestore"; import { db } from "../firebase_config"; export type Ressource = { id: number; name: string; type: string; Image: string; quantity: number; available_quantity: number; }; export async function getRessources(): Promise { try { const ressourcesCol = collection(db, "ressources"); const snapshot = await getDocs(ressourcesCol); const list = snapshot.docs.map((doc) => doc.data() as Ressource); return list; } catch (err) { console.log("Firestore Error:", err); return []; } }