Added Typebot integration

This commit is contained in:
Davidson Gomes
2023-08-04 15:00:55 -03:00
parent 84386847e2
commit 3b3118d764
13 changed files with 648 additions and 2 deletions

View File

@@ -5,5 +5,6 @@ export * from './contact.model';
export * from './message.model';
export * from './rabbitmq.model';
export * from './settings.model';
export * from './typebot.model';
export * from './webhook.model';
export * from './websocket.model';

View File

@@ -0,0 +1,38 @@
import { Schema } from 'mongoose';
import { dbserver } from '../../libs/db.connect';
class Session {
remoteJid?: string;
sessionId?: string;
createdAt?: number;
updateAt?: number;
}
export class TypebotRaw {
_id?: string;
enabled?: boolean;
url: string;
typebot?: string;
expire?: number;
sessions?: Session[];
}
const typebotSchema = new Schema<TypebotRaw>({
_id: { type: String, _id: true },
enabled: { type: Boolean, required: true },
url: { type: String, required: true },
typebot: { type: String, required: true },
expire: { type: Number, required: true },
sessions: [
{
remoteJid: { type: String, required: true },
sessionId: { type: String, required: true },
createdAt: { type: Number, required: true },
updateAt: { type: Number, required: true },
},
],
});
export const TypebotModel = dbserver?.model(TypebotRaw.name, typebotSchema, 'typebot');
export type ITypebotModel = typeof TypebotModel;