feat(storage): cleanup buckets, add file-size validation and bulk delete

- Remove archived LIGHTWRITE and NUTRIPHI from BUCKETS
- Add missing PLANTA and PROJECTDOC buckets (were in Docker init but not in code)
- Add maxSizeBytes option to upload() and uploadMultipart() for size enforcement
- Add deleteMany() with automatic batching (1000 keys per S3 request)
- Add factories for createPlantaStorage() and createProjectDocStorage()
- Update tests (62 passing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-20 19:27:42 +01:00
parent 720602343e
commit 01c4d3a9d1
6 changed files with 106 additions and 8 deletions

View file

@ -30,9 +30,9 @@ const MINIO_DEFAULTS: StorageConfig = {
const PUBLIC_URL_ENV: Partial<Record<keyof typeof BUCKETS, string>> = {
MANACORE: 'MANACORE_STORAGE_PUBLIC_URL',
PICTURE: 'PICTURE_STORAGE_PUBLIC_URL',
NUTRIPHI: 'NUTRIPHI_S3_PUBLIC_URL',
STORAGE: 'STORAGE_S3_PUBLIC_URL',
INVENTORY: 'INVENTORY_S3_PUBLIC_URL',
PLANTA: 'PLANTA_STORAGE_PUBLIC_URL',
};
/**
@ -104,12 +104,12 @@ export const createManaCoreStorage = (publicUrl?: string) => createStorage('MANA
export const createPictureStorage = (publicUrl?: string) => createStorage('PICTURE', publicUrl);
export const createChatStorage = () => createStorage('CHAT');
export const createManaDeckStorage = () => createStorage('MANADECK');
export const createNutriPhiStorage = (publicUrl?: string) => createStorage('NUTRIPHI', publicUrl);
export const createPresiStorage = () => createStorage('PRESI');
export const createCalendarStorage = () => createStorage('CALENDAR');
export const createContactsStorage = () => createStorage('CONTACTS');
export const createStorageStorage = (publicUrl?: string) => createStorage('STORAGE', publicUrl);
export const createMailStorage = () => createStorage('MAIL');
export const createInventoryStorage = (publicUrl?: string) => createStorage('INVENTORY', publicUrl);
export const createLightWriteStorage = () => createStorage('LIGHTWRITE');
export const createMukkeStorage = () => createStorage('MUKKE');
export const createPlantaStorage = (publicUrl?: string) => createStorage('PLANTA', publicUrl);
export const createProjectDocStorage = () => createStorage('PROJECTDOC');