Marketplace móvil para negocios locales mexicanos. Estructura inicial: - apps/backend (NestJS API) - apps/frontend (React Web) - apps/mobile (Expo/React Native) - apps/mcp-server (Claude MCP Server) - apps/whatsapp-service (WhatsApp Business API) - database/ (PostgreSQL DDL) - docs/ (Documentación) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
74 lines
3.2 KiB
TypeScript
74 lines
3.2 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { TenantIntegrationCredential, IntegrationType, IntegrationProvider } from '../entities/tenant-integration-credential.entity';
|
|
import { TenantWhatsAppNumber } from '../entities/tenant-whatsapp-number.entity';
|
|
import { Tenant } from '../../auth/entities/tenant.entity';
|
|
export interface ResolvedWhatsAppCredentials {
|
|
accessToken: string;
|
|
phoneNumberId: string;
|
|
businessAccountId?: string;
|
|
verifyToken?: string;
|
|
isFromPlatform: boolean;
|
|
tenantId?: string;
|
|
}
|
|
export interface ResolvedLLMConfig {
|
|
apiKey: string;
|
|
provider: string;
|
|
model: string;
|
|
maxTokens: number;
|
|
temperature: number;
|
|
baseUrl: string;
|
|
systemPrompt?: string;
|
|
isFromPlatform: boolean;
|
|
tenantId?: string;
|
|
}
|
|
export declare class TenantIntegrationsService {
|
|
private readonly credentialRepo;
|
|
private readonly whatsappNumberRepo;
|
|
private readonly tenantRepo;
|
|
private readonly configService;
|
|
constructor(credentialRepo: Repository<TenantIntegrationCredential>, whatsappNumberRepo: Repository<TenantWhatsAppNumber>, tenantRepo: Repository<Tenant>, configService: ConfigService);
|
|
getWhatsAppCredentials(tenantId: string): Promise<ResolvedWhatsAppCredentials>;
|
|
getPlatformWhatsAppCredentials(): ResolvedWhatsAppCredentials;
|
|
resolveTenantFromPhoneNumberId(phoneNumberId: string): Promise<string | null>;
|
|
getLLMConfig(tenantId: string): Promise<ResolvedLLMConfig>;
|
|
getPlatformLLMConfig(): ResolvedLLMConfig;
|
|
private getDefaultModel;
|
|
private getDefaultBaseUrl;
|
|
upsertCredential(tenantId: string, integrationType: IntegrationType, provider: IntegrationProvider, credentials: Record<string, any>, config?: Record<string, any>, userId?: string): Promise<TenantIntegrationCredential>;
|
|
getCredentials(tenantId: string): Promise<TenantIntegrationCredential[]>;
|
|
getCredential(tenantId: string, integrationType: IntegrationType, provider: IntegrationProvider): Promise<TenantIntegrationCredential | null>;
|
|
deleteCredential(tenantId: string, integrationType: IntegrationType, provider: IntegrationProvider): Promise<void>;
|
|
toggleCredential(tenantId: string, integrationType: IntegrationType, provider: IntegrationProvider, isActive: boolean): Promise<TenantIntegrationCredential>;
|
|
getIntegrationStatus(tenantId: string): Promise<{
|
|
whatsapp: {
|
|
configured: boolean;
|
|
usesPlatformNumber: boolean;
|
|
provider: string;
|
|
isVerified: boolean;
|
|
};
|
|
llm: {
|
|
configured: boolean;
|
|
usesPlatformDefault: boolean;
|
|
provider: string;
|
|
model: string;
|
|
isVerified: boolean;
|
|
};
|
|
payments: {
|
|
stripe: {
|
|
configured: boolean;
|
|
isVerified: boolean;
|
|
};
|
|
mercadopago: {
|
|
configured: boolean;
|
|
isVerified: boolean;
|
|
};
|
|
clip: {
|
|
configured: boolean;
|
|
isVerified: boolean;
|
|
};
|
|
};
|
|
}>;
|
|
registerWhatsAppNumber(tenantId: string, phoneNumberId: string, phoneNumber?: string, displayName?: string, isPlatformNumber?: boolean): Promise<TenantWhatsAppNumber>;
|
|
}
|