-
Notifications
You must be signed in to change notification settings - Fork 229
Fix unsupported IN operator for store_type filter in FetchStoreByDomain
#6963
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,10 +89,7 @@ import { | |
| DevSessionUpdateMutationVariables, | ||
| } from '../../api/graphql/app-dev/generated/dev-session-update.js' | ||
| import {DevSessionDelete, DevSessionDeleteMutation} from '../../api/graphql/app-dev/generated/dev-session-delete.js' | ||
| import { | ||
| FetchStoreByDomain, | ||
| FetchStoreByDomainQueryVariables, | ||
| } from '../../api/graphql/business-platform-organizations/generated/fetch_store_by_domain.js' | ||
| import {FetchStoreByDomain} from '../../api/graphql/business-platform-organizations/generated/fetch_store_by_domain.js' | ||
| import { | ||
| ListAppDevStores, | ||
| ListAppDevStoresQuery, | ||
|
|
@@ -840,26 +837,30 @@ export class AppManagementClient implements DeveloperPlatformClient { | |
| } | ||
|
|
||
| async storeByDomain(orgId: string, shopDomain: string, storeTypes: Store[]): Promise<OrganizationStore | undefined> { | ||
| const queryVariables: FetchStoreByDomainQueryVariables = { | ||
| domain: shopDomain, | ||
| storeTypes: storeTypes.map((t) => t.toLowerCase()).join(','), | ||
| } | ||
| const storesResult = await this.businessPlatformOrganizationsRequest({ | ||
| query: FetchStoreByDomain, | ||
| organizationId: String(numberFromGid(orgId)), | ||
| variables: queryVariables, | ||
| }) | ||
|
|
||
| const organization = storesResult.organization | ||
| const results = await Promise.all( | ||
| storeTypes.map((storeType) => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like pre-existing issue, but
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for flagging! The map here is intentional. It builds an array of |
||
| this.businessPlatformOrganizationsRequest({ | ||
| query: FetchStoreByDomain, | ||
| organizationId: String(numberFromGid(orgId)), | ||
| variables: { | ||
| domain: shopDomain, | ||
| filters: [{field: 'STORE_TYPE' as const, operator: 'EQUALS' as const, value: storeType.toLowerCase()}], | ||
| }, | ||
| }), | ||
| ), | ||
| ) | ||
|
|
||
| if (!organization) { | ||
| const organizations = results.map((result) => result.organization).filter((org) => org != null) | ||
| if (organizations.length === 0) { | ||
| throw new AbortError(`No organization found`) | ||
| } | ||
|
|
||
| const bpStoresArray = organization.accessibleShops?.edges.map((value) => value.node) ?? [] | ||
| const provisionable = isStoreProvisionable(organization.currentUser?.organizationPermissions ?? []) | ||
| const storesArray = mapBusinessPlatformStoresToOrganizationStores(bpStoresArray, provisionable) | ||
| return storesArray[0] | ||
| const stores = organizations.flatMap((org) => { | ||
| const nodes = org.accessibleShops?.edges.map((edge) => edge.node) ?? [] | ||
| const provisionable = isStoreProvisionable(org.currentUser?.organizationPermissions ?? []) | ||
| return mapBusinessPlatformStoresToOrganizationStores(nodes, provisionable) | ||
| }) | ||
| return stores[0] | ||
| } | ||
|
|
||
| async ensureUserAccessToStore(orgId: string, store: OrganizationStore): Promise<void> { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.