remove auth, re-add later

This commit is contained in:
tuanvu
2025-12-11 13:01:28 +01:00
parent e5f4e9405a
commit 77f07b3626
4 changed files with 21 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import { collection, doc, getDoc, getDocs, Timestamp, updateDoc } from "firebase/firestore";
import { addDoc, collection, doc, getDoc, getDocs, Timestamp, updateDoc } from "firebase/firestore";
import { Chantier, Reservation, Ressources, User } from "../class/class";
import { db } from "../firebase_config";
@@ -90,4 +90,16 @@ export async function changeChantierStatus(chantierId: string, newStatus: string
} catch (err) {
console.error("Error", err);
}
}
export async function addChantier(chantierData: Omit<Chantier, 'id'>): Promise<string | null> {
try {
const colRef = collection(db, "chantier");
const chantierRef = await addDoc(colRef, chantierData);
//console.log(`Chantier added with ID: ${chantierRef.id}`);
return chantierRef.id;
} catch (err) {
console.error("Error adding:", err);
return null;
}
}