Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

add user schema switching #113

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ All notable changes to this project will be documented in this file. See [standa

- mapcf username to pg user ([#10](https://github.com/sapmentors/cds-pg/issues/10)) ([d00a6d8](https://github.com/sapmentors/cds-pg/commit/d00a6d8e60ab85c7826ac640aa87e2aafcf914ac))
- **hana:** env var pointing to dbcapi ([b6b4921](https://github.com/sapmentors/cds-pg/commit/b6b49214a47ba805bf7aa6d1ba616200d837e1db))
- **pool:** release client back to pool correctly ([8027952](https://github.com/sapmentors/cds-pg/commit/8027952a5605cd268b55c4de176bb52da21d947b))
- **pool:** release client back to pool correctly ([8027952](https://github.com/sapmentors/cds-pg/commit/8027952a5605cd268b55c4de176bb52da21d947b))
7 changes: 7 additions & 0 deletions __tests__/__assets__/cap-proj/srv/beershop-service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const cds = require('@sap/cds')
const standardVersion = require('standard-version')
module.exports = (srv) => {
srv.on('reset', async () => {
let db
Expand All @@ -9,4 +10,10 @@ module.exports = (srv) => {
}
await cds.deploy('./srv/', {}).to(db)
})

srv.before('READ', '*', async (req) => {
if (req.headers.schema) {
req.user.schema = req.headers.schema;
}
});
}
Loading