FIX FILE SIZES

This commit is contained in:
SepehrYahyaee
2026-05-23 16:23:11 +03:30
parent 94bde88cb6
commit a31196774c
10 changed files with 58 additions and 40 deletions

View File

@@ -47,17 +47,29 @@ export interface MediaLimits {
* receive. Per-client `maxBytes` cannot legitimately go above its route's
* multer ceiling, so the defaults below are kept at-or-below those.
*/
export const DEFAULT_MEDIA_MIN_BYTES = 100 * 1024; // 100KB
export const DEFAULT_MEDIA_MAX_BYTES = 100 * 1024 * 1024; // 100MB
export const DEFAULT_MEDIA_LIMITS: Record<MediaKind, MediaLimits> = {
video: { minBytes: 256 * 1024, maxBytes: 20 * 1024 * 1024 },
image: { minBytes: 5 * 1024, maxBytes: 8 * 1024 * 1024 },
voice: { minBytes: 5 * 1024, maxBytes: 8 * 1024 * 1024 },
video: {
minBytes: DEFAULT_MEDIA_MIN_BYTES,
maxBytes: DEFAULT_MEDIA_MAX_BYTES,
},
image: {
minBytes: DEFAULT_MEDIA_MIN_BYTES,
maxBytes: DEFAULT_MEDIA_MAX_BYTES,
},
voice: {
minBytes: DEFAULT_MEDIA_MIN_BYTES,
maxBytes: DEFAULT_MEDIA_MAX_BYTES,
},
};
/** Highest multer `fileSize` used on any route for each kind (policy cannot exceed this). */
export const MEDIA_ROUTE_MAX_BYTES: Record<MediaKind, number> = {
video: 50 * 1024 * 1024,
image: 10 * 1024 * 1024,
voice: 10 * 1024 * 1024,
video: DEFAULT_MEDIA_MAX_BYTES,
image: DEFAULT_MEDIA_MAX_BYTES,
voice: DEFAULT_MEDIA_MAX_BYTES,
};
export const CAR_BODY_ACCIDENT_MAX_AGE_DAYS_MIN = 1;