Skip to content

Instantly share code, notes, and snippets.

@Brahyt
Created January 8, 2020 15:55
Show Gist options
  • Select an option

  • Save Brahyt/569a3c3cb32c2895ca419c5232704a48 to your computer and use it in GitHub Desktop.

Select an option

Save Brahyt/569a3c3cb32c2895ca419c5232704a48 to your computer and use it in GitHub Desktop.
return db.transaction(function (trx) {
return db('equipment_pack')
.transacting(trx)
.insert(epPayload)
.returning("*")
.then(response => {
return db('characters')
.transacting(trx)
.insert({
...newCharPayload,
equipment_pack_id: response[0].equipment_pack_id
})
.returning('*')
.then(response => {
return response[0]
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment