1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-02 13:23:29 +01:00

[AC-1418] Revert change to update PM subscription request model

This commit is contained in:
Shane Melton 2023-06-27 16:33:31 -07:00
parent b73387cac9
commit 9c85576973
No known key found for this signature in database
2 changed files with 4 additions and 53 deletions

View File

@ -39,10 +39,7 @@ export class AdjustSubscription {
async submit() { async submit() {
try { try {
const seatAdjustment = this.newSeatCount - this.currentSeatCount; const seatAdjustment = this.newSeatCount - this.currentSeatCount;
const request = OrganizationSubscriptionUpdateRequest.forPasswordManager( const request = new OrganizationSubscriptionUpdateRequest(seatAdjustment, this.newMaxSeats);
seatAdjustment,
this.newMaxSeats
);
this.formPromise = this.organizationApiService.updatePasswordManagerSeats( this.formPromise = this.organizationApiService.updatePasswordManagerSeats(
this.organizationId, this.organizationId,
request request

View File

@ -1,8 +1,4 @@
import { BitwardenProductType } from "../../enums";
export class OrganizationSubscriptionUpdateRequest { export class OrganizationSubscriptionUpdateRequest {
bitwardenProduct: BitwardenProductType;
/** /**
* The number of seats to add or remove from the subscription. * The number of seats to add or remove from the subscription.
* Applies to both PM and SM request types. * Applies to both PM and SM request types.
@ -15,55 +11,13 @@ export class OrganizationSubscriptionUpdateRequest {
*/ */
maxAutoscaleSeats?: number; maxAutoscaleSeats?: number;
/**
* The number of additional service accounts to add or remove from the subscription.
* Applies only to the SM request type.
*/
serviceAccountAdjustment?: number;
/**
* The maximum number of additional service accounts that can be auto-scaled for the subscription.
* Applies only to the SM request type.
*/
maxAutoscaleServiceAccounts?: number;
constructor(productType: BitwardenProductType) {
this.bitwardenProduct = productType;
}
/** /**
* Build a subscription update request for the Password Manager product type. * Build a subscription update request for the Password Manager product type.
* @param seatAdjustment - The number of seats to add or remove from the subscription. * @param seatAdjustment - The number of seats to add or remove from the subscription.
* @param maxAutoscaleSeats - The maximum number of seats that can be auto-scaled for the subscription. * @param maxAutoscaleSeats - The maximum number of seats that can be auto-scaled for the subscription.
*/ */
static forPasswordManager( constructor(seatAdjustment: number, maxAutoscaleSeats?: number) {
seatAdjustment: number, this.seatAdjustment = seatAdjustment;
maxAutoscaleSeats?: number this.maxAutoscaleSeats = maxAutoscaleSeats;
): OrganizationSubscriptionUpdateRequest {
const request = new OrganizationSubscriptionUpdateRequest(BitwardenProductType.PasswordManager);
request.seatAdjustment = seatAdjustment;
request.maxAutoscaleSeats = maxAutoscaleSeats;
return request;
}
/**
* Build a subscription update request for the Secrets Manager product type.
* @param seatAdjustment - The number of seats to add or remove from the subscription.
* @param serviceAccountAdjustment - The number of additional service accounts to add or remove from the subscription.
* @param maxAutoscaleSeats - The maximum number of seats that can be auto-scaled for the subscription.
* @param maxAutoscaleServiceAccounts - The maximum number of additional service accounts that can be auto-scaled for the subscription.
*/
static forSecretsManager(
seatAdjustment: number,
serviceAccountAdjustment: number,
maxAutoscaleSeats?: number,
maxAutoscaleServiceAccounts?: number
): OrganizationSubscriptionUpdateRequest {
const request = new OrganizationSubscriptionUpdateRequest(BitwardenProductType.SecretsManager);
request.seatAdjustment = seatAdjustment;
request.serviceAccountAdjustment = serviceAccountAdjustment;
request.maxAutoscaleSeats = maxAutoscaleSeats;
request.maxAutoscaleServiceAccounts = maxAutoscaleServiceAccounts;
return request;
} }
} }