123456789101112131415161718192021222324252627282930313233343536 |
- function RunsDatastore() {
- 'use strict';
- // NOT PERSISTING RUNS
- // For the moment, maybe one day
- var runs = {};
- this.add = function(run) {
- runs[run._id] = run;
- };
- this.get = function(runId) {
- return runs[runId];
- };
-
- this.update = function(run) {
- runs[run._id] = run;
- };
- this.delete = function(runId) {
- delete runs[runId];
- };
- this.list = function() {
- var runsArray = [];
- Object.keys(runs).forEach(function(key) {
- runsArray.push(runs[key]);
- });
- return runsArray;
- };
- }
- module.exports = RunsDatastore;
|