moved db-model-schemata, adjust user-model
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
//const Schema = mongoose.Schema,
|
||||
//ObjectId = Schema.ObjectId;
|
||||
|
||||
const MessageSchema = mongoose.Schema({
|
||||
subject: { type: String, required: true },
|
||||
message: { type: String, required: true },
|
||||
user: { type: String, required: true },
|
||||
tag: [{type: String }],
|
||||
//createtime: { type: Date, default: Date.now },
|
||||
});
|
||||
MessageSchema.index({tag:'text'});
|
||||
|
||||
module.exports = mongoose.model('Message', MessageSchema);
|
||||
@@ -0,0 +1,8 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
|
||||
const TagSchema = mongoose.Schema({
|
||||
name: { type: String, required: true }, //unique
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Tag', TagSchema);
|
||||
@@ -0,0 +1,21 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
|
||||
const UserSchema = mongoose.Schema({
|
||||
// _id: { type: String },
|
||||
name: { type: String, required: true },
|
||||
pwd: { type: String },
|
||||
// hash: { type: String },
|
||||
// salt: { type: String },
|
||||
// type: { type: String },
|
||||
roles: { type: [String], required: true },
|
||||
tags: { type: [String] },
|
||||
// deactivated: { type: Boolean },
|
||||
// participating: { type: [String] },
|
||||
// host: { type: Boolean },
|
||||
bookmarks: { type: [String] },
|
||||
});
|
||||
//tags as index:
|
||||
//UserSchema.index({tags:'text'});
|
||||
|
||||
module.exports = mongoose.model('User', UserSchema);
|
||||
Reference in New Issue
Block a user