|
@@ -0,0 +1,19 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+
|
|
|
+const Personchat = {
|
|
|
+ sender_id: { type: String, required: true, maxLength: 200 },
|
|
|
+ receiver_id: { type: String, required: true, maxLength: 200 },
|
|
|
+ personroom_id: { type: String, required: true, maxLength: 200 },
|
|
|
+ content: { type: String, required: true, maxLength: 1000 },
|
|
|
+ status: { type: String, required: false, maxLength: 100, default: "0" },
|
|
|
+};
|
|
|
+const schema = new Schema(Personchat, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model("Personchat", schema, "person_chat");
|
|
|
+};
|