aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/storageQuota.ts
blob: 6b7441a2c9542a8aa2404a45b99b8fdef55ca5c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * A token that proves storage quota has been checked and approved.
 * This class cannot be instantiated directly - it can only be created
 * by the checkStorageQuota function.
 */
export class QuotaApproved {
  private constructor(
    public readonly userId: string,
    public readonly approvedSize: number,
  ) {}

  /**
   * Internal method to create a QuotaApproved token.
   * This should only be called by checkStorageQuota.
   */
  static _create(userId: string, approvedSize: number): QuotaApproved {
    return new QuotaApproved(userId, approvedSize);
  }
}