1 | import { initializeApp } from "npm:firebase@9.20.0/app"; |
2 | import { deleteDoc, doc, getFirestore } from "npm:firebase/firestore/lite"; |
3 |
|
4 |
|
5 | * Deletes a document. |
6 | */ |
7 | type Firebase = { |
8 | apiKey: string; |
9 | authDomain: string; |
10 | projectId: string; |
11 | storageBucket: string; |
12 | messagingSenderId: string; |
13 | appId: string; |
14 | measurementId: string; |
15 | }; |
16 | export async function main( |
17 | auth: Firebase, |
18 | collection_id: string, |
19 | document_path: string[], |
20 | ) { |
21 | const app = initializeApp(auth); |
22 | const store = getFirestore(app); |
23 |
|
24 | const docRef = doc(store, collection_id, ...document_path); |
25 | await deleteDoc(docRef); |
26 | } |
27 |
|