managarten/packages/nutriphi-database/src/schema/goals.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

21 lines
901 B
TypeScript

import { pgTable, uuid, text, integer, timestamp } from 'drizzle-orm/pg-core';
/**
* Nutrition goals table - stores user's daily nutrition targets
*/
export const nutritionGoals = pgTable('nutrition_goals', {
id: uuid('id').primaryKey().defaultRandom(),
userId: text('user_id').notNull().unique(),
caloriesTarget: integer('calories_target').notNull(),
proteinTarget: integer('protein_target').notNull(),
carbsTarget: integer('carbs_target').notNull(),
fatTarget: integer('fat_target').notNull(),
fiberTarget: integer('fiber_target'),
sugarLimit: integer('sugar_limit'),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});
// Type exports
export type NutritionGoal = typeof nutritionGoals.$inferSelect;
export type NewNutritionGoal = typeof nutritionGoals.$inferInsert;