/**
 * Created by Tony on 2016/12/23.
 */
var mongoose = require('mongoose');
var dbm = require("../../../config/db/db_manager");
var smartcostdb = dbm.getCfgConnection("Reports");
var Schema = mongoose.Schema;
var FontSchema = new Schema({
    "ID" : String,
    "Name" : String,
    "FontHeight" : String,
    "FontColor" : String,
    "FontBold" : String,
    "FontItalic" : String,
    "FontUnderline" : String,
    "FontStrikeOut" : String,
    "FontAngle" : String
});

var Font = smartcostdb.model("com_fonts", FontSchema, "com_fonts");

var FontDAO = function(){};

//根据id
FontDAO.prototype.get = function(id, callback){
    Font.find({ID: id}, '-_id', function(err, templates){
        if(templates.length){
            callback(false, templates[0]);
        }
        else{
            callback('no record was found！');
        }
    })
}

FontDAO.prototype.getAll = function(id, callback){
    Font.find({}, '-_id', function(err, templates){
        if(templates.length){
            callback(false, templates);
        }
        else{
            callback('no record was found！');
        }
    })
}

module.exports = new FontDAO();
