notherbase-fs 4.4.0 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,6 @@ import { stripHtml } from "string-strip-html";
|
|
|
3
3
|
import { success, fail } from "./util.js";
|
|
4
4
|
import User from "./user.js";
|
|
5
5
|
import fs from 'fs';
|
|
6
|
-
import { log } from "console";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* The spirit world is the API of a base.
|
|
@@ -146,7 +145,6 @@ export default class SpiritWorld {
|
|
|
146
145
|
|
|
147
146
|
// recall all spirits with the given service name and parent
|
|
148
147
|
let spirit = await req.db.Spirit.recallOne(req.body.service, parent, data, id);
|
|
149
|
-
console.log("loaded spirit ", spirit.memory);
|
|
150
148
|
|
|
151
149
|
res.send(spirit);
|
|
152
150
|
} catch (error) {
|
|
@@ -161,7 +159,6 @@ export default class SpiritWorld {
|
|
|
161
159
|
* @param {Object} res
|
|
162
160
|
*/
|
|
163
161
|
save = async (req, res) => {
|
|
164
|
-
console.log("saving spirit ");
|
|
165
162
|
try {
|
|
166
163
|
let parent = null;
|
|
167
164
|
let spiritData = req.body.data ? req.body.data : {};
|
|
@@ -181,7 +178,6 @@ export default class SpiritWorld {
|
|
|
181
178
|
let spirit = await req.db.Spirit.recallOne(req.body.service, parent, {}, id);
|
|
182
179
|
|
|
183
180
|
if (spirit) {
|
|
184
|
-
console.log("saving spirit ", spirit.memory.data, " with new data ", spiritData);
|
|
185
181
|
// update existing spirit
|
|
186
182
|
await spirit.commit({ ...spirit.memory.data, ...spiritData });
|
|
187
183
|
}
|
|
@@ -190,7 +186,7 @@ export default class SpiritWorld {
|
|
|
190
186
|
spirit = await req.db.Spirit.create(req.body.service, spiritData, parent);
|
|
191
187
|
}
|
|
192
188
|
|
|
193
|
-
res.send(
|
|
189
|
+
res.send(spirit.memory._id);
|
|
194
190
|
} catch (error) {
|
|
195
191
|
console.log(error);
|
|
196
192
|
fail(res, "Server error");
|