Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): backend tenant graphql resolvers #3234

Open
wants to merge 9 commits into
base: 2893/multi-tenancy-v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
50 changes: 50 additions & 0 deletions bruno/collections/Rafiki/Rafiki Admin APIs/Create Tenant.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
meta {
name: Create Tenant
type: graphql
seq: 54
}

post {
url: {{RafikiGraphqlHost}}/graphql
body: graphql
auth: none
}

body:graphql {
mutation CreateTenant($input: CreateTenantInput!) {
createTenant(input:$input) {
tenant {
id
email
apiSecret
idpConsentUrl
idpSecret
}
}
}
}

body:graphql:vars {
{
"input": {
"email": "[email protected]",
"apiSecret": "test-secret",
"idpConsentUrl": "https://example.com/consent",
"idpSecret": "test-idp-secret"
}
}
}

script:pre-request {
const scripts = require('./scripts');

scripts.addApiSignatureHeader();
}

script:post-response {
const body = res.getBody();

if (body?.data) {
bru.setEnvVar("tenantId", body.data.createTenant.tenant?.id);
}
}
31 changes: 31 additions & 0 deletions bruno/collections/Rafiki/Rafiki Admin APIs/Delete Tenant.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
meta {
name: Delete Tenant
type: graphql
seq: 56
}

post {
url: {{RafikiGraphqlHost}}/graphql
body: graphql
auth: none
}

body:graphql {
mutation DeleteTenant($id: String!) {
deleteTenant(id:$id) {
success
}
}
}

body:graphql:vars {
{
"id": "{{tenantId}}"
}
}

script:pre-request {
const scripts = require('./scripts');

scripts.addApiSignatureHeader();
}
43 changes: 43 additions & 0 deletions bruno/collections/Rafiki/Rafiki Admin APIs/Update Tenant.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: Update Tenant
type: graphql
seq: 55
}

post {
url: {{RafikiGraphqlHost}}/graphql
body: graphql
auth: none
}

body:graphql {
mutation UpdateTenant($input: UpdateTenantInput!) {
updateTenant(input:$input) {
tenant {
id
email
apiSecret
idpConsentUrl
idpSecret
}
}
}
}

body:graphql:vars {
{
"input": {
"id": "{{tenantId}}",
"email": "[email protected]",
"apiSecret": "updated-test-secret",
"idpConsentUrl": "https://example.com/consent-updated",
"idpSecret": "updated-test-idp-secret"
}
}
}

script:pre-request {
const scripts = require('./scripts');

scripts.addApiSignatureHeader();
}
1 change: 1 addition & 0 deletions bruno/collections/Rafiki/environments/Local Playground.bru
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ vars {
assetIdTigerBeetle: 1
assetCode: USD
assetScale: 2
senderTenantId: 438fa74a-fa7d-4317-9ced-dde32ece1787
}
1 change: 1 addition & 0 deletions bruno/collections/Rafiki/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const scripts = {
signature = this.generateBackendApiSignature(formattedBody)
}
req.setHeader('signature', signature)
req.setHeader('tenant-id', bru.getEnvVar('senderTenantId'))
},

addHostHeader: function (hostVarName) {
Expand Down
Loading
Loading