feat: support file and image attachments (#98)

* upload & view attachments to particles

* allow download of attachments
This commit was merged in pull request #98.
This commit is contained in:
Arjun Patel
2026-03-30 10:31:24 -07:00
committed by GitHub
parent 3564055c29
commit d6280439d0
15 changed files with 874 additions and 74 deletions
+14
View File
@@ -4,6 +4,7 @@ import {
onSnapshot,
addDoc,
getDoc,
getDocs,
updateDoc,
query,
orderBy,
@@ -126,6 +127,19 @@ export async function getParticle(docPath: string): Promise<Particle | null> {
return doc.data();
}
export async function getParticleChildren(
collectionPath: string,
orderByField: string = "created_at",
orderDirection: "asc" | "desc" = "asc",
): Promise<Particle[]> {
const q = query(
typedCollection(collectionPath),
orderBy(orderByField, orderDirection),
);
const snap = await getDocs(q);
return snap.docs.map((d) => d.data());
}
export function subscribeToParticleChildren(
collectionPath: string,
onData: (children: Particle[]) => void,