/**
 * Created by Mai on 2017/9/14.
 */

let baseModel = require('./base_model');
import {default as projSettingSchema, collectionName as collectionName} from "./schemas/proj_setting";

class projSettingModel extends baseModel {

    constructor() {
        super(projSettingSchema);
        this.collectionName = collectionName;
    }

    getData (projectID, callback) {
        this.model.findOne({"projectID": projectID}, '-_id', function (err, result) {
            if (!err) {
                callback(0, collectionName, result);
            } else {
                callback(1, '查询数据失败。', null);
            }
        });
    };

    save (user_id, data, callback) {
        this.model.update({"projectID": data.projectID}, data, callback);
    };
}

module.exports = new projSettingModel();