The schema has carried `storageKey` pointers and the migration has written blobs to MinIO since day one, but the API had no S3 client — documents could only be deleted, never uploaded or retrieved. This adds the missing wiring. API - StorageModule/StorageService (@aws-sdk/client-s3, path-style for MinIO): put/getStream/delete, best-effort bucket ensure on boot, gracefully disabled when S3 env is absent (ServiceUnavailable on use). - Reads S3_ENDPOINT/S3_BUCKET + S3_ACCESS_KEY/S3_SECRET_KEY, falling back to MINIO_ROOT_USER/MINIO_ROOT_PASSWORD so one credential set drives both the migration and the API. - Property service documents: POST :id/documents (multipart), GET :id/documents/:childId/download (streamed), delete now also drops the blob. - Policy documents: same upload/download/delete (previously had none). - Keys stay under the service/<id>/… and policy/<id>/… prefixes the migration established. Web - api.ts: shared uploadFile() helper (uploadIngest refactored onto it), upload/download/remove helpers for property & policy documents. - Servicios, polizas, clientes detail pages: real Descargar links and an upload control (gated by policy:update / property:update) replacing the "storage pending" notes. Infra - docker-compose: minio service (9000/9001, healthcheck, named volume) + S3 env wired into the api service. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.2 KiB
JSON
45 lines
1.2 KiB
JSON
{
|
|
"name": "@jorgecuadros/api",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"build": "nest build",
|
|
"start": "nest start",
|
|
"start:dev": "nest start --watch",
|
|
"start:prod": "node dist/main",
|
|
"lint": "eslint \"src/**/*.ts\"",
|
|
"test": "jest"
|
|
},
|
|
"dependencies": {
|
|
"@aws-sdk/client-s3": "^3.665.0",
|
|
"@jorgecuadros/database": "workspace:*",
|
|
"@nestjs/common": "^10.4.4",
|
|
"@nestjs/config": "^3.3.0",
|
|
"@nestjs/core": "^10.4.4",
|
|
"@nestjs/passport": "^10.0.3",
|
|
"@nestjs/platform-express": "^10.4.4",
|
|
"argon2": "^0.41.1",
|
|
"class-transformer": "^0.5.1",
|
|
"class-validator": "^0.14.1",
|
|
"express-session": "^1.18.0",
|
|
"passport": "^0.7.0",
|
|
"passport-local": "^1.0.0",
|
|
"reflect-metadata": "^0.2.2",
|
|
"rxjs": "^7.8.1"
|
|
},
|
|
"devDependencies": {
|
|
"@nestjs/cli": "^10.4.5",
|
|
"@nestjs/testing": "^10.4.4",
|
|
"@types/express": "^4.17.21",
|
|
"@types/express-session": "^1.18.0",
|
|
"@types/jest": "^29.5.13",
|
|
"@types/node": "^20.16.11",
|
|
"@types/passport": "^1.0.17",
|
|
"@types/passport-local": "^1.0.38",
|
|
"jest": "^29.7.0",
|
|
"ts-jest": "^29.2.5",
|
|
"ts-node": "^10.9.2",
|
|
"typescript": "^5.6.3"
|
|
}
|
|
}
|