build: add TypeScript configuration and generate declaration files
- Add tsconfig.json for TypeScript compilation with declaration and source map generation - Generate .d.ts declaration files for all modules, services, controllers, and models - Update package.json with NestJS dependencies and TypeScript development tools - Include database files in the distribution output for persistence
This commit is contained in:
44
src/database/database.module.ts
Normal file
44
src/database/database.module.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { SequelizeModule } from '@nestjs/sequelize';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { User } from '../models/user.model';
|
||||
import { FoodItem } from '../models/food-item.model';
|
||||
import { Meal } from '../models/meal.model';
|
||||
import { MealFood } from '../models/meal-food.model';
|
||||
import { WaterLog } from '../models/water-log.model';
|
||||
import { WeightLog } from '../models/weight-log.model';
|
||||
import { MealPlan } from '../models/meal-plan.model';
|
||||
import { PlannedFood } from '../models/planned-food.model';
|
||||
import { UserGoal } from '../models/user-goal.model';
|
||||
import { DailySummary } from '../models/daily-summary.model';
|
||||
import { APICache } from '../models/api-cache.model';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
SequelizeModule.forRootAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
dialect: 'sqlite',
|
||||
storage: configService.get<string>('DATABASE_URL') ? configService.get<string>('DATABASE_URL').replace('sqlite://', '') : 'data/calorie_tracker.db',
|
||||
models: [
|
||||
User,
|
||||
FoodItem,
|
||||
Meal,
|
||||
MealFood,
|
||||
WaterLog,
|
||||
WeightLog,
|
||||
MealPlan,
|
||||
PlannedFood,
|
||||
UserGoal,
|
||||
DailySummary,
|
||||
APICache,
|
||||
],
|
||||
autoLoadModels: true,
|
||||
synchronize: true,
|
||||
logging: false,
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
],
|
||||
})
|
||||
export class DatabaseModule {}
|
||||
Reference in New Issue
Block a user