mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 22:14:50 +00:00
feat(ui): add file context menu enhancements and migrate share manager breadcrumb
This commit is contained in:
@@ -68,15 +68,28 @@ export class UploadService {
|
||||
if (!parentAsset.projectId) throw new Error('Parent asset has no project')
|
||||
|
||||
const presignedUrls: PresignedUrl[] = []
|
||||
await this.createAssetsRecursively(
|
||||
const isParentFile = parentAsset.type === AssetType.file
|
||||
const targetParentId = isParentFile ? parentAsset.parentId! : parentAsset.id
|
||||
|
||||
const createdAssetIds = await this.createAssetsRecursively(
|
||||
userId,
|
||||
task.id,
|
||||
parentAsset.projectId,
|
||||
parentAsset.id,
|
||||
targetParentId,
|
||||
req.files,
|
||||
presignedUrls,
|
||||
)
|
||||
|
||||
if (isParentFile && createdAssetIds.length > 0) {
|
||||
for (const assetId of createdAssetIds) {
|
||||
await assetService.reparentAssets({
|
||||
assetIds: [assetId],
|
||||
newParentId: parentAsset.id,
|
||||
creatorId: userId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
taskId: task.id,
|
||||
presignedUrls: presignedUrls,
|
||||
@@ -90,12 +103,13 @@ export class UploadService {
|
||||
parentId: string,
|
||||
files: FileNode[],
|
||||
presignedUrls: PresignedUrl[],
|
||||
): Promise<void> {
|
||||
): Promise<string[]> {
|
||||
const firstFile = await this.prismaClient.asset.findFirst({
|
||||
where: { parentId },
|
||||
orderBy: { sortIndex: 'asc' },
|
||||
})
|
||||
let currentSortIndex = firstFile?.sortIndex || undefined
|
||||
const createdIds: string[] = []
|
||||
|
||||
for (const file of files) {
|
||||
if (file.name.startsWith('.')) continue
|
||||
@@ -124,6 +138,7 @@ export class UploadService {
|
||||
taskId,
|
||||
},
|
||||
})
|
||||
createdIds.push(newAsset.id)
|
||||
|
||||
if (file.children && file.children.length > 0) {
|
||||
await this.createAssetsRecursively(
|
||||
@@ -143,6 +158,7 @@ export class UploadService {
|
||||
})
|
||||
}
|
||||
}
|
||||
return createdIds
|
||||
}
|
||||
|
||||
async confirmFileUpload(
|
||||
|
||||
Reference in New Issue
Block a user