refactor(io): added new method addChild

This commit is contained in:
Leifer Mendez
2022-11-30 21:04:45 +01:00
18 changed files with 9863 additions and 15 deletions

View File

@@ -25,6 +25,28 @@ const main = async () => {
}
```
#### CTX
```json
{
ref: 'ans_7d9981e5-5019-422c-a19a-565cbb021391',
keyword: 'ans_cfdad31b-ff6d-475f-873a-4ed6f8a79a43',
answer: 'Esperando respuesta...',
options: {
media: null,
buttons: [],
capture: true,
child: null,
nested: [Array],
keyword: {},
callback: true
},
refSerialize: '81f18f563fd26a6c6d12c62aed98095f',
from: 'NUMERO_PERSONA_QUE_ESCRIBE'
}
```
#### Video
> Video explicando como debes de agregar nuevos adaptadores

View File

@@ -1,15 +1,20 @@
/**
* Si necesitas saber que trae el "ctx"
* Puedes ver el README.md dentro packages/database
*/
class MockDatabase {
db
listHistory = []
constructor() {
/**
* Se debe cargar listHistory con historial de mensajes
* para que se pueda continuar el flow
*/
constructor() {}
getPrevByNumber = (from) => {
const history = this.listHistory.slice().reverse()
return history.find((a) => a.from === from)
}
save = (ctx) => {
console.log('Guardando DB...', ctx)
this.listHistory.push(ctx)
}
}