import { DataSource } from 'typeorm';
import { User } from './user/user.entity';
import { Workspace } from './workspace/workspace.entity';
import { Project } from './project/project.entity';
import { AiConfig } from './ai/ai-config.entity';
import { PluginConfig } from './plugins/plugin-config.entity';

export const AppDataSource = new DataSource({
  type: 'postgres',
  host: process.env.POSTGRES_HOST || 'localhost',
  port:  5432,
  username: process.env.POSTGRES_USER || 'postgres',
  password: process.env.POSTGRES_PASSWORD || 'postgres',
  database: process.env.POSTGRES_DB || 'aiframe',
  entities: [User, Workspace, Project, AiConfig, PluginConfig],
  synchronize: true,
});