feat(notifications): add notifications + notificationPreferences tables
This commit is contained in:
@@ -835,6 +835,37 @@ const applicationTables = {
|
||||
})
|
||||
.index('by_thread', ['threadId'])
|
||||
.index('by_owner', ['ownerId']),
|
||||
notifications: defineTable({
|
||||
userId: v.id('users'),
|
||||
kind: v.union(
|
||||
v.literal('maintenance_thread'),
|
||||
v.literal('agent_turn_finished'),
|
||||
v.literal('agent_needs_input'),
|
||||
v.literal('sync_failed'),
|
||||
v.literal('connection_needs_reauth'),
|
||||
),
|
||||
title: v.string(),
|
||||
body: v.string(),
|
||||
link: v.optional(v.string()),
|
||||
spoonId: v.optional(v.id('spoons')),
|
||||
threadId: v.optional(v.id('threads')),
|
||||
readAt: v.optional(v.number()),
|
||||
emailedAt: v.optional(v.number()),
|
||||
createdAt: v.number(),
|
||||
})
|
||||
.index('by_user', ['userId'])
|
||||
.index('by_user_unread', ['userId', 'readAt'])
|
||||
.index('by_user_created', ['userId', 'createdAt']),
|
||||
notificationPreferences: defineTable({
|
||||
userId: v.id('users'),
|
||||
emailEnabled: v.optional(v.boolean()),
|
||||
emailMaintenance: v.optional(v.boolean()),
|
||||
emailAgentTurnFinished: v.optional(v.boolean()),
|
||||
emailAgentNeedsInput: v.optional(v.boolean()),
|
||||
emailSyncFailed: v.optional(v.boolean()),
|
||||
emailConnectionReauth: v.optional(v.boolean()),
|
||||
updatedAt: v.number(),
|
||||
}).index('by_user', ['userId']),
|
||||
ignoredUpstreamChanges: defineTable({
|
||||
spoonId: v.id('spoons'),
|
||||
ownerId: v.id('users'),
|
||||
|
||||
Reference in New Issue
Block a user