Feat: Sync entre addRessources et gestionRessources

This commit is contained in:
Amaël Kesteman
2025-12-13 21:49:07 +01:00
parent 85fc76ddec
commit 898f06d577
4 changed files with 44 additions and 11 deletions

View File

@@ -37,6 +37,19 @@ export async function getRessources(): Promise<Ressources[]> {
return [];
}
}
//ADD RESSOURCES
export async function addRessources(ressourceData: Omit<Ressources, 'id'>): Promise<string | null> {
try {
const colRef = collection(db, "ressources");
const ressourcesRef = await addDoc(colRef, ressourceData);
console.log(`Ressource ajoutée avec ID: ${ressourcesRef.id}`);
return ressourcesRef.id;
} catch (err) {
console.error("Error adding:", err);
return null;
}
}
///////////////////////////////////CHANTIER/////////////////////////////////
export async function getChantiers(): Promise<Chantier[]> {
const snap = await getDocs(collection(db, "chantier"));