-
Notifications
You must be signed in to change notification settings - Fork 102
feat(2915): admin front-end for tenant support #3254
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
99d6982
feat: backend tenant graphql resolvers
njlie 344e21a
chore: formatting
njlie 657780f
fix: extra testing db for tenants
njlie 3ce9128
feat: bruno collection
njlie 15cb387
feat: update graphql schema comments
njlie 4aafebb
fix: review comments
njlie 9072e02
feat: optional idp secret & consent url
njlie e4a6e6c
feat: tenant response requirement
njlie 45dcb5b
feat: make delete operator-only
njlie 59d4638
Merge branch 'nl/3124/backend-tenant-resolvers' into issues/2915-mt-f…
koekiebox 993e4c4
feat(2915): admin front-end for tenant support
koekiebox ac04fa6
feat(2915): apply permissions for tenant screens
koekiebox 9cd9899
feat(2915): improvements
koekiebox 8bc7d7f
chore: cleanup
njlie b7ea593
Merge branch 'nl/3124/backend-tenant-resolvers' into issues/2915-mt-f…
koekiebox ef3601f
Merge branch '2893/multi-tenancy-v1' into issues/2915-mt-frontend
koekiebox 4de527d
feat(2915): merged with tenant branch. updates to update screen.
koekiebox 3258767
feat(2915): update fixes.
koekiebox cc03979
Merge branch '2893/multi-tenancy-v1' into issues/2915-mt-frontend
koekiebox 8f78849
feat(3180): bug fixes and testing with non operator tenant.
koekiebox ae76925
feat(3180): bug fixes and testing with non operator tenant.
koekiebox 719bb18
Merge branch '2893/multi-tenancy-v1' into issues/2915-mt-frontend
koekiebox e718b64
feat(2915): review feedback
koekiebox f90efd0
feat(2915): fix update. field validation for email.
koekiebox 267ef6c
feat(2915): formatting.
koekiebox f15bad3
feat(2915): fix.
koekiebox 970fcbf
feat(2915): review fixes.
koekiebox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,184 @@ | ||
| import { gql } from '@apollo/client' | ||
| import type { | ||
| CreateTenantInput, | ||
| CreateTenantMutation, | ||
| UpdateTenantMutationVariables, | ||
| UpdateTenantInput, | ||
| UpdateTenantMutation, | ||
| CreateTenantMutationVariables, | ||
| QueryTenantsArgs, | ||
| ListTenantsQuery, | ||
| ListTenantsQueryVariables, | ||
| DeleteTenantMutationVariables, | ||
| DeleteTenantMutation, | ||
| QueryTenantArgs, | ||
| GetTenantQuery, | ||
| GetTenantQueryVariables | ||
| } from '~/generated/graphql' | ||
| import { getApolloClient } from '../apollo.server' | ||
|
|
||
| export const listTenants = async (request: Request, args: QueryTenantsArgs) => { | ||
| const apolloClient = await getApolloClient(request) | ||
| const response = await apolloClient.query< | ||
| ListTenantsQuery, | ||
| ListTenantsQueryVariables | ||
| >({ | ||
| query: gql` | ||
| query ListTenantsQuery( | ||
| $after: String | ||
| $before: String | ||
| $first: Int | ||
| $last: Int | ||
| ) { | ||
| tenants(after: $after, before: $before, first: $first, last: $last) { | ||
| edges { | ||
| node { | ||
| id | ||
| apiSecret | ||
| idpConsentUrl | ||
| idpSecret | ||
| publicName | ||
| createdAt | ||
| deletedAt | ||
| } | ||
| } | ||
| pageInfo { | ||
| startCursor | ||
| endCursor | ||
| hasNextPage | ||
| hasPreviousPage | ||
| } | ||
| } | ||
| } | ||
| `, | ||
| variables: args | ||
| }) | ||
| return response.data.tenants | ||
| } | ||
|
|
||
| export const createTenant = async ( | ||
| request: Request, | ||
| args: CreateTenantInput | ||
| ) => { | ||
| const apolloClient = await getApolloClient(request) | ||
| const response = await apolloClient.mutate< | ||
| CreateTenantMutation, | ||
| CreateTenantMutationVariables | ||
| >({ | ||
| mutation: gql` | ||
| mutation CreateTenantMutation($input: CreateTenantInput!) { | ||
| createTenant(input: $input) { | ||
| tenant { | ||
| id | ||
| publicName | ||
| apiSecret | ||
| idpConsentUrl | ||
| idpSecret | ||
| } | ||
| } | ||
| } | ||
| `, | ||
| variables: { | ||
| input: args | ||
| } | ||
| }) | ||
|
|
||
| return response.data?.createTenant | ||
| } | ||
|
|
||
| export const updateTenant = async ( | ||
| request: Request, | ||
| args: UpdateTenantInput | ||
| ) => { | ||
| const apolloClient = await getApolloClient(request) | ||
| const response = await apolloClient.mutate< | ||
| UpdateTenantMutation, | ||
| UpdateTenantMutationVariables | ||
| >({ | ||
| mutation: gql` | ||
| mutation UpdateTenantMutation($input: UpdateTenantInput!) { | ||
| updateTenant(input: $input) { | ||
| tenant { | ||
| id | ||
| apiSecret | ||
| idpConsentUrl | ||
| idpSecret | ||
| publicName | ||
| } | ||
| } | ||
| } | ||
| `, | ||
| variables: { | ||
| input: args | ||
| } | ||
| }) | ||
|
|
||
| return response.data?.updateTenant | ||
| } | ||
|
|
||
| export const deleteTenant = async (request: Request, args: string) => { | ||
| const apolloClient = await getApolloClient(request) | ||
| const response = await apolloClient.mutate< | ||
| DeleteTenantMutation, | ||
| DeleteTenantMutationVariables | ||
| >({ | ||
| mutation: gql` | ||
| mutation DeleteTenantMutation($id: String!) { | ||
| deleteTenant(id: $id) { | ||
| success | ||
| } | ||
| } | ||
| `, | ||
| variables: { | ||
| id: args | ||
| } | ||
| }) | ||
|
|
||
| return response.data?.deleteTenant | ||
| } | ||
|
|
||
| export const getTenantInfo = async ( | ||
| request: Request, | ||
| args: QueryTenantArgs | ||
| ) => { | ||
| const apolloClient = await getApolloClient(request) | ||
| const response = await apolloClient.query< | ||
| GetTenantQuery, | ||
| GetTenantQueryVariables | ||
| >({ | ||
| query: gql` | ||
| query GetTenantQuery($id: String!) { | ||
| tenant(id: $id) { | ||
| id | ||
| apiSecret | ||
| idpConsentUrl | ||
| idpSecret | ||
| publicName | ||
| createdAt | ||
| deletedAt | ||
| } | ||
| } | ||
| `, | ||
| variables: args | ||
| }) | ||
| return response.data.tenant | ||
| } | ||
|
|
||
| export const whoAmI = async (request: Request) => { | ||
| const apolloClient = await getApolloClient(request) | ||
| const response = await apolloClient.query({ | ||
| query: gql` | ||
| query WhoAmIQuery { | ||
| whoami { | ||
| id | ||
| isOperator | ||
| } | ||
| } | ||
| ` | ||
| }) | ||
| return response.data.whoami | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.