DTP Social Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
1.0 KiB

// chat-message.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
/*
* The intent is for forked apps to give meaning to "channel" in their
* apps. Set the channelType to the name of your channel model, and set
* channel to the _id of the channel. The model will then correctly populate.
*/
const ChatMessageSchema = new Schema({
created: { type: Date, default: Date.now, required: true, index: -1 },
channelType: { type: String },
channel: { type: Schema.ObjectId, refPath: 'channelType' },
authorType: { type: String, enum: ['User', 'CoreUser'], required: true },
author: { type: Schema.ObjectId, required: true, index: 1, refPath: 'authorType' },
content: { type: String, maxlength: 1000 },
analysis: {
similarity: { type: Number },
},
stickers: { type: [String] },
attachments: { type: [Schema.ObjectId], ref: 'Attachment' },
});
module.exports = mongoose.model('ChatMessage', ChatMessageSchema);