123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /**
- * 用户数据结构
- *
- * @author CaiAoLin
- * @date 2017/6/28
- * @version
- */
- let mongoose = require("mongoose");
- let Schema = mongoose.Schema;
- // 表名
- let collectionName = 'user';
- const invalidSchema = new Schema({
- invalid: Boolean,
- invalidDate: String,
- invalidBy: String //管理者名
- });
- const versionSchema = new Schema({
- compilationId: String,
- activateCode: String,
- activatedDate: String,
- activatedBy: String,
- invalidInfo: [invalidSchema]
- });
- // 表结构
- let schema = {
- ssoId: Number,
- username: String,
- email: String,
- mobile: String,
- real_name: {
- type: String,
- default: ''
- },
- company: {
- type: String,
- default: ''
- },
- province: {
- type: Number,
- default: -1
- },
- version: {
- type: [versionSchema],
- default: []
- },
- company_type: {
- type: Number,
- default: -1,
- },
- company_scale: {
- type: Number,
- default: -1
- },
- create_time: Number
- };
- mongoose.model(collectionName, new Schema(schema, {versionKey: false}));
|