'use strict';

const model = require('./../model');
const Model = model.getSeqIdAggregated();

exports.getLastSeqIds = function (name) {
    return Model.findById(name).exec();
};

exports.setSeqIds = function(name, seqIds) {

    return Model.findByIdAndUpdate(name, seqIds, {new: true, upsert: true})
        .exec()
        .then(result => result.seq);
};

exports.clear = function () {
    return Model.remove({});
};

@@ -168,16 +168,99 @@
 ).exec()
+.then(result =%3E %7B%0A        if(result) return result.seq;%0A        return null;%0A    %7D)
 ;%0A%7D;%0A%0Aex
@@ -302,17 +302,16 @@
 qIds) %7B%0A
-%0A
     retu
@@ -342,23 +342,30 @@
 te(name,
+ %7Bseq:
  seqIds
+%7D
 , %7Bnew: 

fix getLastSeqIds