diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-07-06 15:54:49 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-07-06 16:32:35 +0000 |
| commit | 384432d31e7bee6bf35d8af6b7165410303ffda4 (patch) | |
| tree | ddb845aa8dacbf00151ee3fda8a233d0620d6ab1 /packages/shared/storageQuota.ts | |
| parent | 47624547f8cb352426d597537c11e7a4550aa91e (diff) | |
| download | karakeep-384432d31e7bee6bf35d8af6b7165410303ffda4.tar.zst | |
feat: Add per user storage quota
Diffstat (limited to 'packages/shared/storageQuota.ts')
| -rw-r--r-- | packages/shared/storageQuota.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/shared/storageQuota.ts b/packages/shared/storageQuota.ts new file mode 100644 index 00000000..6b7441a2 --- /dev/null +++ b/packages/shared/storageQuota.ts @@ -0,0 +1,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); + } +} |
