mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 20:49:15 +00:00
fix(adapter): corrections are made to the adapter
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
const Path = require('path')
|
const path = require('path')
|
||||||
const StormDB = require('stormdb')
|
const StormDB = require('stormdb')
|
||||||
const engine = new StormDB.localFileEngine(Path.join(__dirname, './db.stormdb'))
|
const engine = new StormDB.localFileEngine(
|
||||||
|
path.join(process.cwd(), './db.stormdb')
|
||||||
|
)
|
||||||
|
|
||||||
class JsonFileAdapter {
|
class JsonFileAdapter {
|
||||||
db
|
db
|
||||||
@@ -30,14 +32,13 @@ class JsonFileAdapter {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...result,
|
...result,
|
||||||
options: JSON.parse(result.options),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save = async (ctx) => {
|
save = async (ctx) => {
|
||||||
await this.db
|
await this.db
|
||||||
.get('history')
|
.get('history')
|
||||||
.push({ ...ctx, options: JSON.stringify(ctx.options) })
|
.push({ ...ctx })
|
||||||
.save()
|
.save()
|
||||||
console.log('Guardado en DB...', ctx)
|
console.log('Guardado en DB...', ctx)
|
||||||
this.listHistory.push(ctx)
|
this.listHistory.push(ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user