feat: add notes collection to triplit schema

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 16:12:08 -05:00
parent ea9d68f507
commit 4af2642c04
+24
View File
@@ -72,9 +72,33 @@ export const schema = S.Collections({
} }
} }
} }
},
notes: {
schema: S.Schema({
id: S.Id(),
userId: S.String(),
title: S.String({ default: '' }),
content: S.String({ default: '' }),
pinned: S.Boolean({ default: false }),
archived: S.Boolean({ default: false }),
deleted: S.Boolean({ default: false }),
tags: S.Set(S.String(), { default: [] }),
createdAt: S.Date({ default: S.Default.now() }),
updatedAt: S.Date({ default: S.Default.now() }),
deletedAt: S.Date({ nullable: true }),
}),
permissions: {
owner: {
read: { filter: [['userId', '=', '$userId']] },
insert: { filter: [['userId', '=', '$userId']] },
update: { filter: [['userId', '=', '$userId']] },
delete: { filter: [['userId', '=', '$userId']] }
}
}
} }
}); });
// Use the `Entity` type to extract clean types for your collections // Use the `Entity` type to extract clean types for your collections
export type Habit = Entity<typeof schema, 'habits'>; export type Habit = Entity<typeof schema, 'habits'>;
export type HabitCompletion = Entity<typeof schema, 'habit_completions'>; export type HabitCompletion = Entity<typeof schema, 'habit_completions'>;
export type Note = Entity<typeof schema, 'notes'>;