query for all data

This commit is contained in:
davidwells 2018-06-11 18:49:22 -07:00
parent fd5b183d00
commit 4c794b23f3
2 changed files with 11 additions and 4 deletions

View file

@ -10,9 +10,16 @@ exports.handler = (event, context, callback) => {
return client.query(q.Paginate(q.Match(q.Ref("indexes/all_todos"))))
.then((response) => {
console.log("success", response)
return callback(null, {
statusCode: 200,
body: JSON.stringify(response)
const newQuery = response.data.map((ref) => {
console.log('ref', ref)
return q.Get(ref)
})
// then query the refs
return client.query(newQuery).then((ret) => {
return callback(null, {
statusCode: 200,
body: JSON.stringify(ret)
})
})
}).catch((error) => {
console.log("error", error)