feat: add WhatsApp config fields and IngestJobData type
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,4 +37,24 @@ describe('validateEnv', () => {
|
||||
validateEnv({ ...validEnv, DATABASE_URL: 'not-a-url' } as unknown as NodeJS.ProcessEnv),
|
||||
).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('');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,6 +9,8 @@ const envSchema = z.object({
|
||||
MEILI_URL: z.string().url().default('http://localhost:7700'),
|
||||
MEILI_MASTER_KEY: z.string().default('tower_meili_dev_key'),
|
||||
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>;
|
||||
|
||||
@@ -38,3 +38,13 @@ export interface SyncRoute {
|
||||
targetGroupId: string;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export interface IngestJobData {
|
||||
platformMsgId: string;
|
||||
platform: Platform;
|
||||
sourceGroupId: string;
|
||||
senderJid: string;
|
||||
senderName?: string;
|
||||
content: string;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user