feat: add WhatsApp config fields and IngestJobData type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 14:58:46 +05:30
parent b16a30beb2
commit 891986d3ba
3 changed files with 32 additions and 0 deletions
+20
View File
@@ -37,4 +37,24 @@ describe('validateEnv', () => {
validateEnv({ ...validEnv, DATABASE_URL: 'not-a-url' } as unknown as NodeJS.ProcessEnv), validateEnv({ ...validEnv, DATABASE_URL: 'not-a-url' } as unknown as NodeJS.ProcessEnv),
).toThrow('Invalid environment variables'); ).toThrow('Invalid environment variables');
}); });
it('applies default WHATSAPP_SESSION_PATH of ./sessions when not set', () => {
const env = {
DATABASE_URL: 'postgresql://user:pass@localhost:5432/db',
REDIS_URL: 'redis://localhost:6379',
JWT_SECRET: 'a'.repeat(32),
};
const result = validateEnv(env as NodeJS.ProcessEnv);
expect(result.WHATSAPP_SESSION_PATH).toBe('./sessions');
});
it('applies default TOWER_ADMIN_JIDS of empty string when not set', () => {
const env = {
DATABASE_URL: 'postgresql://user:pass@localhost:5432/db',
REDIS_URL: 'redis://localhost:6379',
JWT_SECRET: 'a'.repeat(32),
};
const result = validateEnv(env as NodeJS.ProcessEnv);
expect(result.TOWER_ADMIN_JIDS).toBe('');
});
}); });
+2
View File
@@ -9,6 +9,8 @@ const envSchema = z.object({
MEILI_URL: z.string().url().default('http://localhost:7700'), MEILI_URL: z.string().url().default('http://localhost:7700'),
MEILI_MASTER_KEY: z.string().default('tower_meili_dev_key'), MEILI_MASTER_KEY: z.string().default('tower_meili_dev_key'),
LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warn', 'error']).default('info'), LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warn', 'error']).default('info'),
WHATSAPP_SESSION_PATH: z.string().default('./sessions'),
TOWER_ADMIN_JIDS: z.string().default(''),
}); });
export type Env = z.infer<typeof envSchema>; export type Env = z.infer<typeof envSchema>;
+10
View File
@@ -38,3 +38,13 @@ export interface SyncRoute {
targetGroupId: string; targetGroupId: string;
isActive: boolean; isActive: boolean;
} }
export interface IngestJobData {
platformMsgId: string;
platform: Platform;
sourceGroupId: string;
senderJid: string;
senderName?: string;
content: string;
tags: string[];
}