Files
Sauci/apps/api/src/db/schema.ts
T
jjbruntonandClaude Fable 5 fd8981fa28 feat(onboarding): skippable avatar with first-match prompt and usage-reason pack picks
Lets new users skip the onboarding avatar step and instead defers the ask
to a lightweight, dismissible prompt shown once after the couple's first
match. Also personalizes the home screen's first pack recommendation using
the usage_reason already collected during onboarding, which now round-trips
through GET /v1/me.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 19:12:56 +01:00

37 lines
1.9 KiB
TypeScript

import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uuid } from 'drizzle-orm/pg-core';
export const profiles = pgTable('profiles', {
id: uuid('id').primaryKey(),
name: text('name'),
email: text('email'),
avatarUrl: text('avatar_url'),
pushToken: text('push_token'),
timezone: text('timezone'),
isPremium: boolean('is_premium').notNull().default(false),
coupleId: uuid('couple_id'),
gender: text('gender').$type<'male' | 'female' | 'non-binary' | 'prefer-not-to-say' | null>(),
usageReason: text('usage_reason').$type<
'improve_communication' | 'reconnect' | 'spice_up_intimacy' | 'deeper_connection' | 'have_fun' | 'strengthen_relationship' | null
>(),
showExplicitContent: boolean('show_explicit_content').notNull().default(true),
maxIntensity: integer('max_intensity').notNull().default(5),
publicKeyJwk: jsonb('public_key_jwk').$type<Record<string, unknown> | null>(),
hideNsfw: boolean('hide_nsfw').notNull().default(false),
onboardingCompleted: boolean('onboarding_completed').notNull().default(false),
onboardingVersion: integer('onboarding_version').notNull().default(0),
authSyncedAt: timestamp('auth_synced_at', { withTimezone: true }).notNull().defaultNow(),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
}, (table) => [index('profiles_couple_id_idx').on(table.coupleId)]);
export const featureInterests = pgTable('feature_interests', {
userId: uuid('user_id').notNull().references(() => profiles.id, { onDelete: 'cascade' }),
feature: text('feature').notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
}, (table) => [
primaryKey({ columns: [table.userId, table.feature] }),
index('feature_interests_feature_idx').on(table.feature),
]);
export type ProfileRow = typeof profiles.$inferSelect;