Files
Fabric.Backend.Guild/src/database.config.ts
hzhang 774dff11ba feat(guild): channel membership + public visibility
- new channel_members table; creator always added, plus selected members
- Channel.isPublic (default false): public channels visible to all guild
  members; non-public only to explicit members
- GET /channels filters to channels visible to the requesting user

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 09:09:41 +01:00

35 lines
1.4 KiB
TypeScript

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',
});