From 5cec31f871ee3eb7994a527769ee40783aeb06b1 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Fri, 17 Sep 2021 11:20:48 -0400 Subject: [PATCH] Organization autoscaling (#487) * Seat autoscaling api changes * Update all organization subscription aspects with one api call * Remove disable autoscale option * Remove autoscale request references * Remove autoscale update --- common/src/abstractions/api.service.ts | 2 ++ common/src/models/request/organizationCreateRequest.ts | 1 + .../models/request/organizationSubscriptionUpdateRequest.ts | 3 +++ common/src/models/response/organizationResponse.ts | 2 ++ common/src/services/api.service.ts | 5 +++++ 5 files changed, 13 insertions(+) create mode 100644 common/src/models/request/organizationSubscriptionUpdateRequest.ts diff --git a/common/src/abstractions/api.service.ts b/common/src/abstractions/api.service.ts index 0dec0c8cef..2284a39192 100644 --- a/common/src/abstractions/api.service.ts +++ b/common/src/abstractions/api.service.ts @@ -33,6 +33,7 @@ import { KeysRequest } from '../models/request/keysRequest'; import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest'; import { OrganizationImportRequest } from '../models/request/organizationImportRequest'; import { OrganizationKeysRequest } from '../models/request/organizationKeysRequest'; +import { OrganizationSubscriptionUpdateRequest } from '../models/request/organizationSubscriptionUpdateRequest'; import { OrganizationTaxInfoUpdateRequest } from '../models/request/organizationTaxInfoUpdateRequest'; import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest'; import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest'; @@ -381,6 +382,7 @@ export abstract class ApiService { postOrganizationApiKey: (id: string, request: PasswordVerificationRequest) => Promise; postOrganizationRotateApiKey: (id: string, request: PasswordVerificationRequest) => Promise; postOrganizationUpgrade: (id: string, request: OrganizationUpgradeRequest) => Promise; + postOrganizationUpdateSubscription: (id: string, request: OrganizationSubscriptionUpdateRequest) => Promise; postOrganizationSeat: (id: string, request: SeatRequest) => Promise; postOrganizationStorage: (id: string, request: StorageRequest) => Promise; postOrganizationPayment: (id: string, request: PaymentRequest) => Promise; diff --git a/common/src/models/request/organizationCreateRequest.ts b/common/src/models/request/organizationCreateRequest.ts index f8bc4d6149..7be02660a1 100644 --- a/common/src/models/request/organizationCreateRequest.ts +++ b/common/src/models/request/organizationCreateRequest.ts @@ -13,6 +13,7 @@ export class OrganizationCreateRequest { paymentMethodType: PaymentMethodType; paymentToken: string; additionalSeats: number; + maxAutoscaleSeats: number; additionalStorageGb: number; premiumAccessAddon: boolean; collectionName: string; diff --git a/common/src/models/request/organizationSubscriptionUpdateRequest.ts b/common/src/models/request/organizationSubscriptionUpdateRequest.ts new file mode 100644 index 0000000000..85ea6f4f64 --- /dev/null +++ b/common/src/models/request/organizationSubscriptionUpdateRequest.ts @@ -0,0 +1,3 @@ +export class OrganizationSubscriptionUpdateRequest { + constructor(public seatAdjustment: number, public maxAutoscaleSeats?: number) { } +} diff --git a/common/src/models/response/organizationResponse.ts b/common/src/models/response/organizationResponse.ts index 21d8d4385e..0965bea932 100644 --- a/common/src/models/response/organizationResponse.ts +++ b/common/src/models/response/organizationResponse.ts @@ -17,6 +17,7 @@ export class OrganizationResponse extends BaseResponse { plan: PlanResponse; planType: PlanType; seats: number; + maxAutoscaleSeats: number; maxCollections: number; maxStorageGb: number; useGroups: boolean; @@ -44,6 +45,7 @@ export class OrganizationResponse extends BaseResponse { this.plan = plan == null ? null : new PlanResponse(plan); this.planType = this.getResponseProperty('PlanType'); this.seats = this.getResponseProperty('Seats'); + this.maxAutoscaleSeats = this.getResponseProperty('MaxAutoscaleSeats'); this.maxCollections = this.getResponseProperty('MaxCollections'); this.maxStorageGb = this.getResponseProperty('MaxStorageGb'); this.useGroups = this.getResponseProperty('UseGroups'); diff --git a/common/src/services/api.service.ts b/common/src/services/api.service.ts index 3b0846e713..e959b9ebfd 100644 --- a/common/src/services/api.service.ts +++ b/common/src/services/api.service.ts @@ -36,6 +36,7 @@ import { KeysRequest } from '../models/request/keysRequest'; import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest'; import { OrganizationImportRequest } from '../models/request/organizationImportRequest'; import { OrganizationKeysRequest } from '../models/request/organizationKeysRequest'; +import { OrganizationSubscriptionUpdateRequest } from '../models/request/organizationSubscriptionUpdateRequest'; import { OrganizationTaxInfoUpdateRequest } from '../models/request/organizationTaxInfoUpdateRequest'; import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest'; import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest'; @@ -1192,6 +1193,10 @@ export class ApiService implements ApiServiceAbstraction { return new PaymentResponse(r); } + async postOrganizationUpdateSubscription(id: string, request: OrganizationSubscriptionUpdateRequest): Promise { + return this.send('POST', '/organizations/' + id + '/subscription', request, true, false); + } + async postOrganizationSeat(id: string, request: SeatRequest): Promise { const r = await this.send('POST', '/organizations/' + id + '/seat', request, true, true); return new PaymentResponse(r);