diff --git a/js/src/api/types.ts b/js/src/api/types.ts index 1583c24..7660817 100644 --- a/js/src/api/types.ts +++ b/js/src/api/types.ts @@ -67,12 +67,18 @@ export const StreamPropertiesSchema = z.object({ name: z.string(), status: z.enum(["open", "closed"]), description: z.string().optional(), + // e.g. ["human:aron@acme.com", "human:john@acme.com"] - visible only to Aron and John + // e.g. ["network:123"] - visible to everyone in the network + visible_to: z.array(z.string()) }); export type StreamProperties = z.infer; export const FolderPropertiesSchema = z.object({ name: z.string(), color: z.string().optional(), + // e.g. ["human:aron@acme.com", "human:john@acme.com"] - visible only to Aron and John + // e.g. ["network:123"] - visible to everyone in the network + visible_to: z.array(z.string()) }); export type FolderProperties = z.infer; @@ -128,9 +134,6 @@ const ParticleBaseSchema = z.object({ created_at: z.coerce.date(), created_by_email: z.string().email(), updated_at: z.coerce.date().optional(), - // e.g. ["human:aron@acme.com", "human:john@acme.com"] - visible only to Aron and John - // e.g. ["network:123"] - visible to everyone in the network - visible_to: z.array(z.string()) }); export const ParticleSchema = z.discriminatedUnion("type", [ diff --git a/js/src/lib/firestore-particles.ts b/js/src/lib/firestore-particles.ts index 961860b..a08ecc7 100644 --- a/js/src/lib/firestore-particles.ts +++ b/js/src/lib/firestore-particles.ts @@ -92,7 +92,6 @@ export async function createParticle( type: T, properties: ParticlePropertiesMap[T], createdByEmail: string, - visibleTo: string[], ): Promise { const particle: Particle = ParticleSchema.parse({ id: "", // ignored by toFirestore, but needed to satisfy the type @@ -101,7 +100,6 @@ export async function createParticle( created_at: new Date(), created_by_email: createdByEmail, updated_at: null, - visible_to: visibleTo, }); const ref = await addDoc(typedCollection(collectionPath), particle); return ref.id; @@ -111,7 +109,6 @@ export async function createParticle( export async function updateParticle( docPath: string, properties: Partial, - visibleTo?: string[], ): Promise { const particleRef = typedDoc(docPath); // Take the partial and create a new object with dot notation @@ -123,6 +120,5 @@ export async function updateParticle( await updateDoc(particleRef, { ...updatedProperties, updated_at: serverTimestamp(), - ...(visibleTo ? { visible_to: visibleTo } : {}), }); }