Commit 59e26033 authored by Cédric Moreau's avatar Cédric Moreau

Cleaning dead code

parent 4229855e
var mongoose = require('mongoose');
var async = require('async');
var _ = require('underscore');
var Schema = mongoose.Schema;
var logger = require('../../app/lib/logger')('key model');
var CKeySchema = new Schema({
fingerprint: { type: String },
operation: { type: String },
algorithm: { type: String },
member: { type: Boolean, default: false },
count: { type: Number, default: 0 },
created: { type: Date, default: Date.now },
updated: { type: Date, default: Date.now }
});
CKeySchema.pre('save', function (next) {
this.updated = Date.now();
next();
});
CKeySchema.statics.increment = function(leaf, op, algo, isMember, done) {
var CKey = this;
async.waterfall([
function (next){
CKey.find({ fingerprint: leaf, operation: op, algorithm: algo, member: isMember }, next);
},
function (ckeys, next){
var ckey = ckeys[0] || new CKey({
fingerprint: leaf,
operation: op,
algorithm: algo,
member: isMember,
count: 0
});
ckey.count++;
ckey.save(function (err) {
next(err, ckey);
})
},
], done);
}
CKeySchema.statics.findThose = function(op, algo, isMember, done) {
this.find({ operation: op, algorithm: algo, member: isMember }, done);
}
module.exports = CKeySchema;
......@@ -168,7 +168,6 @@ function Server (dbConf, overrideConf, interceptors, onInit) {
'links',
'keys',
'keyblocks',
'ckeys',
'merkles',
'peers',
'publickeys',
......
......@@ -12,6 +12,8 @@ var test = require('./../tool/test');
var ucoin = require('./../..');
var logger = require('../../app/lib/logger')('test');
require('log4js').configure({});
var currency = "testo";
var tester = is = on = new test.tester(currency);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment