{"id":16163304,"url":"https://github.com/gregorwolf/mtxs-reviews","last_synced_at":"2025-03-18T22:31:18.945Z","repository":{"id":219827139,"uuid":"749938088","full_name":"gregorwolf/mtxs-reviews","owner":"gregorwolf","description":"Multitenant CAP Reviews","archived":false,"fork":false,"pushed_at":"2024-09-10T15:10:51.000Z","size":677,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T12:44:51.973Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregorwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-29T17:29:50.000Z","updated_at":"2024-09-10T15:23:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"055ce509-a73e-4d36-a037-eaec12f46334","html_url":"https://github.com/gregorwolf/mtxs-reviews","commit_stats":null,"previous_names":["gregorwolf/mtxs-reviews"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-reviews","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-reviews/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-reviews/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-reviews/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregorwolf","download_url":"https://codeload.github.com/gregorwolf/mtxs-reviews/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243951025,"owners_count":20373668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T02:35:13.073Z","updated_at":"2025-03-18T22:31:18.656Z","avatar_url":"https://github.com/gregorwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multitenant CAP Reviews\n\nThis project demonstrates the integration to another CAP multitenant application using HANA Synonyms. The application providing the Books entity is [mtxs-bookshop](https://github.com/gregorwolf/mtxs-bookshop). The mtxs-bookshop defines HANA Roles ([BOOKSHOP.hdbrole](https://github.com/gregorwolf/mtxs-bookshop/blob/main/db/src/BOOKSHOP.hdbrole) and [BOOKSHOP_O.hdbrole](https://github.com/gregorwolf/mtxs-bookshop/blob/main/db/src/BOOKSHOP_O.hdbrole)) that allow this app to access the HANA Table `MY_BOOKSHOP_BOOKS`.\n\nTo achieve this functionality in a multitenant application we make use of a dynamically defined user provided service that gets its credentials from the service manager instance of the mtxs-bookshop app.\n\n![Architecture](./documentation/architecture.png)\n\n## Why\n\nYou might ask why to integrate two CAP applications in this way. Wouldn't an API based approach the better solution? I don't think so because as documented in [Limitations and Feature Matrix](https://cap.cloud.sap/docs/guides/using-services#limitations-and-feature-matrix) of the CAP documentation on [Consuming Services](https://cap.cloud.sap/docs/guides/using-services) there is quite an overhead in using the API based approach. It would require a lot of additional code in the handlers.\n\n## Setup\n\n### Local Development\n\n```\ncf create-service-key mtxs-reviews-db mtxs-reviews-db-key\n\ncds bind -2 mtxs-reviews-db\n```\n\nCopy the entry created by the previous command from the `.cdsrc-private.json` file as the following command will replace it:\n\n```\ncds bind -2 mtxs-bookshop-db\n```\n\nEdit `.cdsrc-private.json` and paste the backup. Replace \"name\": \"db\" with \"name\": \"mtxs-bookshop-db\" for the \"instance\": \"mtxs-bookshop-db\".\n\nTo avoid issues with a wrong binding selection make sure to [oversteer the default VCAP lookup](https://cap.cloud.sap/docs/releases/dec23#changes-in-node-js) by this configuration in `.cdsrc-private.json`:\n\n```\n        \"vcap\": {\n          \"name\": \"mtxs-reviews-db\",\n          \"label\": false\n        }\n\n\n        \"vcap\": {\n          \"name\": mtxs-bookshop-db\",\n          \"label\": false\n        }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fmtxs-reviews","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorwolf%2Fmtxs-reviews","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fmtxs-reviews/lists"}