12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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,
- },
- companionId: {
- type: String,
- default: null,
- },
- companionIdFlow: {
- type: String,
- default: null,
- },
- name: {
- type: String,
- default: null,
- },
- lastName: {
- 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,
- },
- owner: {
- type: SchemaTypes.ObjectId,
- ref: 'user',
- },
- },
- { timestamps: true }
- );
- messageSchema.plugin(mongoosePaginate);
- const Message = model('message', messageSchema);
- module.exports = Message;
|