feat(gateway): include production Telegram user gateway

Version the NestJS TDLib gateway with Docker deployment, migrations, automated tests and platform integration documentation while excluding all account sessions, credentials, runtime databases and backups.
This commit is contained in:
wmq
2026-08-01 18:38:20 +08:00
parent af49d22ca7
commit 06112602ec
142 changed files with 23107 additions and 7 deletions
@@ -0,0 +1,53 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class InitialSchema1700000000000 implements MigrationInterface {
name = 'InitialSchema1700000000000';
public async up(queryRunner: QueryRunner): Promise<void> {
if (queryRunner.connection.options.type === 'postgres') {
await queryRunner.query('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"');
}
// Capture the entity-to-database delta once, then execute it as this
// initial migration. This keeps the initial schema aligned with all
// registered entities while production still runs with synchronize=false.
const schemaBuilder = (
queryRunner.connection.driver as unknown as {
createSchemaBuilder: () => {
log: () => Promise<{
upQueries: Array<{ query: string; parameters?: unknown[] }>;
}>;
};
}
).createSchemaBuilder();
const schema = await schemaBuilder.log();
for (const query of schema.upQueries) {
await queryRunner.query(query.query, query.parameters);
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
const tables = [
'tg_webhook_deliveries',
'tg_webhook_subscriptions',
'tg_rate_limit_events',
'tg_raw_updates',
'tg_audit_logs',
'tg_files',
'tg_send_jobs',
'tg_messages',
'tg_groups',
'tg_contacts',
'tg_users',
'tg_chats',
'tg_account_proxy_bindings',
'tg_proxies',
'tg_accounts',
'users',
'tenants',
];
for (const table of tables) {
await queryRunner.dropTable(table, true, true, true);
}
}
}