refactor(data-schemas): introduce new models and types for balance, conversation, message, and session

- Added new model files for Balance, Conversation, Message, and Session, enhancing modularity.
- Created corresponding type definitions for IBalance, IConversation, IMessage, and updated existing types.
- Refactored index files to export models from their individual files for better organization.
This commit is contained in:
Danny Avila 2025-05-30 02:13:35 -04:00
parent f6ca8caf7e
commit fa9177180f
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
14 changed files with 174 additions and 99 deletions

View file

@ -0,0 +1,16 @@
import mongoose from 'mongoose';
import mongoMeili from '~/models/plugins/mongoMeili';
import messageSchema from '~/schema/message';
import type * as t from '~/types';
if (process.env.MEILI_HOST && process.env.MEILI_MASTER_KEY) {
messageSchema.plugin(mongoMeili, {
host: process.env.MEILI_HOST,
apiKey: process.env.MEILI_MASTER_KEY,
indexName: 'messages',
primaryKey: 'messageId',
});
}
export const Message =
mongoose.models.Message || mongoose.model<t.IMessage>('Message', messageSchema);