forked from mlndz28/time-tracker-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbMigrations.js
More file actions
42 lines (34 loc) · 992 Bytes
/
Copy pathdbMigrations.js
File metadata and controls
42 lines (34 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var migrateToV2 = exports.migrateToV2 = function migrateToV2(tasks) {
var promises = [];
var migrate = function migrate(key, task) {
return new Promise(function (resolve, reject) {
var timing = {};
var update = false;
if (task.start) {
update = true;
timing.start = task.start;
delete task.start;
}
if (task.stop) {
timing.stop = task.stop;
delete task.stop;
}
if (update) {
task.timings = [timing];
}
resolve({
key: key,
task: task
});
});
};
Object.keys(tasks).forEach(function (k) {
return promises.push(migrate(k, tasks[k]));
});
return Promise.all(promises);
};
//# sourceMappingURL=dbMigrations.js.map