Browse Source

Removes organization ids from checkin/subscription

main
Ramin Tadayon 1 year ago
parent
commit
ae50be9a9c
No known key found for this signature in database GPG Key ID: 79D60DDE3DFB95F5
3 changed files with 4 additions and 21 deletions
  1. +0
    -1
      src/plus/gk/account/subscription.ts
  2. +0
    -2
      src/plus/gk/checkin.ts
  3. +4
    -18
      src/plus/workspaces/workspacesApi.ts

+ 0
- 1
src/plus/gk/account/subscription.ts View File

@ -43,7 +43,6 @@ export interface SubscriptionAccount {
readonly email: string | undefined;
readonly verified: boolean;
readonly createdOn: string;
readonly organizationIds: string[];
}
export interface SubscriptionPreviewTrial {

+ 0
- 2
src/plus/gk/checkin.ts View File

@ -7,7 +7,6 @@ export interface GKCheckInResponse {
readonly paidLicenses: Record<GKLicenseType, GKLicense>;
readonly effectiveLicenses: Record<GKLicenseType, GKLicense>;
};
readonly orgIds?: string[];
}
export interface GKUser {
@ -51,7 +50,6 @@ export function getSubscriptionFromCheckIn(data: GKCheckInResponse): Partial
email: data.user.email,
verified: data.user.status === 'activated',
createdOn: data.user.createdDate,
organizationIds: data.orgIds ?? [],
};
const effectiveLicenses = Object.entries(data.licenses.effectiveLicenses) as [GKLicenseType, GKLicense][];

+ 4
- 18
src/plus/workspaces/workspacesApi.ts View File

@ -164,25 +164,11 @@ export class WorkspacesApi {
}
queryParams += ')';
let query = 'query getWorkpaces {';
query += `memberProjects: projects ${queryParams} { ${queryData} }`;
// TODO@axosoft-ramint This is a temporary and hacky workaround until projects api returns all projects the
// user belongs to in one query. Update once that is available.
if (options?.cursor == null && options?.includeOrganizations) {
const organizationIds =
(await this.container.subscription.getSubscription())?.account?.organizationIds ?? [];
for (const organizationId of organizationIds) {
let orgQueryParams = `(first: ${options?.count ?? defaultWorkspaceCount}`;
if (options?.page) {
orgQueryParams += `, page: ${options.page}`;
}
orgQueryParams += `, organization_id: "${organizationId}")`;
query += `organizationProjects_${organizationId}: projects ${orgQueryParams} { ${queryData} }`;
const query = `
query getWorkpaces {
memberProjects: projects ${queryParams} { ${queryData} }
}
}
query += '}';
`;
const rsp = await this.fetch({ query: query });

Loading…
Cancel
Save