feat(storage): add archive storage support for assets (#514)

* feat(storage): add archive storage support for assets

* fix(webui): show archive icon in front of file name in breadcrumb bar

* fix(webui): display archive icon in breadcrumbs when restoring

* refactor(transcode): simplify restore asset workflow to single while loop

* docs(configuration): add archive storage documentation and readme entries

* fix(webui): show archive icon in front of version names and prevent version card overflow

* fix(webui): fix overflow in manage versions dialog scroll area

* fix(webui): prevent manage versions dialog overflow on long file names

* docs(configuration): fix archive storage environment variables and defaults

* fix(storage): address code review findings for archive storage
This commit is contained in:
Yiling-J
2026-11-03 20:31:56 +08:00
committed by GitHub
parent 49a2d7c380
commit ba3c6dbfee
110 changed files with 7013 additions and 199 deletions
+31 -2
View File
@@ -6,16 +6,20 @@ import { s3Service } from '@shumai/core/src/s3/s3'
import type { Prisma } from '@shumai/db'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import {
archiveAssetsOp,
renameAssetOp,
resolveCommentOp,
restoreArchivedAssetsOp,
runOperation,
updateAssetMetadataOp,
} from '@shumai/core/src/operations'
import {
archiveAssetsRequestSchema,
createCommentRequestSchema,
deleteFilesRequestSchema,
batchGetFilesRequestSchema,
paginationParamsSchema,
restoreArchivedAssetsRequestSchema,
restoreFilesRequestSchema,
updateAssetMetadataRequestSchema,
updateAssetOrderRequestSchema,
@@ -343,6 +347,28 @@ const route = new Hono<{ Variables: { user: User } }>()
await assetService.restoreAssets(req.ids)
return c.body(null, 204)
})
.post('/files/archive', zValidator('json', archiveAssetsRequestSchema), async (c) => {
const req = c.req.valid('json')
const result = await runOperation(
archiveAssetsOp,
{ userId: c.get('user').id, via: 'api' },
{ assetIds: req.ids },
)
return c.json(result)
})
.post(
'/files/restore-archive',
zValidator('json', restoreArchivedAssetsRequestSchema),
async (c) => {
const req = c.req.valid('json')
const result = await runOperation(
restoreArchivedAssetsOp,
{ userId: c.get('user').id, via: 'api' },
{ assetIds: req.ids },
)
return c.json(result)
},
)
.post('/teams/:teamId/files', zValidator('form', uploadFileRequestSchema), async (c) => {
const teamId = c.req.param('teamId')
const user = c.get('user')
@@ -424,8 +450,11 @@ const route = new Hono<{ Variables: { user: User } }>()
})
// 4. Generate download links
const files = await assetService.getDownloadLinks(req.ids)
return c.json({ files })
const { files, skippedArchivedCount } = await assetService.getDownloadLinks(req.ids)
return c.json({
files,
...(skippedArchivedCount > 0 ? { skippedArchivedCount } : {}),
})
})
.post(
'/files/download-url',