mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
feat: implement storage quota management for uploads
- Added storage quota enforcement for audio and image uploads in the respective routes. - Introduced reservation system to manage concurrent uploads and prevent quota overages. - Enhanced comment creation to account for audio and image attachment sizes against user quotas. - Created new UploadReservation model to track in-flight upload reservations. - Backfilled existing video assets with size information from R2. - Added progress component for UI feedback during uploads. - Updated API responses to include reservation IDs for better quota management. - Adjusted error handling to return appropriate storage limit exceeded messages.
This commit is contained in:
@@ -36,6 +36,7 @@ export const HttpStatus = {
|
||||
CONFLICT: 409,
|
||||
UNPROCESSABLE_ENTITY: 422,
|
||||
TOO_MANY_REQUESTS: 429,
|
||||
INSUFFICIENT_STORAGE: 507,
|
||||
INTERNAL_SERVER_ERROR: 500,
|
||||
} as const;
|
||||
|
||||
@@ -62,6 +63,9 @@ export const ErrorCode = {
|
||||
// Server errors
|
||||
INTERNAL_ERROR: "INTERNAL_ERROR",
|
||||
SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE",
|
||||
|
||||
// Storage errors
|
||||
STORAGE_LIMIT_EXCEEDED: "STORAGE_LIMIT_EXCEEDED",
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -158,4 +162,7 @@ export const apiErrors = {
|
||||
|
||||
internalError: (message = "Internal server error") =>
|
||||
errorResponse(message, HttpStatus.INTERNAL_SERVER_ERROR, ErrorCode.INTERNAL_ERROR),
|
||||
|
||||
storageExceeded: (message = "Storage limit exceeded. Please delete some files to free up space.") =>
|
||||
errorResponse(message, HttpStatus.INSUFFICIENT_STORAGE, ErrorCode.STORAGE_LIMIT_EXCEEDED),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user