UNPKG

fridaybe

Version:
75 lines (71 loc) 1.63 kB
const mongoose = require('mongoose'); mongoose.set('useFindAndModify', false); mongoose.set('useNewUrlParser', true); mongoose.set('useCreateIndex', true); mongoose.set('useUnifiedTopology', true); var config=require('./config.js'); var ENV=process.env.ENV || 'DEV'; var conn = mongoose.createConnection(config[ENV]['mongoURI']); const Schema = mongoose.Schema; const templateSchema = new Schema({ name: String, content: String, category:{ type: String, default: 'root' }, tags: String, authorID: String }, {timestamps: true} ); Template = conn.model('Template',templateSchema); const authorSchema = new Schema({ NTID: { required: true, unique: true, type: String }, }, {timestamps: true} ); Author = conn.model('Author', authorSchema); const sysvarSchema = new Schema({ varname: { required: true, unique: true, type: String }, varval: { required: true, type: String } }, {timestamps: true} ); Sysvar = conn.model('Sysvar', sysvarSchema); const notificationcaseSchema = new Schema({ caseid: { required: true, type: String }, merchantflag: String, caseage: { required: true, type: String, }, casehref: String }, {timestamps: true} ); //Notificationcase = conn.model('Notificationcase', notificationcaseSchema); const notificationeventSchema = new Schema({ cases: { required: true, type: [notificationcaseSchema] }, }, {timestamps: true} ); Notificationevent = conn.model('Notificationevent', notificationeventSchema,'notificationqueue'); module.exports={Template, Author, Sysvar, Notificationevent};