forked from jtr-dev/slash-hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigrate.js
More file actions
33 lines (31 loc) · 1.07 KB
/
migrate.js
File metadata and controls
33 lines (31 loc) · 1.07 KB
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
require("reflect-metadata");
const { duration } = require("moment");
const { container } = require("./dist/cjs/inversify.config");
const { TYPES } = require("./dist/cjs/types");
const oldState = require("./data/storage.json").lisaState;
container
.get(TYPES.PersistenceProvider)
.init()
.then(() =>
container.get(TYPES.LisaStateRepository).update({
status: {
water: oldState.status.water,
happiness: oldState.status.happiness,
},
birth: {
timestamp: new Date(oldState.life.time),
initiator: oldState.life.byUser,
},
death: {
timestamp:
oldState.death.time != null
? new Date(oldState.death.time)
: null,
initiator: oldState.death.byUser,
cause: oldState.death.cause,
},
bestLifetimeDuration: duration(oldState.bestLifetime),
})
)
.then(() => console.log("Done!"))
.catch(console.error);