feat: db uses asynclocalstorage set schema

feat: set user input related header in public route requests to identify schema
fix: small fixes
This commit is contained in:
Sérgio Salgado 2021-09-22 19:21:00 +01:00
parent 7135a03654
commit 990ab32583
10 changed files with 58 additions and 15 deletions

View file

@ -38,7 +38,10 @@ const _task = (obj, opts, cb) => {
})
}
const getSchema = () => 'public'
const getSchema = () => {
const store = asyncLocalStorage.getStore() ?? defaultStore()
return asyncLocalStorage.run(store, () => store.get('schema'))
}
const getDefaultSchema = () => 'ERROR_SCHEMA'
const searchPathWrapper = (t, cb) => {