import { TypeOrmModuleOptions } from '@nestjs/typeorm'; import { Guild } from './entities/guild.entity'; import { Channel } from './entities/channel.entity'; import { ChannelMember } from './entities/channel-member.entity'; import { Message } from './entities/message.entity'; import { DmConversation } from './entities/dm-conversation.entity'; import { DmParticipant } from './entities/dm-participant.entity'; import { GuildRole } from './entities/guild-role.entity'; import { GuildMember } from './entities/guild-member.entity'; import { GuildMemberRole } from './entities/guild-member-role.entity'; import { IdempotencyRecord } from './entities/idempotency-record.entity'; export const buildTypeOrmConfig = (): TypeOrmModuleOptions => ({ type: 'mysql', host: process.env.FABRIC_BACKEND_GUILD_DB_HOST ?? 'mysql-guild', port: Number(process.env.FABRIC_BACKEND_GUILD_DB_PORT ?? 3306), username: process.env.FABRIC_BACKEND_GUILD_DB_USER ?? 'fabric', password: process.env.FABRIC_BACKEND_GUILD_DB_PASSWORD ?? 'fabric', database: process.env.FABRIC_BACKEND_GUILD_DB_NAME ?? 'fabric_guild', entities: [ Guild, Channel, ChannelMember, Message, DmConversation, DmParticipant, GuildRole, GuildMember, GuildMemberRole, IdempotencyRecord, ], synchronize: (process.env.FABRIC_BACKEND_GUILD_DB_SYNC ?? 'true') === 'true', logging: (process.env.FABRIC_BACKEND_GUILD_DB_LOGGING ?? 'false') === 'true', });