mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 22:49:28 +00:00
Merge pull request #13 from shumaiOne/feat/async-delete-project
feat(project): implement async project deletion and storage cleanup
This commit is contained in:
@@ -304,3 +304,18 @@ We use a custom workflow engine that supports both **Local** (polling-based) and
|
||||
- When importing across layers, always use absolute paths with the `@` alias for the root of the project (e.g. `import { AssetInfo } from '@/services/asset/models'`).
|
||||
- For types that have been migrated from `@/ui/api/api`, use the equivalent types from the `src/services/<domain>/models.ts` instead.
|
||||
- **DTO Naming**: Do not append the `Dto` suffix to types or interfaces (e.g. use `JoinRequest` instead of `JoinRequestDto`).
|
||||
|
||||
## Radix UI / Shadcn UI Patterns
|
||||
|
||||
- **Modal Overlays**: When triggering a dialog (e.g., `Dialog`, `AlertDialog`) from inside a `DropdownMenu`, you must set `modal={false}` on the `<DropdownMenu>` component. Failing to do so will cause the UI to freeze due to conflicting focus management between the two modal components.
|
||||
|
||||
## Logging
|
||||
|
||||
We use **pino** for logging. Always use **structured logging** to ensure logs are easily searchable and machine-readable.
|
||||
|
||||
- **Import**: `import { logger } from '@/logger'`
|
||||
- **Usage**: Pass an object as the first argument containing the metadata, and a string as the second argument for the descriptive message.
|
||||
```typescript
|
||||
logger.info({ userId: user.id, projectId }, 'Project deleted successfully')
|
||||
```
|
||||
- **Levels**: Use appropriate levels: `debug`, `info`, `warn`, `error`.
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "asset_comment_attachments" DROP CONSTRAINT "asset_comment_attachments_asset_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "asset_comment_attachments" DROP CONSTRAINT "asset_comment_attachments_comment_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "asset_comments" DROP CONSTRAINT "asset_comments_asset_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "asset_comments" DROP CONSTRAINT "asset_comments_reply_to_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_parent_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "invites" DROP CONSTRAINT "invites_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "metadata_fields" DROP CONSTRAINT "metadata_fields_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "notifications" DROP CONSTRAINT "notifications_asset_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "notifications" DROP CONSTRAINT "notifications_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "project_members" DROP CONSTRAINT "project_members_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "share_links" DROP CONSTRAINT "share_links_project_id_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "project_members" ADD CONSTRAINT "project_members_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "share_links" ADD CONSTRAINT "share_links_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comments" ADD CONSTRAINT "asset_comments_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comments" ADD CONSTRAINT "asset_comments_reply_to_id_fkey" FOREIGN KEY ("reply_to_id") REFERENCES "asset_comments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comment_attachments" ADD CONSTRAINT "asset_comment_attachments_comment_id_fkey" FOREIGN KEY ("comment_id") REFERENCES "asset_comments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comment_attachments" ADD CONSTRAINT "asset_comment_attachments_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "invites" ADD CONSTRAINT "invites_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "metadata_fields" ADD CONSTRAINT "metadata_fields_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The values [removed] on the enum `AssetStatus` will be removed. If these variants are still used in the database, this will fail.
|
||||
- You are about to drop the column `removed` on the `assets` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterEnum
|
||||
BEGIN;
|
||||
CREATE TYPE "AssetStatus_new" AS ENUM ('uploading', 'uploaded', 'processing', 'processed', 'trashed', 'pending_purge', 'purging');
|
||||
ALTER TABLE "assets" ALTER COLUMN "status" TYPE "AssetStatus_new" USING ("status"::text::"AssetStatus_new");
|
||||
ALTER TYPE "AssetStatus" RENAME TO "AssetStatus_old";
|
||||
ALTER TYPE "AssetStatus_new" RENAME TO "AssetStatus";
|
||||
DROP TYPE "public"."AssetStatus_old";
|
||||
COMMIT;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "assets_removed_idx";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "assets" DROP COLUMN "removed",
|
||||
ADD COLUMN "is_deleted" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "assets_is_deleted_idx" ON "assets"("is_deleted");
|
||||
@@ -0,0 +1,17 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_parent_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_project_id_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "assets" DROP CONSTRAINT "assets_target_id_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_target_id_fkey" FOREIGN KEY ("target_id") REFERENCES "assets"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
+15
-14
@@ -41,7 +41,8 @@ enum AssetStatus {
|
||||
processing
|
||||
processed
|
||||
trashed
|
||||
removed
|
||||
pending_purge
|
||||
purging
|
||||
}
|
||||
|
||||
enum InviteRole {
|
||||
@@ -312,7 +313,7 @@ model ProjectMember {
|
||||
role ProjectMemberRole
|
||||
|
||||
projectId String @map("project_id")
|
||||
project Project @relation("ProjectToProjectMember", fields: [projectId], references: [id])
|
||||
project Project @relation("ProjectToProjectMember", fields: [projectId], references: [id], onDelete: Cascade)
|
||||
|
||||
teamMemberId String @map("team_member_id")
|
||||
teamMember TeamMember @relation("TeamMemberToProjectMember", fields: [teamMemberId], references: [id])
|
||||
@@ -334,7 +335,7 @@ model ShareLink {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
projectId String @map("project_id")
|
||||
project Project @relation("ProjectToShareLink", fields: [projectId], references: [id])
|
||||
project Project @relation("ProjectToShareLink", fields: [projectId], references: [id], onDelete: Cascade)
|
||||
|
||||
rootFolderId String @unique @map("root_folder_id")
|
||||
rootFolder Asset @relation("ShareLinkToRootFolder", fields: [rootFolderId], references: [id])
|
||||
@@ -355,7 +356,7 @@ model Asset {
|
||||
transcodeTaskId String? @map("transcode_task_id")
|
||||
/// [MediaInfo]
|
||||
media Json?
|
||||
removed Boolean @default(false)
|
||||
isDeleted Boolean @default(false) @map("is_deleted")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
sortIndex String? @map("sort_index")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
@@ -366,7 +367,7 @@ model Asset {
|
||||
children Asset[] @relation("AssetChildren")
|
||||
|
||||
targetId String? @map("target_id")
|
||||
target Asset? @relation("SymlinkTarget", fields: [targetId], references: [id], onDelete: Cascade)
|
||||
target Asset? @relation("SymlinkTarget", fields: [targetId], references: [id])
|
||||
symlinks Asset[] @relation("SymlinkTarget")
|
||||
|
||||
metadataValues AssetMetadataValue[] @relation("AssetToMetadataValues")
|
||||
@@ -396,7 +397,7 @@ model Asset {
|
||||
@@index([createdAt])
|
||||
@@index([updatedAt])
|
||||
@@index([sortIndex])
|
||||
@@index([removed])
|
||||
@@index([isDeleted])
|
||||
@@index([deletedAt])
|
||||
@@index([nameNgram], type: Gin)
|
||||
@@unique([parentId, targetId], name: "parentIdTargetId")
|
||||
@@ -436,13 +437,13 @@ model AssetComment {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
assetId String @map("asset_id")
|
||||
asset Asset @relation("AssetToComment", fields: [assetId], references: [id])
|
||||
asset Asset @relation("AssetToComment", fields: [assetId], references: [id], onDelete: Cascade)
|
||||
|
||||
creatorId String? @map("creator_id")
|
||||
creator User? @relation("UserToAssetComment", fields: [creatorId], references: [id])
|
||||
|
||||
replyToId String? @map("reply_to_id")
|
||||
replyTo AssetComment? @relation("CommentReplies", fields: [replyToId], references: [id])
|
||||
replyTo AssetComment? @relation("CommentReplies", fields: [replyToId], references: [id], onDelete: Cascade)
|
||||
replies AssetComment[] @relation("CommentReplies")
|
||||
|
||||
attachments AssetCommentAttachment[] @relation("CommentToAttachment")
|
||||
@@ -456,10 +457,10 @@ model AssetCommentAttachment {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
commentId String @map("comment_id")
|
||||
comment AssetComment @relation("CommentToAttachment", fields: [commentId], references: [id])
|
||||
comment AssetComment @relation("CommentToAttachment", fields: [commentId], references: [id], onDelete: Cascade)
|
||||
|
||||
assetId String @map("asset_id")
|
||||
asset Asset @relation("AssetToCommentAttachment", fields: [assetId], references: [id])
|
||||
asset Asset @relation("AssetToCommentAttachment", fields: [assetId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("asset_comment_attachments")
|
||||
}
|
||||
@@ -490,7 +491,7 @@ model Invite {
|
||||
team Team @relation("TeamToInvite", fields: [teamId], references: [id])
|
||||
|
||||
projectId String? @map("project_id")
|
||||
project Project? @relation("ProjectToInvite", fields: [projectId], references: [id])
|
||||
project Project? @relation("ProjectToInvite", fields: [projectId], references: [id], onDelete: Cascade)
|
||||
|
||||
inviterId String @map("inviter_id")
|
||||
inviter User @relation("UserToInvite", fields: [inviterId], references: [id])
|
||||
@@ -512,7 +513,7 @@ model MetadataField {
|
||||
team Team? @relation("TeamToMetadataField", fields: [teamId], references: [id])
|
||||
|
||||
projectId String? @map("project_id")
|
||||
project Project? @relation("ProjectToMetadataField", fields: [projectId], references: [id])
|
||||
project Project? @relation("ProjectToMetadataField", fields: [projectId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("metadata_fields")
|
||||
}
|
||||
@@ -527,13 +528,13 @@ model Notification {
|
||||
team Team @relation("TeamToNotification", fields: [teamId], references: [id])
|
||||
|
||||
projectId String? @map("project_id")
|
||||
project Project? @relation("ProjectToNotification", fields: [projectId], references: [id])
|
||||
project Project? @relation("ProjectToNotification", fields: [projectId], references: [id], onDelete: Cascade)
|
||||
|
||||
creatorId String? @map("creator_id")
|
||||
creator User? @relation("UserToCreatedNotification", fields: [creatorId], references: [id])
|
||||
|
||||
assetId String? @map("asset_id")
|
||||
asset Asset? @relation("AssetToNotification", fields: [assetId], references: [id])
|
||||
asset Asset? @relation("AssetToNotification", fields: [assetId], references: [id], onDelete: Cascade)
|
||||
|
||||
taskId String? @map("task_id")
|
||||
task Task? @relation("TaskToNotification", fields: [taskId], references: [id])
|
||||
|
||||
+2
-1
@@ -104,7 +104,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
const resp = await assetService.listChildren({
|
||||
assetId: folderId,
|
||||
assetType: req.assetType,
|
||||
|
||||
projectId: req.projectId,
|
||||
showDeleted: req.showDeleted,
|
||||
sort: req.sort,
|
||||
order: req.order,
|
||||
})
|
||||
|
||||
+22
-2
@@ -62,6 +62,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
async (c) => {
|
||||
const projectId = c.req.param('projectId')
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('query')
|
||||
|
||||
await authzService.hasPermission({
|
||||
projectId,
|
||||
@@ -69,8 +70,14 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
permission: Permission.Read,
|
||||
})
|
||||
|
||||
// STUB: AssetService is not migrated yet.
|
||||
return c.json({ data: [], pageInfo: {} })
|
||||
const resp = await assetService.listChildren({
|
||||
projectId,
|
||||
assetType: req.assetType,
|
||||
showDeleted: true,
|
||||
after: req.after,
|
||||
first: req.first,
|
||||
})
|
||||
return c.json(resp)
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/projects', zValidator('query', listProjectsRequestSchema), async (c) => {
|
||||
@@ -113,6 +120,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
const p = await projectService.getProject(projectId)
|
||||
return c.json(p)
|
||||
})
|
||||
.delete('/projects/:projectId', async (c) => {
|
||||
const projectId = c.req.param('projectId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
projectId,
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
})
|
||||
|
||||
await projectService.deleteProject(projectId)
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.get('/projects/:projectId/team', async (c) => {
|
||||
const projectId = c.req.param('projectId')
|
||||
const user = c.get('user')
|
||||
|
||||
@@ -22,6 +22,7 @@ import teamRoute from '@/api/team'
|
||||
import uploadRoute from '@/api/upload'
|
||||
import versionStackRoute from '@/api/versionStack'
|
||||
import { metadataService } from '@/services/metadata/metadata'
|
||||
import { assetService } from '@/services/asset/asset'
|
||||
import { workflowService } from '@/workflow/workflow'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -61,6 +62,7 @@ export type AppType = typeof apiAppRoute
|
||||
export async function run() {
|
||||
// Start services
|
||||
await metadataService.syncSystemFields().catch(console.error)
|
||||
assetService.startCleanupJob()
|
||||
workflowService.start()
|
||||
if (process.env.WORKFLOW_EXECUTOR === 'temporal') {
|
||||
const args = process.argv.slice(2)
|
||||
@@ -103,4 +105,14 @@ export async function run() {
|
||||
})
|
||||
|
||||
console.log(`🚀 Server running at ${server.url}`)
|
||||
|
||||
const shutdown = () => {
|
||||
console.log('\nShutting down gracefully...')
|
||||
assetService.stopCleanupJob()
|
||||
server.stop(true)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
process.on('SIGINT', shutdown)
|
||||
process.on('SIGTERM', shutdown)
|
||||
}
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ export const listChildrenRequestSchema = z.object({
|
||||
assetId: z.string().optional(),
|
||||
assetType: z.string(),
|
||||
projectId: z.string().optional(),
|
||||
showRemoved: z.boolean().optional(),
|
||||
showDeleted: z.boolean().optional(),
|
||||
prefix: z.string().optional(),
|
||||
sort: z.string().optional(),
|
||||
order: z.string().optional(),
|
||||
|
||||
Generated
+2
-1
@@ -37,7 +37,8 @@ export const AssetStatus = {
|
||||
processing: 'processing',
|
||||
processed: 'processed',
|
||||
trashed: 'trashed',
|
||||
removed: 'removed'
|
||||
pending_purge: 'pending_purge',
|
||||
purging: 'purging'
|
||||
} as const
|
||||
|
||||
export type AssetStatus = (typeof AssetStatus)[keyof typeof AssetStatus]
|
||||
|
||||
Generated
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -2871,7 +2871,7 @@ export const AssetScalarFieldEnum = {
|
||||
status: 'status',
|
||||
transcodeTaskId: 'transcodeTaskId',
|
||||
media: 'media',
|
||||
removed: 'removed',
|
||||
isDeleted: 'isDeleted',
|
||||
deletedAt: 'deletedAt',
|
||||
sortIndex: 'sortIndex',
|
||||
createdAt: 'createdAt',
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@ export const AssetScalarFieldEnum = {
|
||||
status: 'status',
|
||||
transcodeTaskId: 'transcodeTaskId',
|
||||
media: 'media',
|
||||
removed: 'removed',
|
||||
isDeleted: 'isDeleted',
|
||||
deletedAt: 'deletedAt',
|
||||
sortIndex: 'sortIndex',
|
||||
createdAt: 'createdAt',
|
||||
|
||||
Generated
+104
-104
@@ -48,7 +48,7 @@ export type AssetMinAggregateOutputType = {
|
||||
sizeByte: number | null
|
||||
status: $Enums.AssetStatus | null
|
||||
transcodeTaskId: string | null
|
||||
removed: boolean | null
|
||||
isDeleted: boolean | null
|
||||
deletedAt: Date | null
|
||||
sortIndex: string | null
|
||||
createdAt: Date | null
|
||||
@@ -70,7 +70,7 @@ export type AssetMaxAggregateOutputType = {
|
||||
sizeByte: number | null
|
||||
status: $Enums.AssetStatus | null
|
||||
transcodeTaskId: string | null
|
||||
removed: boolean | null
|
||||
isDeleted: boolean | null
|
||||
deletedAt: Date | null
|
||||
sortIndex: string | null
|
||||
createdAt: Date | null
|
||||
@@ -94,7 +94,7 @@ export type AssetCountAggregateOutputType = {
|
||||
status: number
|
||||
transcodeTaskId: number
|
||||
media:PrismaJson.MediaInfo
|
||||
removed: number
|
||||
isDeleted: number
|
||||
deletedAt: number
|
||||
sortIndex: number
|
||||
createdAt: number
|
||||
@@ -128,7 +128,7 @@ export type AssetMinAggregateInputType = {
|
||||
sizeByte?: true
|
||||
status?: true
|
||||
transcodeTaskId?: true
|
||||
removed?: true
|
||||
isDeleted?: true
|
||||
deletedAt?: true
|
||||
sortIndex?: true
|
||||
createdAt?: true
|
||||
@@ -150,7 +150,7 @@ export type AssetMaxAggregateInputType = {
|
||||
sizeByte?: true
|
||||
status?: true
|
||||
transcodeTaskId?: true
|
||||
removed?: true
|
||||
isDeleted?: true
|
||||
deletedAt?: true
|
||||
sortIndex?: true
|
||||
createdAt?: true
|
||||
@@ -174,7 +174,7 @@ export type AssetCountAggregateInputType = {
|
||||
status?: true
|
||||
transcodeTaskId?: true
|
||||
media?: true
|
||||
removed?: true
|
||||
isDeleted?: true
|
||||
deletedAt?: true
|
||||
sortIndex?: true
|
||||
createdAt?: true
|
||||
@@ -285,7 +285,7 @@ export type AssetGroupByOutputType = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId: string | null
|
||||
media:PrismaJson.MediaInfo | null
|
||||
removed: boolean
|
||||
isDeleted: boolean
|
||||
deletedAt: Date | null
|
||||
sortIndex: string | null
|
||||
createdAt: Date
|
||||
@@ -332,7 +332,7 @@ export type AssetWhereInput = {
|
||||
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||
media?: Prisma.JsonNullableFilter<"Asset">
|
||||
removed?: Prisma.BoolFilter<"Asset"> | boolean
|
||||
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
||||
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"Asset"> | Date | string
|
||||
@@ -372,7 +372,7 @@ export type AssetOrderByWithRelationInput = {
|
||||
status?: Prisma.SortOrder
|
||||
transcodeTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
media?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
removed?: Prisma.SortOrder
|
||||
isDeleted?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
sortIndex?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
@@ -416,7 +416,7 @@ export type AssetWhereUniqueInput = Prisma.AtLeast<{
|
||||
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||
media?: Prisma.JsonNullableFilter<"Asset">
|
||||
removed?: Prisma.BoolFilter<"Asset"> | boolean
|
||||
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
||||
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"Asset"> | Date | string
|
||||
@@ -456,7 +456,7 @@ export type AssetOrderByWithAggregationInput = {
|
||||
status?: Prisma.SortOrder
|
||||
transcodeTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
media?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
removed?: Prisma.SortOrder
|
||||
isDeleted?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
sortIndex?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
@@ -488,7 +488,7 @@ export type AssetScalarWhereWithAggregatesInput = {
|
||||
status?: Prisma.EnumAssetStatusWithAggregatesFilter<"Asset"> | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
||||
media?: Prisma.JsonNullableWithAggregatesFilter<"Asset">
|
||||
removed?: Prisma.BoolWithAggregatesFilter<"Asset"> | boolean
|
||||
isDeleted?: Prisma.BoolWithAggregatesFilter<"Asset"> | boolean
|
||||
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Asset"> | Date | string | null
|
||||
sortIndex?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"Asset"> | Date | string
|
||||
@@ -512,7 +512,7 @@ export type AssetCreateInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -547,7 +547,7 @@ export type AssetUncheckedCreateInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -582,7 +582,7 @@ export type AssetUpdateInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -617,7 +617,7 @@ export type AssetUncheckedUpdateInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -652,7 +652,7 @@ export type AssetCreateManyInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -676,7 +676,7 @@ export type AssetUpdateManyMutationInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -695,7 +695,7 @@ export type AssetUncheckedUpdateManyInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -744,7 +744,7 @@ export type AssetCountOrderByAggregateInput = {
|
||||
status?: Prisma.SortOrder
|
||||
transcodeTaskId?: Prisma.SortOrder
|
||||
media?: Prisma.SortOrder
|
||||
removed?: Prisma.SortOrder
|
||||
isDeleted?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrder
|
||||
sortIndex?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
@@ -771,7 +771,7 @@ export type AssetMaxOrderByAggregateInput = {
|
||||
sizeByte?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
transcodeTaskId?: Prisma.SortOrder
|
||||
removed?: Prisma.SortOrder
|
||||
isDeleted?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrder
|
||||
sortIndex?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
@@ -793,7 +793,7 @@ export type AssetMinOrderByAggregateInput = {
|
||||
sizeByte?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
transcodeTaskId?: Prisma.SortOrder
|
||||
removed?: Prisma.SortOrder
|
||||
isDeleted?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrder
|
||||
sortIndex?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
@@ -1223,7 +1223,7 @@ export type AssetCreateWithoutCreatorInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1257,7 +1257,7 @@ export type AssetUncheckedCreateWithoutCreatorInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1320,7 +1320,7 @@ export type AssetScalarWhereInput = {
|
||||
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||
media?: Prisma.JsonNullableFilter<"Asset">
|
||||
removed?: Prisma.BoolFilter<"Asset"> | boolean
|
||||
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
||||
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"Asset"> | Date | string
|
||||
@@ -1344,7 +1344,7 @@ export type AssetCreateWithoutTeamRootFolderInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1378,7 +1378,7 @@ export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1428,7 +1428,7 @@ export type AssetUpdateWithoutTeamRootFolderInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -1462,7 +1462,7 @@ export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -1496,7 +1496,7 @@ export type AssetCreateWithoutProjectRootFolderInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1530,7 +1530,7 @@ export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1569,7 +1569,7 @@ export type AssetCreateWithoutProjectShareRootInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1603,7 +1603,7 @@ export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1642,7 +1642,7 @@ export type AssetCreateWithoutProjectInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1676,7 +1676,7 @@ export type AssetUncheckedCreateWithoutProjectInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1731,7 +1731,7 @@ export type AssetUpdateWithoutProjectRootFolderInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -1765,7 +1765,7 @@ export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -1810,7 +1810,7 @@ export type AssetUpdateWithoutProjectShareRootInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -1844,7 +1844,7 @@ export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -1894,7 +1894,7 @@ export type AssetCreateWithoutShareLinkRootFolderInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1928,7 +1928,7 @@ export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -1978,7 +1978,7 @@ export type AssetUpdateWithoutShareLinkRootFolderInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2012,7 +2012,7 @@ export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2046,7 +2046,7 @@ export type AssetCreateWithoutChildrenInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2080,7 +2080,7 @@ export type AssetUncheckedCreateWithoutChildrenInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2119,7 +2119,7 @@ export type AssetCreateWithoutParentInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2153,7 +2153,7 @@ export type AssetUncheckedCreateWithoutParentInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2197,7 +2197,7 @@ export type AssetCreateWithoutSymlinksInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2231,7 +2231,7 @@ export type AssetUncheckedCreateWithoutSymlinksInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2270,7 +2270,7 @@ export type AssetCreateWithoutTargetInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2304,7 +2304,7 @@ export type AssetUncheckedCreateWithoutTargetInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2359,7 +2359,7 @@ export type AssetUpdateWithoutChildrenInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2393,7 +2393,7 @@ export type AssetUncheckedUpdateWithoutChildrenInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2454,7 +2454,7 @@ export type AssetUpdateWithoutSymlinksInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2488,7 +2488,7 @@ export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2538,7 +2538,7 @@ export type AssetCreateWithoutMetadataValuesInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2572,7 +2572,7 @@ export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2622,7 +2622,7 @@ export type AssetUpdateWithoutMetadataValuesInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2656,7 +2656,7 @@ export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2690,7 +2690,7 @@ export type AssetCreateWithoutCommentsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2724,7 +2724,7 @@ export type AssetUncheckedCreateWithoutCommentsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2774,7 +2774,7 @@ export type AssetUpdateWithoutCommentsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2808,7 +2808,7 @@ export type AssetUncheckedUpdateWithoutCommentsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2842,7 +2842,7 @@ export type AssetCreateWithoutCommentAttachmentsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2876,7 +2876,7 @@ export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -2926,7 +2926,7 @@ export type AssetUpdateWithoutCommentAttachmentsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2960,7 +2960,7 @@ export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -2994,7 +2994,7 @@ export type AssetCreateWithoutEmbeddingsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3028,7 +3028,7 @@ export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3078,7 +3078,7 @@ export type AssetUpdateWithoutEmbeddingsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3112,7 +3112,7 @@ export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3146,7 +3146,7 @@ export type AssetCreateWithoutNotificationsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3180,7 +3180,7 @@ export type AssetUncheckedCreateWithoutNotificationsInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3230,7 +3230,7 @@ export type AssetUpdateWithoutNotificationsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3264,7 +3264,7 @@ export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3298,7 +3298,7 @@ export type AssetCreateWithoutTaskInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3332,7 +3332,7 @@ export type AssetUncheckedCreateWithoutTaskInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3392,7 +3392,7 @@ export type AssetCreateManyCreatorInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3415,7 +3415,7 @@ export type AssetUpdateWithoutCreatorInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3449,7 +3449,7 @@ export type AssetUncheckedUpdateWithoutCreatorInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3483,7 +3483,7 @@ export type AssetUncheckedUpdateManyWithoutCreatorInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3506,7 +3506,7 @@ export type AssetCreateManyProjectInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3529,7 +3529,7 @@ export type AssetUpdateWithoutProjectInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3563,7 +3563,7 @@ export type AssetUncheckedUpdateWithoutProjectInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3597,7 +3597,7 @@ export type AssetUncheckedUpdateManyWithoutProjectInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3620,7 +3620,7 @@ export type AssetCreateManyParentInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3643,7 +3643,7 @@ export type AssetCreateManyTargetInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3666,7 +3666,7 @@ export type AssetUpdateWithoutParentInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3700,7 +3700,7 @@ export type AssetUncheckedUpdateWithoutParentInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3734,7 +3734,7 @@ export type AssetUncheckedUpdateManyWithoutParentInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3757,7 +3757,7 @@ export type AssetUpdateWithoutTargetInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3791,7 +3791,7 @@ export type AssetUncheckedUpdateWithoutTargetInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3825,7 +3825,7 @@ export type AssetUncheckedUpdateManyWithoutTargetInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3848,7 +3848,7 @@ export type AssetCreateManyTaskInput = {
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
@@ -3871,7 +3871,7 @@ export type AssetUpdateWithoutTaskInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3905,7 +3905,7 @@ export type AssetUncheckedUpdateWithoutTaskInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -3939,7 +3939,7 @@ export type AssetUncheckedUpdateManyWithoutTaskInput = {
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
removed?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -4047,7 +4047,7 @@ export type AssetSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
status?: boolean
|
||||
transcodeTaskId?: boolean
|
||||
media?: boolean
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: boolean
|
||||
sortIndex?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4088,7 +4088,7 @@ export type AssetSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
||||
status?: boolean
|
||||
transcodeTaskId?: boolean
|
||||
media?: boolean
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: boolean
|
||||
sortIndex?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4117,7 +4117,7 @@ export type AssetSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
||||
status?: boolean
|
||||
transcodeTaskId?: boolean
|
||||
media?: boolean
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: boolean
|
||||
sortIndex?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4146,7 +4146,7 @@ export type AssetSelectScalar = {
|
||||
status?: boolean
|
||||
transcodeTaskId?: boolean
|
||||
media?: boolean
|
||||
removed?: boolean
|
||||
isDeleted?: boolean
|
||||
deletedAt?: boolean
|
||||
sortIndex?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4158,7 +4158,7 @@ export type AssetSelectScalar = {
|
||||
projectId?: boolean
|
||||
}
|
||||
|
||||
export type AssetOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "nameNgram" | "key" | "type" | "mediaType" | "fileCount" | "sizeByte" | "status" | "transcodeTaskId" | "media" | "removed" | "deletedAt" | "sortIndex" | "createdAt" | "updatedAt" | "parentId" | "targetId" | "creatorId" | "taskId" | "projectId", ExtArgs["result"]["asset"]>
|
||||
export type AssetOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "nameNgram" | "key" | "type" | "mediaType" | "fileCount" | "sizeByte" | "status" | "transcodeTaskId" | "media" | "isDeleted" | "deletedAt" | "sortIndex" | "createdAt" | "updatedAt" | "parentId" | "targetId" | "creatorId" | "taskId" | "projectId", ExtArgs["result"]["asset"]>
|
||||
export type AssetInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
parent?: boolean | Prisma.Asset$parentArgs<ExtArgs>
|
||||
children?: boolean | Prisma.Asset$childrenArgs<ExtArgs>
|
||||
@@ -4228,7 +4228,7 @@ export type $AssetPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
* [MediaInfo]
|
||||
*/
|
||||
media:PrismaJson.MediaInfo | null
|
||||
removed: boolean
|
||||
isDeleted: boolean
|
||||
deletedAt: Date | null
|
||||
sortIndex: string | null
|
||||
createdAt: Date
|
||||
@@ -4688,7 +4688,7 @@ export interface AssetFieldRefs {
|
||||
readonly status: Prisma.FieldRef<"Asset", 'AssetStatus'>
|
||||
readonly transcodeTaskId: Prisma.FieldRef<"Asset", 'String'>
|
||||
readonly media: Prisma.FieldRef<"Asset", 'Json'>
|
||||
readonly removed: Prisma.FieldRef<"Asset", 'Boolean'>
|
||||
readonly isDeleted: Prisma.FieldRef<"Asset", 'Boolean'>
|
||||
readonly deletedAt: Prisma.FieldRef<"Asset", 'DateTime'>
|
||||
readonly sortIndex: Prisma.FieldRef<"Asset", 'String'>
|
||||
readonly createdAt: Prisma.FieldRef<"Asset", 'DateTime'>
|
||||
|
||||
@@ -2,13 +2,15 @@ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { prisma } from '@/db'
|
||||
import { setupTestDbHooks } from '@/db-test-hooks'
|
||||
|
||||
import { AssetType } from '@/generated/prisma/client.ts'
|
||||
import { AssetType, AssetStatus } from '@/generated/prisma/client.ts'
|
||||
import { AssetService } from './asset'
|
||||
|
||||
vi.mock('@/services/s3/s3', () => ({
|
||||
s3Service: {
|
||||
presign: vi.fn().mockResolvedValue('http://mock-s3-url'),
|
||||
putObject: vi.fn().mockResolvedValue(undefined),
|
||||
deleteObject: vi.fn().mockResolvedValue(1),
|
||||
deletePrefix: vi.fn().mockResolvedValue(1),
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -412,12 +414,12 @@ describe('AssetService', () => {
|
||||
const folderA = await prisma.asset.findUnique({
|
||||
where: { id: assets.folderA.id },
|
||||
})
|
||||
expect(folderA?.removed).toBe(true)
|
||||
expect(folderA?.isDeleted).toBe(true)
|
||||
|
||||
const fileA1 = await prisma.asset.findUnique({
|
||||
where: { id: assets.fileA1.id },
|
||||
})
|
||||
expect(fileA1?.removed).toBe(true)
|
||||
expect(fileA1?.isDeleted).toBe(true)
|
||||
|
||||
// Verify root size decreased by folderA's size
|
||||
await verifyAsset(assets.root.id, {
|
||||
@@ -432,14 +434,14 @@ describe('AssetService', () => {
|
||||
const folderRestoredA = await prisma.asset.findUnique({
|
||||
where: { id: assets.folderA.id },
|
||||
})
|
||||
expect(folderRestoredA?.removed).toBe(false)
|
||||
expect(folderRestoredA?.isDeleted).toBe(false)
|
||||
|
||||
expect(folderRestoredA?.deletedAt).toBeNull()
|
||||
|
||||
const fileA1Restored = await prisma.asset.findUnique({
|
||||
where: { id: assets.fileA1.id },
|
||||
})
|
||||
expect(fileA1Restored?.removed).toBe(false)
|
||||
expect(fileA1Restored?.isDeleted).toBe(false)
|
||||
|
||||
// Verify root restored properly
|
||||
await verifyAsset(assets.root.id, {
|
||||
@@ -1173,4 +1175,93 @@ describe('AssetService', () => {
|
||||
expect(versions[1].name).toBe('version1.txt')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Asset Cascade Bug (Reproduction)', () => {
|
||||
it('should NOT cascade delete children from DB before their S3 files are deleted', async () => {
|
||||
const { project } = await setupBasicAssets()
|
||||
const { s3Service } = await import('@/services/s3/s3')
|
||||
|
||||
// 1. Create Folder A
|
||||
const folderA = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Folder A',
|
||||
type: AssetType.folder,
|
||||
status: 'pending_purge',
|
||||
isDeleted: true,
|
||||
projectId: project.id,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Create 101 children files for Folder A
|
||||
// Each has an S3 key.
|
||||
const childCount = 101
|
||||
const childData = Array.from({ length: childCount }).map((_, i) => ({
|
||||
name: `File ${i}`,
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.pending_purge,
|
||||
isDeleted: true,
|
||||
projectId: project.id,
|
||||
parentId: folderA.id,
|
||||
key: `key-${i}`,
|
||||
}))
|
||||
|
||||
await prisma.asset.createMany({ data: childData })
|
||||
|
||||
// 3. Trigger the purge job for the FIRST batch (100 items)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await (assetService as any).purgePendingAssets()
|
||||
|
||||
// 4. Verify some items were processed in S3
|
||||
// We don't know the order, but if Folder A was in the first 100,
|
||||
// then its synchronous cascade will have wiped the remaining children.
|
||||
|
||||
// 5. Trigger the purge job for the SECOND batch
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await (assetService as any).purgePendingAssets()
|
||||
|
||||
// 6. Verify S3 deletion was called for EVERY child
|
||||
for (let i = 0; i < childCount; i++) {
|
||||
expect(s3Service.deleteObject).toHaveBeenCalledWith(expect.any(String), `key-${i}`)
|
||||
}
|
||||
|
||||
// Verify folder and all children are gone from DB
|
||||
expect(await prisma.asset.findUnique({ where: { id: folderA.id } })).toBeNull()
|
||||
const remainingChildren = await prisma.asset.count({ where: { parentId: folderA.id } })
|
||||
expect(remainingChildren).toBe(0)
|
||||
})
|
||||
|
||||
it('should delete the entire directory prefix for assets with complex keys (e.g., file/ULID/raw)', async () => {
|
||||
const { project } = await setupBasicAssets()
|
||||
const { s3Service } = await import('@/services/s3/s3')
|
||||
|
||||
// Create an asset with a complex key
|
||||
const complexFile = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Complex File',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.pending_purge,
|
||||
isDeleted: true,
|
||||
projectId: project.id,
|
||||
key: 'file/01KSBRJVY3DPK111S2MECFKDQ4/raw',
|
||||
},
|
||||
})
|
||||
|
||||
// Trigger the purge job
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await (assetService as any).purgePendingAssets()
|
||||
|
||||
// Verify deletePrefix was called with the correct prefix instead of just deleteObject
|
||||
expect(s3Service.deletePrefix).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'file/01KSBRJVY3DPK111S2MECFKDQ4/',
|
||||
)
|
||||
expect(s3Service.deleteObject).not.toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'file/01KSBRJVY3DPK111S2MECFKDQ4/raw',
|
||||
)
|
||||
|
||||
// Verify record is gone
|
||||
expect(await prisma.asset.findUnique({ where: { id: complexFile.id } })).toBeNull()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
+164
-12
@@ -1,4 +1,5 @@
|
||||
import { prisma } from '@/db'
|
||||
import { logger } from '@/logger'
|
||||
import {
|
||||
AncestorFolder,
|
||||
AssetInfo,
|
||||
@@ -359,16 +360,16 @@ export class AssetService {
|
||||
|
||||
let where: Prisma.AssetWhereInput = {}
|
||||
|
||||
if (req.showRemoved) {
|
||||
if (req.showDeleted) {
|
||||
if (!req.projectId) {
|
||||
throw new Error('ProjectID is required when ShowRemoved is true')
|
||||
throw new Error('ProjectID is required when ShowDeleted is true')
|
||||
}
|
||||
const thirtyDaysAgo = new Date()
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30)
|
||||
|
||||
where = {
|
||||
projectId: req.projectId,
|
||||
removed: true,
|
||||
isDeleted: true,
|
||||
deletedAt: { gte: thirtyDaysAgo },
|
||||
OR: [
|
||||
{ type: { in: typesToQuery } },
|
||||
@@ -377,7 +378,7 @@ export class AssetService {
|
||||
}
|
||||
} else {
|
||||
if (!req.assetId) {
|
||||
throw new Error('AssetId is required when ShowRemoved is false')
|
||||
throw new Error('AssetId is required when ShowDeleted is false')
|
||||
}
|
||||
let parentId = req.assetId
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
@@ -389,7 +390,7 @@ export class AssetService {
|
||||
|
||||
where = {
|
||||
parentId,
|
||||
removed: false,
|
||||
isDeleted: false,
|
||||
OR: [
|
||||
{ type: { in: typesToQuery } },
|
||||
{ type: AssetType.symlink, target: { type: { in: typesToQuery } } },
|
||||
@@ -637,7 +638,7 @@ export class AssetService {
|
||||
|
||||
if (currentType === AssetType.version_stack) {
|
||||
const latestChild = await this.prismaClient.asset.findFirst({
|
||||
where: { parentId: currentId, removed: false },
|
||||
where: { parentId: currentId, isDeleted: false },
|
||||
orderBy: { sortIndex: 'desc' },
|
||||
select: { id: true },
|
||||
})
|
||||
@@ -742,13 +743,17 @@ export class AssetService {
|
||||
if (descendantIds.length > 0) {
|
||||
await tx.asset.updateMany({
|
||||
where: { id: { in: descendantIds } },
|
||||
data: { removed: true },
|
||||
data: { isDeleted: true },
|
||||
})
|
||||
}
|
||||
|
||||
await tx.asset.update({
|
||||
where: { id: a.id },
|
||||
data: { removed: true, deletedAt: new Date() },
|
||||
data: {
|
||||
isDeleted: true,
|
||||
status: 'trashed',
|
||||
deletedAt: new Date(),
|
||||
},
|
||||
})
|
||||
|
||||
await this.updateAncestorsSize(tx, a.parentId, -a.sizeByte)
|
||||
@@ -756,6 +761,149 @@ export class AssetService {
|
||||
}
|
||||
}
|
||||
|
||||
private cleanupJobsRunning = false
|
||||
|
||||
startCleanupJob() {
|
||||
this.cleanupJobsRunning = true
|
||||
|
||||
// Stage 1: Expiration Job - Move expired trashed roots to pending_purge
|
||||
const runExpiration = async () => {
|
||||
if (!this.cleanupJobsRunning) return
|
||||
try {
|
||||
await this.expireTrashedAssets()
|
||||
} catch (e: unknown) {
|
||||
console.error('Error in asset expiration job:', e)
|
||||
}
|
||||
setTimeout(runExpiration, 5000) // Run every 5 seconds, less frequent
|
||||
}
|
||||
|
||||
// Stage 2: Physical Purge Job - Delete files from S3 and wipe from DB
|
||||
const runPurge = async () => {
|
||||
if (!this.cleanupJobsRunning) return
|
||||
try {
|
||||
await this.purgePendingAssets()
|
||||
} catch (e: unknown) {
|
||||
console.error('Error in asset purge job:', e)
|
||||
}
|
||||
setTimeout(runPurge, 1000) // Run every 1 second
|
||||
}
|
||||
|
||||
runExpiration()
|
||||
runPurge()
|
||||
}
|
||||
|
||||
stopCleanupJob() {
|
||||
this.cleanupJobsRunning = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage 1: Find root assets that have been in the trash for > 30 days.
|
||||
* Cascade the 'pending_purge' status to all their descendants.
|
||||
*/
|
||||
private async expireTrashedAssets() {
|
||||
const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
|
||||
|
||||
// Find up to 100 expired roots, ordered by oldest first to avoid starvation
|
||||
const expiredRoots = await this.prismaClient.asset.findMany({
|
||||
where: {
|
||||
status: 'trashed',
|
||||
deletedAt: { lt: thirtyDaysAgo },
|
||||
isDeleted: true,
|
||||
},
|
||||
orderBy: { deletedAt: 'asc' },
|
||||
select: { id: true },
|
||||
take: 100,
|
||||
})
|
||||
|
||||
for (const root of expiredRoots) {
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
// Use recursive CTE to find all descendants and mark them all as pending_purge
|
||||
await tx.$executeRaw`
|
||||
WITH RECURSIVE descendant AS (
|
||||
SELECT id FROM assets WHERE id = ${root.id}
|
||||
UNION ALL
|
||||
SELECT a.id FROM assets a
|
||||
INNER JOIN descendant d ON a.parent_id = d.id
|
||||
)
|
||||
UPDATE assets SET status = 'pending_purge', updated_at = NOW()
|
||||
WHERE id IN (SELECT id FROM descendant);
|
||||
`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage 2: Physically delete files and DB records for assets marked as 'pending_purge'.
|
||||
*/
|
||||
private async purgePendingAssets() {
|
||||
// 1. Lock 100 assets using raw SQL FOR UPDATE SKIP LOCKED and mark them as 'purging'
|
||||
// We include a timeout check (1 hour) to allow picking up stalled tasks.
|
||||
const lockedAssets = await this.prismaClient.$queryRaw<{ id: string; key: string | null }[]>`
|
||||
WITH to_purge AS (
|
||||
SELECT id FROM assets
|
||||
WHERE status = 'pending_purge'
|
||||
OR (status = 'purging' AND updated_at < NOW() - INTERVAL '1 hour')
|
||||
LIMIT 100
|
||||
FOR UPDATE SKIP LOCKED
|
||||
)
|
||||
UPDATE assets SET status = 'purging', updated_at = NOW()
|
||||
WHERE id IN (SELECT id FROM to_purge)
|
||||
RETURNING id, key;
|
||||
`
|
||||
|
||||
if (lockedAssets.length === 0) return
|
||||
|
||||
let physicalFilesDeleted = 0
|
||||
let physicalFoldersDeleted = 0
|
||||
|
||||
// 2. Physical file deletion from storage
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const results = await Promise.all(
|
||||
lockedAssets.map(async (a) => {
|
||||
if (a.key) {
|
||||
try {
|
||||
// Check if this asset has a dedicated directory (e.g., file/ULID/raw)
|
||||
// If it has more than one slash, we delete the entire containing directory
|
||||
// to ensure transcodes/thumbnails are also removed.
|
||||
const parts = a.key.split('/')
|
||||
if (parts.length > 2) {
|
||||
const prefix = parts.slice(0, parts.length - 1).join('/') + '/'
|
||||
const count = await s3Service.deletePrefix(bucket, prefix)
|
||||
physicalFilesDeleted += count
|
||||
physicalFoldersDeleted += 1
|
||||
} else {
|
||||
const count = await s3Service.deleteObject(bucket, a.key)
|
||||
physicalFilesDeleted += count
|
||||
}
|
||||
return a.id
|
||||
} catch (e: unknown) {
|
||||
console.error(`Failed to delete storage object(s) for ${a.key}:`, e)
|
||||
return null
|
||||
}
|
||||
}
|
||||
// Assets without keys (folders, etc.) are considered processed
|
||||
return a.id
|
||||
}),
|
||||
)
|
||||
|
||||
// 3. Hard delete from database ONLY for assets successfully removed from storage
|
||||
const successfulIds = results.filter((id): id is string => id !== null)
|
||||
if (successfulIds.length > 0) {
|
||||
await this.prismaClient.asset.deleteMany({
|
||||
where: { id: { in: successfulIds } },
|
||||
})
|
||||
|
||||
logger.info(
|
||||
{
|
||||
purgedCount: successfulIds.length,
|
||||
physicalFilesDeleted,
|
||||
physicalFoldersDeleted,
|
||||
},
|
||||
`${successfulIds.length} assets purged, deleted ${physicalFilesDeleted} files in ${physicalFoldersDeleted} folders`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async restoreAssets(ids: string[]): Promise<void> {
|
||||
for (const id of ids) {
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
@@ -785,13 +933,17 @@ export class AssetService {
|
||||
if (descendantIds.length > 0) {
|
||||
await tx.asset.updateMany({
|
||||
where: { id: { in: descendantIds } },
|
||||
data: { removed: false },
|
||||
data: { isDeleted: false },
|
||||
})
|
||||
}
|
||||
|
||||
await tx.asset.update({
|
||||
where: { id: a.id },
|
||||
data: { removed: false, deletedAt: null },
|
||||
data: {
|
||||
isDeleted: false,
|
||||
status: 'processed',
|
||||
deletedAt: null,
|
||||
},
|
||||
})
|
||||
|
||||
await this.updateAncestorsSize(tx, a.parentId, a.sizeByte)
|
||||
@@ -1003,7 +1155,7 @@ export class AssetService {
|
||||
const versionsMap = new Map<string, AssetWithIncludes['children'][0][]>()
|
||||
if (stackIds.size > 0) {
|
||||
const allVersions = await this.prismaClient.asset.findMany({
|
||||
where: { parentId: { in: Array.from(stackIds) }, removed: false },
|
||||
where: { parentId: { in: Array.from(stackIds) }, isDeleted: false },
|
||||
include: { creator: true, metadataValues: true },
|
||||
})
|
||||
for (const v of allVersions) {
|
||||
@@ -1160,7 +1312,7 @@ export class AssetService {
|
||||
}>
|
||||
> {
|
||||
const versions = await this.prismaClient.asset.findMany({
|
||||
where: { parentId: stackId, removed: false },
|
||||
where: { parentId: stackId, isDeleted: false },
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
|
||||
@@ -3,10 +3,13 @@ import { prisma } from '@/db'
|
||||
import { setupTestDbHooks } from '@/db-test-hooks'
|
||||
import { ProjectService } from './project'
|
||||
import { s3Service } from '@/services/s3/s3'
|
||||
import { assetService } from '@/services/asset/asset'
|
||||
|
||||
vi.mock('@/services/s3/s3', () => ({
|
||||
s3Service: {
|
||||
presign: vi.fn(),
|
||||
deleteObject: vi.fn().mockResolvedValue(1),
|
||||
deletePrefix: vi.fn().mockResolvedValue(1),
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -218,4 +221,142 @@ describe('ProjectService', () => {
|
||||
expect(p?.shareRoot?.name).toBe('share_root')
|
||||
})
|
||||
})
|
||||
|
||||
describe('deleteProject', () => {
|
||||
it('detaches and soft-deletes project assets', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Delete Team' } })
|
||||
const u = await prisma.user.create({ data: { name: 'u', email: 'delete@example.com' } })
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: u.id, role: 'owner' },
|
||||
})
|
||||
|
||||
const project = await projectService.createProject(u, {
|
||||
name: 'Project to Delete',
|
||||
teamId: team.id,
|
||||
})
|
||||
|
||||
// Add some related data
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Test Asset',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
key: 'asset-key',
|
||||
},
|
||||
})
|
||||
|
||||
// Set cover image key
|
||||
await prisma.project.update({
|
||||
where: { id: project.id },
|
||||
data: { coverImageKey: 'cover-key' },
|
||||
})
|
||||
|
||||
// Delete project
|
||||
await projectService.deleteProject(project.id)
|
||||
|
||||
// Verify project is deleted
|
||||
const p = await prisma.project.findUnique({ where: { id: project.id } })
|
||||
expect(p).toBeNull()
|
||||
|
||||
// Verify asset is soft-deleted and detached
|
||||
const a = await prisma.asset.findUnique({ where: { id: asset.id } })
|
||||
expect(a).toBeDefined()
|
||||
expect(a?.isDeleted).toBe(true)
|
||||
expect(a?.projectId).toBeNull()
|
||||
expect(a?.parentId).toBeNull()
|
||||
|
||||
// Verify S3 project cover cleanup (synchronous)
|
||||
expect(s3Service.deleteObject).toHaveBeenCalledWith(expect.any(String), 'cover-key')
|
||||
// S3 asset key cleanup is NOT called synchronously
|
||||
expect(s3Service.deleteObject).not.toHaveBeenCalledWith(expect.any(String), 'asset-key')
|
||||
})
|
||||
|
||||
it('cleans up nested hierarchy asynchronously in background job', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Nested Team' } })
|
||||
const u = await prisma.user.create({ data: { name: 'u', email: 'nested@example.com' } })
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: u.id, role: 'owner' },
|
||||
})
|
||||
|
||||
const project = await projectService.createProject(u, {
|
||||
name: 'Nested Project',
|
||||
teamId: team.id,
|
||||
})
|
||||
|
||||
const projectDb = await prisma.project.findUnique({ where: { id: project.id } })
|
||||
|
||||
// Create hierarchy: Folder A -> Folder B -> File C
|
||||
const folderA = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Folder A',
|
||||
type: 'folder',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
parentId: projectDb!.rootFolderId,
|
||||
},
|
||||
})
|
||||
const folderB = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Folder B',
|
||||
type: 'folder',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
parentId: folderA.id,
|
||||
},
|
||||
})
|
||||
const fileC = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'File C',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
parentId: folderB.id,
|
||||
key: 'file-c-key',
|
||||
},
|
||||
})
|
||||
|
||||
// Add metadata and comments to verify cascade
|
||||
await prisma.assetMetadataValue.create({
|
||||
data: {
|
||||
assetId: fileC.id,
|
||||
fieldId: 'test-field',
|
||||
stringValue: 'test-value',
|
||||
},
|
||||
})
|
||||
const comment = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: fileC.id,
|
||||
message: 'Test comment',
|
||||
},
|
||||
})
|
||||
|
||||
// Delete project
|
||||
await projectService.deleteProject(project.id)
|
||||
|
||||
// Manually trigger the private cleanup methods for testing
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
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()
|
||||
expect(await prisma.asset.findUnique({ where: { id: folderA.id } })).toBeNull()
|
||||
expect(await prisma.asset.findUnique({ where: { id: folderB.id } })).toBeNull()
|
||||
expect(await prisma.asset.findUnique({ where: { id: fileC.id } })).toBeNull()
|
||||
|
||||
// Verify cascade
|
||||
expect(
|
||||
await prisma.assetMetadataValue.findUnique({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
where: { assetId_fieldId: { assetId: fileC.id, fieldId: 'test-field' } },
|
||||
}),
|
||||
).toBeNull()
|
||||
expect(await prisma.assetComment.findUnique({ where: { id: comment.id } })).toBeNull()
|
||||
|
||||
// Verify S3 cleanup for file
|
||||
expect(s3Service.deleteObject).toHaveBeenCalledWith(expect.any(String), 'file-c-key')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -130,7 +130,7 @@ export class ProjectService {
|
||||
const direction = req.sortDirection === 'desc' ? 'desc' : 'asc'
|
||||
if (req.sortBy) {
|
||||
if (req.sortBy === 'created_at') {
|
||||
orderBy.id = direction
|
||||
orderBy.createdAt = direction
|
||||
} else if (req.sortBy === 'updated_at') {
|
||||
orderBy.updatedAt = direction
|
||||
} else {
|
||||
@@ -224,6 +224,63 @@ export class ProjectService {
|
||||
}))
|
||||
}
|
||||
|
||||
async deleteProject(projectId: string): Promise<void> {
|
||||
const project = await prisma.project.findUnique({
|
||||
where: { id: projectId },
|
||||
})
|
||||
if (!project) throw new Error('Project not found')
|
||||
|
||||
const immediateCleanupDate = new Date(0)
|
||||
|
||||
await prisma.$transaction(async (tx) => {
|
||||
// 1. Mark ALL project assets as isDeleted and detach projectId
|
||||
// We keep parentId intact so the folder structure remains for Stage 1 cleanup.
|
||||
await tx.asset.updateMany({
|
||||
where: { projectId },
|
||||
data: {
|
||||
isDeleted: true,
|
||||
projectId: null,
|
||||
},
|
||||
})
|
||||
|
||||
// 2. Mark root folders as 'trashed' with deletedAt = 0 to trigger immediate background purge
|
||||
const rootIds = [project.rootFolderId, project.shareRootId].filter(
|
||||
(id): id is string => id !== null,
|
||||
)
|
||||
if (rootIds.length > 0) {
|
||||
await tx.asset.updateMany({
|
||||
where: { id: { in: rootIds } },
|
||||
data: {
|
||||
status: 'trashed',
|
||||
deletedAt: immediateCleanupDate,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 3. Unlink root folders from project record to avoid FK cycles during project deletion
|
||||
await tx.project.update({
|
||||
where: { id: projectId },
|
||||
data: { rootFolderId: null, shareRootId: null },
|
||||
})
|
||||
|
||||
// 4. Delete the project itself
|
||||
// Cascade deletes will handle project members, invites, notifications, etc.
|
||||
await tx.project.delete({
|
||||
where: { id: projectId },
|
||||
})
|
||||
})
|
||||
|
||||
// Synchronously delete the project's cover image if it exists
|
||||
if (project.coverImageKey) {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
try {
|
||||
await s3Service.deleteObject(bucket, project.coverImageKey)
|
||||
} catch (e: unknown) {
|
||||
console.error(`Failed to delete project cover image ${project.coverImageKey}:`, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getProjectRootFolder(projectId: string): Promise<string> {
|
||||
const project = await prisma.project.findUnique({
|
||||
where: { id: projectId },
|
||||
|
||||
+57
-1
@@ -1,5 +1,6 @@
|
||||
import { ObjectInfo } from '@/dtos/s3'
|
||||
import {
|
||||
DeleteObjectCommand,
|
||||
GetObjectCommand,
|
||||
HeadObjectCommand,
|
||||
ListObjectsV2Command,
|
||||
@@ -49,6 +50,8 @@ export interface S3Service {
|
||||
): Promise<void>
|
||||
getObject(bucket: string, key: string): Promise<S3Object>
|
||||
downloadToFile(bucket: string, key: string, filePath: string): Promise<void>
|
||||
deleteObject(bucket: string, key: string): Promise<number>
|
||||
deletePrefix(bucket: string, prefix: string): Promise<number>
|
||||
headObject(bucket: string, key: string): Promise<ObjectInfo>
|
||||
listObjects(bucket: string, prefix: string): Promise<string[]>
|
||||
uploadFile(filePath: string, contentType: string): Promise<string>
|
||||
@@ -157,6 +160,28 @@ export class S3StorageService implements S3Service {
|
||||
})
|
||||
}
|
||||
|
||||
async deleteObject(bucket: string, key: string): Promise<number> {
|
||||
const command = new DeleteObjectCommand({
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
})
|
||||
try {
|
||||
await this.client.send(command)
|
||||
return 1
|
||||
} catch {
|
||||
// If object doesn't exist, we return 0
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
async deletePrefix(bucket: string, prefix: string): Promise<number> {
|
||||
const keys = await this.listObjects(bucket, prefix)
|
||||
if (keys.length > 0) {
|
||||
await Promise.all(keys.map((key) => this.deleteObject(bucket, key)))
|
||||
}
|
||||
return keys.length
|
||||
}
|
||||
|
||||
async headObject(bucket: string, key: string): Promise<ObjectInfo> {
|
||||
const command = new HeadObjectCommand({
|
||||
Bucket: bucket,
|
||||
@@ -246,7 +271,7 @@ export class LocalStorageService implements S3Service {
|
||||
private basePath: string
|
||||
private endpoint: string
|
||||
|
||||
constructor(endpoint: string, basePath: string = 'data/s3/data') {
|
||||
constructor(endpoint: string, basePath: string = 'data') {
|
||||
this.endpoint = endpoint.replace(/\/$/, '')
|
||||
this.basePath = path.resolve(basePath)
|
||||
if (!fs.existsSync(this.basePath)) {
|
||||
@@ -311,6 +336,37 @@ export class LocalStorageService implements S3Service {
|
||||
await fs.promises.copyFile(srcPath, filePath)
|
||||
}
|
||||
|
||||
async deleteObject(bucket: string, key: string): Promise<number> {
|
||||
const filePath = this.getFilePath(bucket, key)
|
||||
try {
|
||||
await fs.promises.unlink(filePath)
|
||||
return 1
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') {
|
||||
// Ignore if file doesn't exist
|
||||
return 0
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
async deletePrefix(bucket: string, prefix: string): Promise<number> {
|
||||
// Get count of files before deleting
|
||||
const keys = await this.listObjects(bucket, prefix)
|
||||
if (keys.length === 0) return 0
|
||||
|
||||
const dirPath = this.getFilePath(bucket, prefix)
|
||||
try {
|
||||
await fs.promises.rm(dirPath, { recursive: true, force: true })
|
||||
return keys.length
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') {
|
||||
return 0
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
async headObject(bucket: string, key: string): Promise<ObjectInfo> {
|
||||
const filePath = this.getFilePath(bucket, key)
|
||||
try {
|
||||
|
||||
@@ -22,7 +22,7 @@ export class SearchService {
|
||||
}
|
||||
|
||||
const where: Prisma.AssetWhereInput = {
|
||||
removed: false,
|
||||
isDeleted: false,
|
||||
}
|
||||
|
||||
if (targetFolderIds.length > 0) {
|
||||
|
||||
@@ -5,17 +5,6 @@ import {
|
||||
ContextMenuSeparator,
|
||||
} from '@/ui/components/ui/context-menu'
|
||||
import { Download, Edit, FolderPlus, Trash2, UploadCloud, History, FileText } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '../ui/alert-dialog'
|
||||
|
||||
interface FileBrowserContextMenuProps {
|
||||
item: AssetInfo | null
|
||||
@@ -52,14 +41,11 @@ export function FileBrowserContextMenu({
|
||||
isShareView,
|
||||
onRemoveFromShare,
|
||||
}: FileBrowserContextMenuProps) {
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false)
|
||||
|
||||
const allItems = [...folders, ...files]
|
||||
const selectedItems = allItems.filter((i) => selectedIds.has(i.id!))
|
||||
const isItemSelected = item && selectedIds.has(item.id!)
|
||||
const itemsToModify = isItemSelected ? selectedItems : item ? [item] : []
|
||||
const itemsToDelete = itemsToModify
|
||||
const deleteCount = itemsToDelete.length
|
||||
const itemsToRestore = itemsToModify
|
||||
|
||||
const handleRename = () => {
|
||||
@@ -69,7 +55,7 @@ export function FileBrowserContextMenu({
|
||||
}
|
||||
|
||||
const handleDelete = () => {
|
||||
setIsDeleteDialogOpen(true)
|
||||
onDelete(itemsToDelete)
|
||||
}
|
||||
|
||||
const handleDownload = () => {
|
||||
@@ -191,31 +177,5 @@ export function FileBrowserContextMenu({
|
||||
</ContextMenuContent>
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
{contextMenuContent}
|
||||
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
You are about to delete {deleteCount} item(s). Deleted items can be recovered for 30
|
||||
days before being permanently deleted.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={() => {
|
||||
onDelete(itemsToDelete)
|
||||
setIsDeleteDialogOpen(false)
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</>
|
||||
)
|
||||
return <>{contextMenuContent}</>
|
||||
}
|
||||
|
||||
@@ -23,6 +23,16 @@ import { FileListItem } from './file-list-item'
|
||||
import { FolderCard } from './folder-card'
|
||||
import { Button } from '../ui/button'
|
||||
import { ContextMenu, ContextMenuTrigger } from '../ui/context-menu'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '../ui/alert-dialog'
|
||||
import { useFileActions } from './use-file-actions'
|
||||
|
||||
interface FileBrowserProps {
|
||||
@@ -110,6 +120,9 @@ export function FileBrowser({
|
||||
handleDownload,
|
||||
handleAction,
|
||||
onRenameSubmit,
|
||||
isDeleteDialogOpen,
|
||||
setIsDeleteDialogOpen,
|
||||
confirmDelete,
|
||||
} = useFileActions({
|
||||
teamId,
|
||||
projectId,
|
||||
@@ -520,7 +533,7 @@ export function FileBrowser({
|
||||
|
||||
const renderContent = () => {
|
||||
return (
|
||||
<ContextMenu>
|
||||
<ContextMenu modal={false}>
|
||||
<ContextMenuTrigger asChild disabled={isShareView || isPublic}>
|
||||
<div
|
||||
ref={scrollContainerRef}
|
||||
@@ -680,6 +693,28 @@ export function FileBrowser({
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
{renderContent()}
|
||||
|
||||
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete Asset?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Deleted items can be recovered for 30 days before being permanently deleted.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={() => {
|
||||
confirmDelete()
|
||||
}}
|
||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||
>
|
||||
Delete
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ export function FileCard({
|
||||
{displayItem.creator?.name}
|
||||
</p>
|
||||
</div>
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
size="icon-sm"
|
||||
|
||||
@@ -276,7 +276,7 @@ export function FolderCard({
|
||||
<span className="text-xs tracking-wide opacity-80">
|
||||
{item.fileCount || 0} {(item.fileCount || 0) === 1 ? 'Item' : 'Items'}
|
||||
</span>
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -24,6 +24,8 @@ export function useFileActions({
|
||||
selectedIds,
|
||||
}: UseFileActionsProps) {
|
||||
const [editingItemId, setEditingItemId] = useState<string | null>(null)
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false)
|
||||
const [itemsToDelete, setItemsToDelete] = useState<AssetInfo[]>([])
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const $createFolder = client.api.teams[':teamId'].folders.$post
|
||||
@@ -113,9 +115,9 @@ export function useFileActions({
|
||||
setEditingItemId(item.id!)
|
||||
}
|
||||
|
||||
const handleDelete = (items: AssetInfo[]) => {
|
||||
const fileIds = items.filter((i) => i.type === 'file').map((i) => i.id!)
|
||||
const folderIds = items.filter((i) => i.type === 'folder').map((i) => i.id!)
|
||||
const confirmDelete = () => {
|
||||
const fileIds = itemsToDelete.filter((i) => i.type === 'file').map((i) => i.id!)
|
||||
const folderIds = itemsToDelete.filter((i) => i.type === 'folder').map((i) => i.id!)
|
||||
|
||||
if (fileIds.length > 0) {
|
||||
deleteFiles(
|
||||
@@ -142,6 +144,14 @@ export function useFileActions({
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
setIsDeleteDialogOpen(false)
|
||||
setItemsToDelete([])
|
||||
}
|
||||
|
||||
const handleDelete = (items: AssetInfo[]) => {
|
||||
setItemsToDelete(items)
|
||||
setIsDeleteDialogOpen(true)
|
||||
}
|
||||
|
||||
const handleRestore = (items: AssetInfo[]) => {
|
||||
@@ -269,5 +279,9 @@ export function useFileActions({
|
||||
handleNewFolder,
|
||||
handleAction,
|
||||
onRenameSubmit,
|
||||
isDeleteDialogOpen,
|
||||
setIsDeleteDialogOpen,
|
||||
itemsToDelete,
|
||||
confirmDelete,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,14 +26,16 @@ import {
|
||||
import { ShumaiLogo } from '@/ui/components/ui/icons'
|
||||
import { formatDateAgo } from '@/ui/lib/time'
|
||||
import { cn } from '@/ui/lib/utils'
|
||||
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
|
||||
import { useQuery, useSuspenseQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { MoreHorizontal, PlusIcon } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
|
||||
function TeamPage() {
|
||||
const { teamId } = Route.useParams()
|
||||
const navigate = useNavigate()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
// State for clicked project for animation
|
||||
const [clickedProjectId, setClickedProjectId] = useState<string | null>(null)
|
||||
@@ -46,6 +48,7 @@ function TeamPage() {
|
||||
// State for Delete Alert
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false)
|
||||
const [projectToDelete, setProjectToDelete] = useState<ProjectInfo | undefined>(undefined)
|
||||
const [deleteConfirmText, setDeleteConfirmText] = useState('')
|
||||
|
||||
// State for Members Dialog
|
||||
const [isMembersDialogOpen, setIsMembersDialogOpen] = useState(false)
|
||||
@@ -105,6 +108,18 @@ function TeamPage() {
|
||||
},
|
||||
})
|
||||
|
||||
const deleteProjectMutation = useMutation({
|
||||
mutationFn: async (projectId: string) => {
|
||||
const res = await client.api.projects[':projectId'].$delete({
|
||||
param: { projectId },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to delete project')
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'projects'] })
|
||||
},
|
||||
})
|
||||
|
||||
const handleCreateProjectClick = () => {
|
||||
setProjectDialogMode('create')
|
||||
setSelectedProject(undefined)
|
||||
@@ -130,14 +145,19 @@ function TeamPage() {
|
||||
|
||||
const handleDeleteProjectClick = (project: ProjectInfo) => {
|
||||
setProjectToDelete(project)
|
||||
setDeleteConfirmText('')
|
||||
setIsDeleteDialogOpen(true)
|
||||
}
|
||||
|
||||
const handleConfirmDelete = () => {
|
||||
if (projectToDelete) {
|
||||
console.log('Delete project', projectToDelete.id)
|
||||
const handleConfirmDelete = async () => {
|
||||
if (projectToDelete && deleteConfirmText === 'delete') {
|
||||
try {
|
||||
await deleteProjectMutation.mutateAsync(projectToDelete.id!)
|
||||
setIsDeleteDialogOpen(false)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
setIsDeleteDialogOpen(false)
|
||||
}
|
||||
|
||||
const handleCardClick = (projectId: string, e: React.MouseEvent) => {
|
||||
@@ -255,7 +275,7 @@ function TeamPage() {
|
||||
Updated {formatDateAgo((project.updatedAt as string) ?? '')}
|
||||
</p>
|
||||
<div onClick={(e) => e.stopPropagation()}>
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="hover:bg-muted outline-none flex px-1">
|
||||
<MoreHorizontal className="w-5 h-5 text-muted-foreground" />
|
||||
@@ -317,16 +337,34 @@ function TeamPage() {
|
||||
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
This action cannot be undone. This will permanently delete the project "
|
||||
{projectToDelete?.name}".
|
||||
{projectToDelete?.name}" and all its assets.
|
||||
<div className="mt-4 flex flex-col gap-2 text-foreground">
|
||||
<span className="text-sm font-medium">
|
||||
Type <strong>delete</strong> to confirm:
|
||||
</span>
|
||||
<Input
|
||||
value={deleteConfirmText}
|
||||
onChange={(e) => setDeleteConfirmText(e.target.value)}
|
||||
placeholder="delete"
|
||||
className="h-9"
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogCancel disabled={deleteProjectMutation.isPending}>
|
||||
Cancel
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={handleConfirmDelete}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
handleConfirmDelete()
|
||||
}}
|
||||
disabled={deleteConfirmText !== 'delete' || deleteProjectMutation.isPending}
|
||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||
>
|
||||
Delete
|
||||
{deleteProjectMutation.isPending ? 'Deleting...' : 'Delete'}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
|
||||
Reference in New Issue
Block a user