WeLe Agentic AI with Docker deployment
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// ============================================
|
||||
// Read-models over the live CRM collections.
|
||||
//
|
||||
// Deliberately schema-less (`strict: false`): this service only READS from
|
||||
// these collections, and the CRM owns the real schemas. Re-declaring 26 full
|
||||
// schemas here would create two definitions of the same truth that silently
|
||||
// drift apart the first time the CRM adds a field. Collection names are
|
||||
// pinned explicitly — they were verified against the live database rather
|
||||
// than inferred from Mongoose's pluralisation rules.
|
||||
// ============================================
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const loose = (collection) =>
|
||||
new mongoose.Schema({}, { strict: false, collection, versionKey: false });
|
||||
|
||||
const model = (name, collection) =>
|
||||
mongoose.models[name] || mongoose.model(name, loose(collection));
|
||||
|
||||
export const Lead = model('Lead', 'leads');
|
||||
export const Conversation = model('Conversation', 'conversations');
|
||||
export const LeadStage = model('LeadStage', 'leadstages');
|
||||
export const AnalyticsEvent = model('AnalyticsEvent', 'analyticsevents');
|
||||
export const SummaryNote = model('SummaryNote', 'summarynotes');
|
||||
export const WorkshopStage = model('WorkshopStage', 'workshopstages');
|
||||
export const EnrollmentLog = model('EnrollmentLog', 'enrollmentlogs');
|
||||
export const CallLog = model('CallLog', 'calllogs');
|
||||
export const CallSession = model('CallSession', 'callsessions');
|
||||
export const Campaign = model('Campaign', 'campaigns');
|
||||
export const FollowUp = model('FollowUp', 'followups');
|
||||
export const DSRReport = model('DSRReport', 'dsrreports');
|
||||
export const User = model('User', 'users');
|
||||
export const Role = model('Role', 'roles');
|
||||
export const Course = model('Course', 'courses');
|
||||
export const Trainer = model('Trainer', 'trainers');
|
||||
export const Tag = model('Tag', 'tags');
|
||||
export const StageConfig = model('StageConfig', 'stageconfigs');
|
||||
export const WhatsAppLead = model('WhatsAppLead', 'whatsappleads');
|
||||
export const CommentLead = model('CommentLead', 'commentleads');
|
||||
export const InstaAdLead = model('InstaAdLead', 'instaadleads');
|
||||
export const ScheduledEvent = model('ScheduledEvent', 'scheduledevents');
|
||||
export const EmailTemplate = model('EmailTemplate', 'emailtemplates');
|
||||
|
||||
// ── Paid acquisition / attribution ──
|
||||
export const CapiEvent = model('CapiEvent', 'capievents');
|
||||
export const WhatsAppTemplLead = model('WhatsAppTemplLead', 'whatsapptemplleads');
|
||||
|
||||
export const COLLECTIONS = {
|
||||
Lead, Conversation, LeadStage, AnalyticsEvent, SummaryNote, WorkshopStage,
|
||||
EnrollmentLog, CallLog, CallSession, Campaign, FollowUp, DSRReport, User,
|
||||
Role, Course, Trainer, Tag, StageConfig, WhatsAppLead, CommentLead,
|
||||
InstaAdLead, ScheduledEvent, EmailTemplate, CapiEvent, WhatsAppTemplLead,
|
||||
};
|
||||
Reference in New Issue
Block a user