managarten/services/telegram-todo-bot/src/database/schema.ts
Till-JS 8e6adfdb10 feat(services): add Telegram bot services for NutriPhi, Todo, and Zitare
Add three new Telegram bot services:

- telegram-nutriphi-bot: Nutrition tracking bot with Gemini AI analysis
  - Photo meal analysis
  - Daily nutrition goals and tracking
  - Statistics and reports

- telegram-todo-bot: Todo list management bot
  - Integration with Todo backend API
  - Reminder scheduling
  - User preferences per chat

- telegram-zitare-bot: Daily inspiration quotes bot
  - Scheduled daily quotes
  - Quote database with authors
  - User subscription management

All bots use NestJS with nestjs-telegraf for Telegram integration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 12:52:01 +01:00

23 lines
1 KiB
TypeScript

import { pgTable, uuid, text, timestamp, bigint, boolean } from 'drizzle-orm/pg-core';
// Telegram users - Mapping Telegram User <-> Todo User
export const telegramUsers = pgTable('telegram_users', {
id: uuid('id').primaryKey().defaultRandom(),
telegramUserId: bigint('telegram_user_id', { mode: 'number' }).notNull().unique(),
telegramUsername: text('telegram_username'),
// Linking with mana-core-auth
manaUserId: text('mana_user_id'),
accessToken: text('access_token'),
refreshToken: text('refresh_token'),
tokenExpiresAt: timestamp('token_expires_at'),
// Settings
dailyReminderEnabled: boolean('daily_reminder_enabled').default(false).notNull(),
dailyReminderTime: text('daily_reminder_time').default('08:00').notNull(),
timezone: text('timezone').default('Europe/Berlin').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
});
// Types
export type TelegramUser = typeof telegramUsers.$inferSelect;
export type NewTelegramUser = typeof telegramUsers.$inferInsert;