feat: Implement file cleanup middleware for automatic old file deletion using local and Cloudinary storage providers.

This commit is contained in:
2025-11-27 16:20:55 +03:00
parent bf9988d9bc
commit 1c583af0ab
10 changed files with 299 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
FAIL test/file-cleanup.spec.ts
File Cleanup Middleware
× should delete old file when user image is updated (3 ms)
● File Cleanup Middleware › should delete old file when user image is updated
TypeError: prisma.$use is not a function
16 | beforeAll(async () => {
17 | prisma = new PrismaClient();
> 18 | (prisma as any).$use(fileCleanupMiddleware(prisma));
| ^
19 | await prisma.$connect();
20 |
21 | if (!fs.existsSync(testDir)) {
at Object.<anonymous> (test/file-cleanup.spec.ts:18:21)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 0.657 s, estimated 1 s
Ran all test suites matching test/file-cleanup.spec.ts.