import { initializeApp } from "npm:firebase@9.20.0/app";
import { deleteDoc, doc, getFirestore } from "npm:firebase/firestore/lite";
/**
* Deletes a document.
*/
type Firebase = {
apiKey: string;
authDomain: string;
projectId: string;
storageBucket: string;
messagingSenderId: string;
appId: string;
measurementId: string;
};
export async function main(
auth: Firebase,
collection_id: string,
document_path: string[],
) {
const app = initializeApp(auth);
const store = getFirestore(app);
const docRef = doc(store, collection_id, ...document_path);
await deleteDoc(docRef);
}
Submitted by admin 501 days ago
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
import { initializeApp } from "npm:firebase@9.20.0/app";
import { deleteDoc, doc, getFirestore } from "npm:firebase/firestore/lite";
/**
* Deletes a document.
*/
export async function main(
auth: Resource<"firebase">,
collection_id: string,
document_path: string[],
) {
const app = initializeApp(auth);
const store = getFirestore(app);
const docRef = doc(store, collection_id, ...document_path);
await deleteDoc(docRef);
}
Submitted by adam186 606 days ago