UNPKG

chatstorm

Version:

ChatStorm - Real-Time Chat Server for Your App. ChatStorm is a powerful, lightning-fast Socket.io-based chat server that enables seamless real-time messaging in your application. Whether you're building a messaging app, live chat feature, or a collaborati

39 lines (35 loc) 634 B
const mongoose = require("mongoose"); const ChatSchema = mongoose.Schema( { senderId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true, }, receiverId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true, }, lastMessage: { text: { type: String, }, media: { type: String, }, url: { type: String, }, }, isSeen: { type: Boolean, default: false, }, }, { timestamps: true, } ); const Chat = mongoose.model("Chat", ChatSchema); module.exports = Chat;