mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 05:19:40 +02:00
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)
This commit is contained in:
parent
0241f5554c
commit
d36b321d9d
3952 changed files with 661498 additions and 739751 deletions
|
|
@ -4,16 +4,16 @@ 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(),
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,65 +1,64 @@
|
|||
import {
|
||||
pgTable,
|
||||
uuid,
|
||||
text,
|
||||
integer,
|
||||
real,
|
||||
timestamp,
|
||||
index,
|
||||
jsonb,
|
||||
} from 'drizzle-orm/pg-core';
|
||||
import { pgTable, uuid, text, integer, real, timestamp, index, jsonb } from 'drizzle-orm/pg-core';
|
||||
|
||||
/**
|
||||
* Meals table - stores all meal entries with nutrition data
|
||||
*/
|
||||
export const meals = pgTable(
|
||||
'meals',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: text('user_id').notNull(),
|
||||
foodName: text('food_name').notNull(),
|
||||
imageUrl: text('image_url'),
|
||||
storagePath: text('storage_path'), // R2 path for deletion
|
||||
calories: real('calories').default(0),
|
||||
protein: real('protein').default(0),
|
||||
carbohydrates: real('carbohydrates').default(0),
|
||||
fat: real('fat').default(0),
|
||||
fiber: real('fiber').default(0),
|
||||
sugar: real('sugar').default(0),
|
||||
sodium: real('sodium').default(0),
|
||||
servingSize: text('serving_size'),
|
||||
mealType: text('meal_type'), // breakfast | lunch | dinner | snack
|
||||
analysisStatus: text('analysis_status').default('pending'), // pending | completed | failed | manual
|
||||
healthScore: integer('health_score'), // 1-10
|
||||
healthCategory: text('health_category'), // very_healthy | healthy | moderate | unhealthy
|
||||
notes: text('notes'),
|
||||
userRating: integer('user_rating'), // 1-5
|
||||
foodItems: jsonb('food_items').$type<FoodItem[]>().default([]),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
},
|
||||
(table) => [
|
||||
index('meals_user_id_idx').on(table.userId),
|
||||
index('meals_created_at_idx').on(table.createdAt),
|
||||
index('meals_user_created_idx').on(table.userId, table.createdAt),
|
||||
]
|
||||
'meals',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: text('user_id').notNull(),
|
||||
foodName: text('food_name').notNull(),
|
||||
imageUrl: text('image_url'),
|
||||
storagePath: text('storage_path'), // R2 path for deletion
|
||||
calories: real('calories').default(0),
|
||||
protein: real('protein').default(0),
|
||||
carbohydrates: real('carbohydrates').default(0),
|
||||
fat: real('fat').default(0),
|
||||
fiber: real('fiber').default(0),
|
||||
sugar: real('sugar').default(0),
|
||||
sodium: real('sodium').default(0),
|
||||
servingSize: text('serving_size'),
|
||||
mealType: text('meal_type'), // breakfast | lunch | dinner | snack
|
||||
analysisStatus: text('analysis_status').default('pending'), // pending | completed | failed | manual
|
||||
healthScore: integer('health_score'), // 1-10
|
||||
healthCategory: text('health_category'), // very_healthy | healthy | moderate | unhealthy
|
||||
notes: text('notes'),
|
||||
userRating: integer('user_rating'), // 1-5
|
||||
foodItems: jsonb('food_items').$type<FoodItem[]>().default([]),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
},
|
||||
(table) => [
|
||||
index('meals_user_id_idx').on(table.userId),
|
||||
index('meals_created_at_idx').on(table.createdAt),
|
||||
index('meals_user_created_idx').on(table.userId, table.createdAt),
|
||||
]
|
||||
);
|
||||
|
||||
/**
|
||||
* Food item type for meal ingredients
|
||||
*/
|
||||
export interface FoodItem {
|
||||
id: string;
|
||||
name: string;
|
||||
category: 'protein' | 'vegetable' | 'grain' | 'fruit' | 'dairy' | 'fat' | 'processed' | 'beverage';
|
||||
portionSize: string;
|
||||
calories?: number;
|
||||
protein?: number;
|
||||
carbs?: number;
|
||||
fat?: number;
|
||||
fiber?: number;
|
||||
sugar?: number;
|
||||
confidence?: number;
|
||||
id: string;
|
||||
name: string;
|
||||
category:
|
||||
| 'protein'
|
||||
| 'vegetable'
|
||||
| 'grain'
|
||||
| 'fruit'
|
||||
| 'dairy'
|
||||
| 'fat'
|
||||
| 'processed'
|
||||
| 'beverage';
|
||||
portionSize: string;
|
||||
calories?: number;
|
||||
protein?: number;
|
||||
carbs?: number;
|
||||
fat?: number;
|
||||
fiber?: number;
|
||||
sugar?: number;
|
||||
confidence?: number;
|
||||
}
|
||||
|
||||
// Type exports
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue