This commit is contained in:
Alan Mosko
2023-07-26 11:12:00 -03:00
parent 0a851b935e
commit dc3d59bae1
69 changed files with 9028 additions and 9104 deletions

View File

@@ -3,15 +3,15 @@ import { Schema } from 'mongoose';
import { dbserver } from '../../db/db.connect';
export class AuthRaw {
_id?: string;
jwt?: string;
apikey?: string;
_id?: string;
jwt?: string;
apikey?: string;
}
const authSchema = new Schema<AuthRaw>({
_id: { type: String, _id: true },
jwt: { type: String, minlength: 1 },
apikey: { type: String, minlength: 1 },
_id: { type: String, _id: true },
jwt: { type: String, minlength: 1 },
apikey: { type: String, minlength: 1 },
});
export const AuthModel = dbserver?.model(AuthRaw.name, authSchema, 'authentication');

View File

@@ -3,16 +3,16 @@ import { Schema } from 'mongoose';
import { dbserver } from '../../db/db.connect';
export class ChatRaw {
_id?: string;
id?: string;
owner: string;
lastMsgTimestamp?: number;
_id?: string;
id?: string;
owner: string;
lastMsgTimestamp?: number;
}
const chatSchema = new Schema<ChatRaw>({
_id: { type: String, _id: true },
id: { type: String, required: true, minlength: 1 },
owner: { type: String, required: true, minlength: 1 },
_id: { type: String, _id: true },
id: { type: String, required: true, minlength: 1 },
owner: { type: String, required: true, minlength: 1 },
});
export const ChatModel = dbserver?.model(ChatRaw.name, chatSchema, 'chats');

View File

@@ -3,27 +3,27 @@ import { Schema } from 'mongoose';
import { dbserver } from '../../db/db.connect';
export class ChatwootRaw {
_id?: string;
enabled?: boolean;
account_id?: string;
token?: string;
url?: string;
name_inbox?: string;
sign_msg?: boolean;
number?: string;
reopen_conversation?: boolean;
conversation_pending?: boolean;
_id?: string;
enabled?: boolean;
account_id?: string;
token?: string;
url?: string;
name_inbox?: string;
sign_msg?: boolean;
number?: string;
reopen_conversation?: boolean;
conversation_pending?: boolean;
}
const chatwootSchema = new Schema<ChatwootRaw>({
_id: { type: String, _id: true },
enabled: { type: Boolean, required: true },
account_id: { type: String, required: true },
token: { type: String, required: true },
url: { type: String, required: true },
name_inbox: { type: String, required: true },
sign_msg: { type: Boolean, required: true },
number: { type: String, required: true },
_id: { type: String, _id: true },
enabled: { type: Boolean, required: true },
account_id: { type: String, required: true },
token: { type: String, required: true },
url: { type: String, required: true },
name_inbox: { type: String, required: true },
sign_msg: { type: Boolean, required: true },
number: { type: String, required: true },
});
export const ChatwootModel = dbserver?.model(ChatwootRaw.name, chatwootSchema, 'chatwoot');

View File

@@ -3,19 +3,19 @@ import { Schema } from 'mongoose';
import { dbserver } from '../../db/db.connect';
export class ContactRaw {
_id?: string;
pushName?: string;
id?: string;
profilePictureUrl?: string;
owner: string;
_id?: string;
pushName?: string;
id?: string;
profilePictureUrl?: string;
owner: string;
}
const contactSchema = new Schema<ContactRaw>({
_id: { type: String, _id: true },
pushName: { type: String, minlength: 1 },
id: { type: String, required: true, minlength: 1 },
profilePictureUrl: { type: String, minlength: 1 },
owner: { type: String, required: true, minlength: 1 },
_id: { type: String, _id: true },
pushName: { type: String, minlength: 1 },
id: { type: String, required: true, minlength: 1 },
profilePictureUrl: { type: String, minlength: 1 },
owner: { type: String, required: true, minlength: 1 },
});
export const ContactModel = dbserver?.model(ContactRaw.name, contactSchema, 'contacts');

View File

@@ -4,65 +4,65 @@ import { dbserver } from '../../db/db.connect';
import { wa } from '../types/wa.types';
class Key {
id?: string;
remoteJid?: string;
fromMe?: boolean;
participant?: string;
id?: string;
remoteJid?: string;
fromMe?: boolean;
participant?: string;
}
export class MessageRaw {
_id?: string;
key?: Key;
pushName?: string;
participant?: string;
message?: object;
messageType?: string;
messageTimestamp?: number | Long.Long;
owner: string;
source?: 'android' | 'web' | 'ios';
_id?: string;
key?: Key;
pushName?: string;
participant?: string;
message?: object;
messageType?: string;
messageTimestamp?: number | Long.Long;
owner: string;
source?: 'android' | 'web' | 'ios';
}
const messageSchema = new Schema<MessageRaw>({
_id: { type: String, _id: true },
key: {
id: { type: String, required: true, minlength: 1 },
remoteJid: { type: String, required: true, minlength: 1 },
fromMe: { type: Boolean, required: true },
participant: { type: String, minlength: 1 },
},
pushName: { type: String },
participant: { type: String },
messageType: { type: String },
message: { type: Object },
source: { type: String, minlength: 3, enum: ['android', 'web', 'ios'] },
messageTimestamp: { type: Number, required: true },
owner: { type: String, required: true, minlength: 1 },
_id: { type: String, _id: true },
key: {
id: { type: String, required: true, minlength: 1 },
remoteJid: { type: String, required: true, minlength: 1 },
fromMe: { type: Boolean, required: true },
participant: { type: String, minlength: 1 },
},
pushName: { type: String },
participant: { type: String },
messageType: { type: String },
message: { type: Object },
source: { type: String, minlength: 3, enum: ['android', 'web', 'ios'] },
messageTimestamp: { type: Number, required: true },
owner: { type: String, required: true, minlength: 1 },
});
export const MessageModel = dbserver?.model(MessageRaw.name, messageSchema, 'messages');
export type IMessageModel = typeof MessageModel;
export class MessageUpdateRaw {
_id?: string;
remoteJid?: string;
id?: string;
fromMe?: boolean;
participant?: string;
datetime?: number;
status?: wa.StatusMessage;
owner: string;
pollUpdates?: any;
_id?: string;
remoteJid?: string;
id?: string;
fromMe?: boolean;
participant?: string;
datetime?: number;
status?: wa.StatusMessage;
owner: string;
pollUpdates?: any;
}
const messageUpdateSchema = new Schema<MessageUpdateRaw>({
_id: { type: String, _id: true },
remoteJid: { type: String, required: true, min: 1 },
id: { type: String, required: true, min: 1 },
fromMe: { type: Boolean, required: true },
participant: { type: String, min: 1 },
datetime: { type: Number, required: true, min: 1 },
status: { type: String, required: true },
owner: { type: String, required: true, min: 1 },
_id: { type: String, _id: true },
remoteJid: { type: String, required: true, min: 1 },
id: { type: String, required: true, min: 1 },
fromMe: { type: Boolean, required: true },
participant: { type: String, min: 1 },
datetime: { type: Number, required: true, min: 1 },
status: { type: String, required: true },
owner: { type: String, required: true, min: 1 },
});
export const MessageUpModel = dbserver?.model(MessageUpdateRaw.name, messageUpdateSchema, 'messageUpdate');

View File

@@ -3,23 +3,23 @@ import { Schema } from 'mongoose';
import { dbserver } from '../../db/db.connect';
export class SettingsRaw {
_id?: string;
reject_call?: boolean;
msg_call?: string;
groups_ignore?: boolean;
always_online?: boolean;
read_messages?: boolean;
read_status?: boolean;
_id?: string;
reject_call?: boolean;
msg_call?: string;
groups_ignore?: boolean;
always_online?: boolean;
read_messages?: boolean;
read_status?: boolean;
}
const settingsSchema = new Schema<SettingsRaw>({
_id: { type: String, _id: true },
reject_call: { type: Boolean, required: true },
msg_call: { type: String, required: true },
groups_ignore: { type: Boolean, required: true },
always_online: { type: Boolean, required: true },
read_messages: { type: Boolean, required: true },
read_status: { type: Boolean, required: true },
_id: { type: String, _id: true },
reject_call: { type: Boolean, required: true },
msg_call: { type: String, required: true },
groups_ignore: { type: Boolean, required: true },
always_online: { type: Boolean, required: true },
read_messages: { type: Boolean, required: true },
read_status: { type: Boolean, required: true },
});
export const SettingsModel = dbserver?.model(SettingsRaw.name, settingsSchema, 'settings');

View File

@@ -3,19 +3,19 @@ import { Schema } from 'mongoose';
import { dbserver } from '../../db/db.connect';
export class WebhookRaw {
_id?: string;
url?: string;
enabled?: boolean;
events?: string[];
webhook_by_events?: boolean;
_id?: string;
url?: string;
enabled?: boolean;
events?: string[];
webhook_by_events?: boolean;
}
const webhookSchema = new Schema<WebhookRaw>({
_id: { type: String, _id: true },
url: { type: String, required: true },
enabled: { type: Boolean, required: true },
events: { type: [String], required: true },
webhook_by_events: { type: Boolean, required: true },
_id: { type: String, _id: true },
url: { type: String, required: true },
enabled: { type: Boolean, required: true },
events: { type: [String], required: true },
webhook_by_events: { type: Boolean, required: true },
});
export const WebhookModel = dbserver?.model(WebhookRaw.name, webhookSchema, 'webhook');