feat(trash): implement two-stage trashcan and project cleanup

This commit is contained in:
yiling
2026-05-23 23:26:43 +08:00
parent f05247f372
commit effec44870
15 changed files with 272 additions and 171 deletions
+5 -3
View File
@@ -261,7 +261,7 @@ describe('ProjectService', () => {
// Verify asset is soft-deleted and detached
const a = await prisma.asset.findUnique({ where: { id: asset.id } })
expect(a).toBeDefined()
expect(a?.removed).toBe(true)
expect(a?.isDeleted).toBe(true)
expect(a?.projectId).toBeNull()
expect(a?.parentId).toBeNull()
@@ -333,9 +333,11 @@ describe('ProjectService', () => {
// Delete project
await projectService.deleteProject(project.id)
// Manually trigger the private cleanup method for testing
// Manually trigger the private cleanup methods for testing
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await (assetService as any).cleanupOldAssets()
await (assetService as any).expireTrashedAssets()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await (assetService as any).purgePendingAssets()
// Verify everything is wiped from DB
expect(await prisma.project.findUnique({ where: { id: project.id } })).toBeNull()