@armi-wave/common 1.23.37 → 1.23.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/enums/chat/ChatSocketEvents.d.ts +16 -0
- package/build/enums/chat/ChatSocketEvents.js +23 -0
- package/build/enums/chat/ConversationType.d.ts +4 -0
- package/build/enums/chat/ConversationType.js +8 -0
- package/build/enums/chat/MessageStatus.d.ts +5 -0
- package/build/enums/chat/MessageStatus.js +9 -0
- package/build/enums/chat/MessageType.d.ts +7 -0
- package/build/enums/chat/MessageType.js +11 -0
- package/build/index.d.ts +7 -0
- package/build/index.js +13 -1
- package/build/models/chat/Conversation.d.ts +22 -0
- package/build/models/chat/Conversation.js +83 -0
- package/build/models/chat/Message.d.ts +29 -0
- package/build/models/chat/Message.js +114 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum ChatSocketEvents {
|
|
2
|
+
JOIN_ROOMS = "join_rooms",
|
|
3
|
+
SEND_MESSAGE = "send_message",
|
|
4
|
+
TYPING_START = "typing_start",
|
|
5
|
+
TYPING_STOP = "typing_stop",
|
|
6
|
+
MARK_DELIVERED = "mark_delivered",
|
|
7
|
+
MARK_READ = "mark_read",
|
|
8
|
+
NEW_MESSAGE = "new_message",
|
|
9
|
+
MESSAGE_STATUS = "message_status",
|
|
10
|
+
TYPING = "typing",
|
|
11
|
+
MESSAGE_DELETED = "message_deleted",
|
|
12
|
+
ERROR = "error",
|
|
13
|
+
CONNECT = "connect",
|
|
14
|
+
DISCONNECT = "disconnect",
|
|
15
|
+
CONNECT_ERROR = "connect_error"
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatSocketEvents = void 0;
|
|
4
|
+
var ChatSocketEvents;
|
|
5
|
+
(function (ChatSocketEvents) {
|
|
6
|
+
// Client -> Server
|
|
7
|
+
ChatSocketEvents["JOIN_ROOMS"] = "join_rooms";
|
|
8
|
+
ChatSocketEvents["SEND_MESSAGE"] = "send_message";
|
|
9
|
+
ChatSocketEvents["TYPING_START"] = "typing_start";
|
|
10
|
+
ChatSocketEvents["TYPING_STOP"] = "typing_stop";
|
|
11
|
+
ChatSocketEvents["MARK_DELIVERED"] = "mark_delivered";
|
|
12
|
+
ChatSocketEvents["MARK_READ"] = "mark_read";
|
|
13
|
+
// Server -> Client
|
|
14
|
+
ChatSocketEvents["NEW_MESSAGE"] = "new_message";
|
|
15
|
+
ChatSocketEvents["MESSAGE_STATUS"] = "message_status";
|
|
16
|
+
ChatSocketEvents["TYPING"] = "typing";
|
|
17
|
+
ChatSocketEvents["MESSAGE_DELETED"] = "message_deleted";
|
|
18
|
+
ChatSocketEvents["ERROR"] = "error";
|
|
19
|
+
// Connection
|
|
20
|
+
ChatSocketEvents["CONNECT"] = "connect";
|
|
21
|
+
ChatSocketEvents["DISCONNECT"] = "disconnect";
|
|
22
|
+
ChatSocketEvents["CONNECT_ERROR"] = "connect_error";
|
|
23
|
+
})(ChatSocketEvents || (exports.ChatSocketEvents = ChatSocketEvents = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConversationType = void 0;
|
|
4
|
+
var ConversationType;
|
|
5
|
+
(function (ConversationType) {
|
|
6
|
+
ConversationType["Direct"] = "direct";
|
|
7
|
+
ConversationType["Group"] = "group";
|
|
8
|
+
})(ConversationType || (exports.ConversationType = ConversationType = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageStatus = void 0;
|
|
4
|
+
var MessageStatus;
|
|
5
|
+
(function (MessageStatus) {
|
|
6
|
+
MessageStatus["Sent"] = "sent";
|
|
7
|
+
MessageStatus["Delivered"] = "delivered";
|
|
8
|
+
MessageStatus["Read"] = "read";
|
|
9
|
+
})(MessageStatus || (exports.MessageStatus = MessageStatus = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageType = void 0;
|
|
4
|
+
var MessageType;
|
|
5
|
+
(function (MessageType) {
|
|
6
|
+
MessageType["Text"] = "text";
|
|
7
|
+
MessageType["Image"] = "image";
|
|
8
|
+
MessageType["File"] = "file";
|
|
9
|
+
MessageType["Voice"] = "voice";
|
|
10
|
+
MessageType["SharedPost"] = "shared_post";
|
|
11
|
+
})(MessageType || (exports.MessageType = MessageType = {}));
|
package/build/index.d.ts
CHANGED
|
@@ -15,6 +15,13 @@ import PostReplyDownvote from './models/PostReplyDownvote';
|
|
|
15
15
|
import TextPostUpvote from './models/TextPostUpvote';
|
|
16
16
|
import TextPostDownvote from './models/TextPostDownvote';
|
|
17
17
|
import VideoPostLike from './models/VideoPostLike';
|
|
18
|
+
export { default as Conversation } from './models/chat/Conversation';
|
|
19
|
+
export { default as Message } from './models/chat/Message';
|
|
20
|
+
export { ChatSocketEvents } from './enums/chat/ChatSocketEvents';
|
|
21
|
+
export { ConversationType } from './enums/chat/ConversationType';
|
|
22
|
+
export { MessageStatus } from './enums/chat/MessageStatus';
|
|
23
|
+
export { MessageType } from './enums/chat/MessageType';
|
|
24
|
+
export type { SharedPost } from './models/chat/Message';
|
|
18
25
|
import BadRequestError from './errors/bad-request-error';
|
|
19
26
|
import DatabaseConnectionError from './errors/database-connection-error';
|
|
20
27
|
import CustomError from './errors/custom-error';
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.createUploadMiddleware = exports.textPostMiddleware = exports.videoMiddleware = exports.imageMiddleware = exports.MongoDBs = exports.ensureBucketExists = exports.minioClient = exports.RequestValidationError = exports.NotFoundError = exports.NotAuthorizedError = exports.CustomError = exports.DatabaseConnectionError = exports.BadRequestError = exports.VideoPostLike = exports.TextPostDownvote = exports.TextPostUpvote = exports.PostReplyDownvote = exports.PostReplyUpvote = exports.PostReplyLike = exports.PostCommentDownvote = exports.PostCommentUpvote = exports.PostCommentLike = exports.Like = exports.Follow = exports.Reply = exports.Comment = exports.VideoPost = exports.TextPost = exports.Post = exports.User = void 0;
|
|
20
|
+
exports.createUploadMiddleware = exports.textPostMiddleware = exports.videoMiddleware = exports.imageMiddleware = exports.MongoDBs = exports.ensureBucketExists = exports.minioClient = exports.RequestValidationError = exports.NotFoundError = exports.NotAuthorizedError = exports.CustomError = exports.DatabaseConnectionError = exports.BadRequestError = exports.VideoPostLike = exports.TextPostDownvote = exports.TextPostUpvote = exports.PostReplyDownvote = exports.PostReplyUpvote = exports.PostReplyLike = exports.PostCommentDownvote = exports.PostCommentUpvote = exports.PostCommentLike = exports.Like = exports.Follow = exports.Reply = exports.Comment = exports.VideoPost = exports.TextPost = exports.Post = exports.User = exports.MessageType = exports.MessageStatus = exports.ConversationType = exports.ChatSocketEvents = exports.Message = exports.Conversation = void 0;
|
|
21
21
|
const User_1 = __importDefault(require("./models/User"));
|
|
22
22
|
exports.User = User_1.default;
|
|
23
23
|
const Post_1 = __importDefault(require("./models/Post"));
|
|
@@ -52,6 +52,18 @@ const TextPostDownvote_1 = __importDefault(require("./models/TextPostDownvote"))
|
|
|
52
52
|
exports.TextPostDownvote = TextPostDownvote_1.default;
|
|
53
53
|
const VideoPostLike_1 = __importDefault(require("./models/VideoPostLike"));
|
|
54
54
|
exports.VideoPostLike = VideoPostLike_1.default;
|
|
55
|
+
var Conversation_1 = require("./models/chat/Conversation");
|
|
56
|
+
Object.defineProperty(exports, "Conversation", { enumerable: true, get: function () { return __importDefault(Conversation_1).default; } });
|
|
57
|
+
var Message_1 = require("./models/chat/Message");
|
|
58
|
+
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return __importDefault(Message_1).default; } });
|
|
59
|
+
var ChatSocketEvents_1 = require("./enums/chat/ChatSocketEvents");
|
|
60
|
+
Object.defineProperty(exports, "ChatSocketEvents", { enumerable: true, get: function () { return ChatSocketEvents_1.ChatSocketEvents; } });
|
|
61
|
+
var ConversationType_1 = require("./enums/chat/ConversationType");
|
|
62
|
+
Object.defineProperty(exports, "ConversationType", { enumerable: true, get: function () { return ConversationType_1.ConversationType; } });
|
|
63
|
+
var MessageStatus_1 = require("./enums/chat/MessageStatus");
|
|
64
|
+
Object.defineProperty(exports, "MessageStatus", { enumerable: true, get: function () { return MessageStatus_1.MessageStatus; } });
|
|
65
|
+
var MessageType_1 = require("./enums/chat/MessageType");
|
|
66
|
+
Object.defineProperty(exports, "MessageType", { enumerable: true, get: function () { return MessageType_1.MessageType; } });
|
|
55
67
|
const bad_request_error_1 = __importDefault(require("./errors/bad-request-error"));
|
|
56
68
|
exports.BadRequestError = bad_request_error_1.default;
|
|
57
69
|
const database_connection_error_1 = __importDefault(require("./errors/database-connection-error"));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import mongoose, { Document, Model } from 'mongoose';
|
|
2
|
+
import { ConversationType } from '../../enums/chat/ConversationType';
|
|
3
|
+
interface LastMessage {
|
|
4
|
+
content: string;
|
|
5
|
+
senderId: mongoose.Types.ObjectId;
|
|
6
|
+
timestamp: Date;
|
|
7
|
+
}
|
|
8
|
+
interface UnreadCount {
|
|
9
|
+
[userId: string]: number;
|
|
10
|
+
}
|
|
11
|
+
interface Conversation extends Document {
|
|
12
|
+
participants: mongoose.Types.ObjectId[];
|
|
13
|
+
type: ConversationType;
|
|
14
|
+
lastMessage?: LastMessage;
|
|
15
|
+
unreadCount: UnreadCount;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
interface ConversationModel extends Model<Conversation> {
|
|
20
|
+
}
|
|
21
|
+
declare const Conversation: ConversationModel;
|
|
22
|
+
export default Conversation;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
37
|
+
const ConversationType_1 = require("../../enums/chat/ConversationType");
|
|
38
|
+
const conversationSchema = new mongoose_1.Schema({
|
|
39
|
+
participants: {
|
|
40
|
+
type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true }],
|
|
41
|
+
required: true,
|
|
42
|
+
validate: {
|
|
43
|
+
validator: function (v) {
|
|
44
|
+
return v.length >= 2;
|
|
45
|
+
},
|
|
46
|
+
message: 'Conversation must have at least 2 participants',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
type: {
|
|
50
|
+
type: String,
|
|
51
|
+
enum: Object.values(ConversationType_1.ConversationType),
|
|
52
|
+
required: true,
|
|
53
|
+
default: ConversationType_1.ConversationType.Direct,
|
|
54
|
+
},
|
|
55
|
+
lastMessage: {
|
|
56
|
+
content: { type: String, required: true },
|
|
57
|
+
senderId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true },
|
|
58
|
+
timestamp: { type: Date, required: true },
|
|
59
|
+
},
|
|
60
|
+
unreadCount: {
|
|
61
|
+
type: Map,
|
|
62
|
+
of: Number,
|
|
63
|
+
default: {},
|
|
64
|
+
},
|
|
65
|
+
}, {
|
|
66
|
+
timestamps: true,
|
|
67
|
+
toJSON: {
|
|
68
|
+
transform(doc, ret) {
|
|
69
|
+
ret.id = ret._id;
|
|
70
|
+
delete ret._id;
|
|
71
|
+
delete ret.__v;
|
|
72
|
+
// Convert unreadCount Map to object
|
|
73
|
+
if (ret.unreadCount instanceof Map) {
|
|
74
|
+
ret.unreadCount = Object.fromEntries(ret.unreadCount);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
// Indexes
|
|
80
|
+
conversationSchema.index({ participants: 1, updatedAt: -1 });
|
|
81
|
+
conversationSchema.index({ participants: 1 });
|
|
82
|
+
const Conversation = mongoose_1.default.model('Conversation', conversationSchema);
|
|
83
|
+
exports.default = Conversation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import mongoose, { Document, Model } from 'mongoose';
|
|
2
|
+
import { MessageStatus } from '../../enums/chat/MessageStatus';
|
|
3
|
+
import { MessageType } from '../../enums/chat/MessageType';
|
|
4
|
+
export interface SharedPost {
|
|
5
|
+
postId: mongoose.Types.ObjectId;
|
|
6
|
+
postModel: 'Post' | 'TextPost' | 'VideoPost';
|
|
7
|
+
postType: string;
|
|
8
|
+
contentUrl?: string;
|
|
9
|
+
caption: string;
|
|
10
|
+
username: string;
|
|
11
|
+
profilePicUrl: string;
|
|
12
|
+
}
|
|
13
|
+
interface Message extends Document {
|
|
14
|
+
conversationId: mongoose.Types.ObjectId;
|
|
15
|
+
senderId: mongoose.Types.ObjectId;
|
|
16
|
+
content: string;
|
|
17
|
+
type: MessageType;
|
|
18
|
+
contentUrl?: string[];
|
|
19
|
+
status: MessageStatus;
|
|
20
|
+
readBy: mongoose.Types.ObjectId[];
|
|
21
|
+
deletedFor: mongoose.Types.ObjectId[];
|
|
22
|
+
sharedPost?: SharedPost;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
}
|
|
26
|
+
interface MessageModel extends Model<Message> {
|
|
27
|
+
}
|
|
28
|
+
declare const Message: MessageModel;
|
|
29
|
+
export default Message;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
37
|
+
const MessageStatus_1 = require("../../enums/chat/MessageStatus");
|
|
38
|
+
const MessageType_1 = require("../../enums/chat/MessageType");
|
|
39
|
+
const messageSchema = new mongoose_1.Schema({
|
|
40
|
+
conversationId: {
|
|
41
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
42
|
+
ref: 'Conversation',
|
|
43
|
+
required: true,
|
|
44
|
+
index: true,
|
|
45
|
+
},
|
|
46
|
+
senderId: {
|
|
47
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
48
|
+
ref: 'User',
|
|
49
|
+
required: true,
|
|
50
|
+
index: true,
|
|
51
|
+
},
|
|
52
|
+
content: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
trim: true,
|
|
56
|
+
default: '', // Can be empty if just sending media
|
|
57
|
+
},
|
|
58
|
+
type: {
|
|
59
|
+
type: String,
|
|
60
|
+
enum: Object.values(MessageType_1.MessageType),
|
|
61
|
+
required: true,
|
|
62
|
+
default: MessageType_1.MessageType.Text,
|
|
63
|
+
},
|
|
64
|
+
contentUrl: {
|
|
65
|
+
// ← Media URL
|
|
66
|
+
type: [String],
|
|
67
|
+
default: [],
|
|
68
|
+
},
|
|
69
|
+
status: {
|
|
70
|
+
type: String,
|
|
71
|
+
enum: Object.values(MessageStatus_1.MessageStatus),
|
|
72
|
+
required: true,
|
|
73
|
+
default: MessageStatus_1.MessageStatus.Sent,
|
|
74
|
+
},
|
|
75
|
+
readBy: {
|
|
76
|
+
type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'User' }],
|
|
77
|
+
default: [],
|
|
78
|
+
},
|
|
79
|
+
deletedFor: {
|
|
80
|
+
type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'User' }],
|
|
81
|
+
default: [],
|
|
82
|
+
},
|
|
83
|
+
sharedPost: {
|
|
84
|
+
postId: {
|
|
85
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
86
|
+
required: false,
|
|
87
|
+
refPath: 'sharedPost.postModel',
|
|
88
|
+
},
|
|
89
|
+
postModel: {
|
|
90
|
+
type: String,
|
|
91
|
+
required: false,
|
|
92
|
+
enum: ['Post', 'TextPost', 'VideoPost'],
|
|
93
|
+
},
|
|
94
|
+
postType: { type: String, required: false },
|
|
95
|
+
contentUrl: { type: String, required: false },
|
|
96
|
+
caption: { type: String, required: false, default: '' },
|
|
97
|
+
username: { type: String, required: false },
|
|
98
|
+
profilePicUrl: { type: String, required: false, default: '' },
|
|
99
|
+
},
|
|
100
|
+
}, {
|
|
101
|
+
timestamps: true,
|
|
102
|
+
toJSON: {
|
|
103
|
+
transform(doc, ret) {
|
|
104
|
+
ret.id = ret._id;
|
|
105
|
+
delete ret._id;
|
|
106
|
+
delete ret.__v;
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
// Compound indexes for efficient queries
|
|
111
|
+
messageSchema.index({ conversationId: 1, createdAt: -1 });
|
|
112
|
+
messageSchema.index({ conversationId: 1, status: 1 });
|
|
113
|
+
const Message = mongoose_1.default.model('Message', messageSchema);
|
|
114
|
+
exports.default = Message;
|