/**
 * Created by jimiz on 2017/5/19.
 */
let mongoose = require('mongoose');
let propertyDetailSchema = new mongoose.Schema({
    key: String,
    dispName: String,
    value: String
});

let prj_property = new mongoose.Schema({
    projectID: Number,
    properties: Array  //原则上是应该设置好对象的属性，但在实际应用中发现mongoose保存的时候会自动增加objectId（_id）字段，无语。。。
    // properties: [{
    //     key: String,
    //     dispName: String,
    //     value: String
    // }]
}, {versionKey: false});

//预储存的项目属性，在项目创建的时候copy一份到项目中
let cfg_property = new mongoose.Schema({
    rationLibID: Number,      //这个对应标准定额库ID
    descr: String,      //描述
    properties: [propertyDetailSchema]
}, {versionKey: false});

mongoose.model('project_property', prj_property, 'prj_properties');
mongoose.model('cfg_prj_property', cfg_property, 'std_cfg_prj_properties');

