123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- const mongoose = require('mongoose');
- const { Schema, model, SchemaTypes } = mongoose;
- const mongoosePaginate = require('mongoose-paginate-v2');
- mongoose.Types.ObjectId.isValid();
- const messageSchema = new Schema(
- {
- message: {
- type: String,
- default: null,
- },
- replyMessage: {
- type: String,
- default: null,
- },
- forwardMessage: {
- type: String,
- default: null,
- },
- companionId: {
- type: String,
- default: null,
- },
- companionIdFlow: {
- type: String,
- default: null,
- },
- companionIdForwardToAndFrom: {
- type: String,
- default: null,
- },
- name: {
- type: String,
- default: null,
- },
- lastName: {
- type: String,
- default: null,
- },
- replyName: {
- type: String,
- default: null,
- },
- replyLastName: {
- type: String,
- default: null,
- },
- forwardName: {
- type: String,
- default: null,
- },
- forwardLastName: {
- type: String,
- default: null,
- },
- avatarUrl: {
- type: String,
- default: null,
- },
- color: {
- type: String,
- default: null,
- },
- number: {
- type: String,
- default: null,
- },
- type: {
- type: String,
- default: null,
- },
- fullType: {
- type: String,
- default: null,
- },
- idTime: {
- type: String,
- default: null,
- },
- oldId: {
- type: String,
- default: null,
- },
- caption: {
- type: String,
- default: null,
- },
- replyCaption: {
- type: String,
- default: null,
- },
- forwardCaption: {
- type: String,
- default: null,
- },
- emoji: {
- type: String,
- default: null,
- },
- emojiCompanion: {
- type: String,
- default: null,
- },
- pinned: {
- type: Boolean,
- default: false,
- },
- edited: {
- type: Boolean,
- default: false,
- },
- deleted: {
- type: Boolean,
- default: false,
- },
- initiator: {
- type: Boolean,
- default: false,
- },
- duration: {
- type: Number,
- default: null,
- },
- owner: {
- type: SchemaTypes.ObjectId,
- ref: 'user',
- },
- },
- { timestamps: true }
- );
- messageSchema.plugin(mongoosePaginate);
- const Message = model('message', messageSchema);
- module.exports = Message;
|