managarten/packages/news-database/src/schema/users.ts
Wuesteon d36b321d9d style: auto-format codebase with Prettier
Applied formatting to 1487+ files using pnpm format:write
  - TypeScript/JavaScript files
  - Svelte components
  - Astro pages
  - JSON configs
  - Markdown docs

  13 files still need manual review (Astro JSX comments)
2025-11-27 18:33:16 +01:00

29 lines
1.1 KiB
TypeScript

import { pgTable, uuid, text, timestamp, boolean, pgEnum } from 'drizzle-orm/pg-core';
export const userTierEnum = pgEnum('user_tier', ['free', 'premium', 'enterprise']);
export const readingSpeedEnum = pgEnum('reading_speed', ['slow', 'normal', 'fast']);
export const users = pgTable('users', {
id: uuid('id').primaryKey().defaultRandom(),
email: text('email').notNull().unique(),
name: text('name'),
avatarUrl: text('avatar_url'),
emailVerified: boolean('email_verified').default(false).notNull(),
// Preferences
tier: userTierEnum('tier').default('free').notNull(),
readingSpeed: readingSpeedEnum('reading_speed').default('normal').notNull(),
preferredCategories: text('preferred_categories').array(),
blockedSources: text('blocked_sources').array(),
// Settings
onboardingCompleted: boolean('onboarding_completed').default(false).notNull(),
notificationSettings: text('notification_settings'), // JSON string
// Timestamps
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
});
export type User = typeof users.$inferSelect;
export type NewUser = typeof users.$inferInsert;