Implement share-link service (task 30)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ginnoir
2026-05-06 14:09:10 -05:00
co-authored by Claude Sonnet 4.6
parent 28475e483d
commit d5deee9a46
7 changed files with 222 additions and 0 deletions
+24
View File
@@ -106,6 +106,30 @@ export const activityLog = pgTable(
(t) => [index("activity_log_household_created_idx").on(t.householdId, t.createdAt)],
);
export const shareLinks = pgTable(
"share_links",
{
id: uuid("id").primaryKey().defaultRandom(),
householdId: uuid("household_id")
.notNull()
.references(() => households.id, { onDelete: "cascade" }),
entityType: text("entity_type").notNull(),
entityId: uuid("entity_id").notNull(),
token: text("token").notNull().unique(),
capabilities: jsonb("capabilities").$type<{ read: boolean; write: boolean }>().notNull(),
createdBy: uuid("created_by")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
expiresAt: timestamp("expires_at", { withTimezone: true }),
revokedAt: timestamp("revoked_at", { withTimezone: true }),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
},
(t) => [
index("share_links_household_idx").on(t.householdId),
index("share_links_entity_idx").on(t.entityType, t.entityId),
],
);
export const reminders = pgTable(
"reminders",
{