mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
feat(comments): add printable comments page with frame thumbnails and markup overlays (#550)
* feat(comments): add printable comments page with frame thumbnails and markup overlays * fix(comments): guarantee frame-accurate ffmpeg seeking for printable comment thumbnails * fix(comments): address printable comments review findings
This commit is contained in:
@@ -2289,6 +2289,35 @@ export class AssetService {
|
||||
})
|
||||
}
|
||||
|
||||
private getCommentInclude() {
|
||||
return {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
asset: { include: { storageKey: true } },
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' as const },
|
||||
},
|
||||
replies: {
|
||||
include: {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' as const },
|
||||
},
|
||||
},
|
||||
orderBy: { id: 'asc' as const },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
async listComments(
|
||||
assetId: string,
|
||||
params: PaginationParams,
|
||||
@@ -2300,32 +2329,7 @@ export class AssetService {
|
||||
async (skip, take) => {
|
||||
return this.prismaClient.assetComment.findMany({
|
||||
where: { assetId: resolvedAssetId, replyToId: null },
|
||||
include: {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
asset: { include: { storageKey: true } },
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' },
|
||||
},
|
||||
replies: {
|
||||
include: {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' },
|
||||
},
|
||||
},
|
||||
orderBy: { id: 'asc' },
|
||||
},
|
||||
},
|
||||
include: this.getCommentInclude(),
|
||||
skip,
|
||||
take,
|
||||
orderBy: { id: 'asc' },
|
||||
@@ -2343,6 +2347,28 @@ export class AssetService {
|
||||
return { data: infos, pageInfo }
|
||||
}
|
||||
|
||||
async listAllComments(assetId: string, requestingUserId?: string): Promise<CommentInfo[]> {
|
||||
const resolvedAssetId = await this.resolveLatestVersionId(assetId)
|
||||
|
||||
const comments = await this.prismaClient.assetComment.findMany({
|
||||
where: { assetId: resolvedAssetId, replyToId: null },
|
||||
include: this.getCommentInclude(),
|
||||
orderBy: { id: 'asc' },
|
||||
})
|
||||
|
||||
return Promise.all(comments.map((c) => this.toCommentInfo(c, requestingUserId)))
|
||||
}
|
||||
|
||||
async getProjectNameForAsset(assetId: string): Promise<string | null> {
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
where: { id: assetId },
|
||||
select: {
|
||||
project: { select: { name: true } },
|
||||
},
|
||||
})
|
||||
return asset?.project?.name ?? null
|
||||
}
|
||||
|
||||
async exportComments(
|
||||
assetId: string,
|
||||
format: CommentExportFormat,
|
||||
|
||||
Reference in New Issue
Block a user