feat: add signed Discord command foundation and daily check-ins

This commit is contained in:
syntaxbullet
2026-09-08 08:15:22 +02:00
parent 8e846fa11b
commit 4f38bf1431
17 changed files with 1556 additions and 3 deletions

View File

@@ -101,3 +101,15 @@ export const liveDiscordCards = sqliteTable('live_discord_cards', {
retryAt: integer('retry_at'),
updatedAt: integer('updated_at').notNull(),
});
// Short-lived UI state and replay receipts; no Discord interaction tokens are persisted.
export const discordControls = sqliteTable('discord_controls', {
id: text('id').primaryKey(), userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
action: text('action').notNull(), payload: text('payload', { mode: 'json' }).$type<import('../discord/types').ControlData>().notNull(),
expiresAt: integer('expires_at').notNull(), used: integer('used', { mode: 'boolean' }).notNull().default(false),
}, t => [index('discord_controls_expiry_idx').on(t.expiresAt)]);
export const discordReceipts = sqliteTable('discord_receipts', {
id: text('id').primaryKey(), userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
response: text('response', { mode: 'json' }).$type<import('../discord/types').Reply>().notNull(),
expiresAt: integer('expires_at').notNull(),
}, t => [index('discord_receipts_expiry_idx').on(t.expiresAt)]);