feat(api): remove mediaType and mimeType from DTO responses and DB MediaInfo interface

This commit is contained in:
yiling
2026-07-20 14:37:17 +08:00
parent 5d4020dc2d
commit 3afe0fc3c3
19 changed files with 37 additions and 48 deletions
+5 -2
View File
@@ -1475,6 +1475,7 @@ describe('AssetService', () => {
mediaType: 'video/mp4',
status: 'processed',
media: {
proxyType: 'video',
poster: { key: 'poster-key' },
metadata: { duration: 262 },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1485,7 +1486,7 @@ describe('AssetService', () => {
const info = await assetService.getAsset({ assetId: video.id })
expect(info.preview).toBeDefined()
expect(info.preview?.mediaType).toBe('video/mp4')
expect(info.preview?.proxyType).toBe('video')
expect(info.preview?.duration).toBe(262)
})
@@ -1502,6 +1503,7 @@ describe('AssetService', () => {
mediaType: 'image/png',
status: 'processed',
media: {
proxyType: 'image',
thumbnail: { key: 'thumb-key' },
metadata: { originalWidth: 100, originalHeight: 80 },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1530,6 +1532,7 @@ describe('AssetService', () => {
mediaType: 'image/png',
status: 'processed',
media: {
proxyType: 'image',
thumbnail: { key: 'thumb-key' },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any,
@@ -1554,7 +1557,7 @@ describe('AssetService', () => {
expect(info.type).toBe(AssetType.symlink)
// Resolved from target
expect(info.sizeByte).toBe(5000)
expect(info.mediaType).toBe('image/png')
expect(info.proxyType).toBe('image')
expect(info.media).toBeDefined()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect((info.media as any).thumbnail?.key).toBe('thumb-key')
-3
View File
@@ -1735,7 +1735,6 @@ export class AssetService {
type: a.type,
targetType: a.type === AssetType.symlink ? a.target?.type : null,
status: latestVersion.status,
mediaType: latestVersion.mediaType,
proxyType,
latestChildren,
preview,
@@ -2027,7 +2026,6 @@ export class AssetService {
}
return {
mediaType: asset.mediaType,
proxyType,
thumbnailUrl,
originalHeight: asset.media.metadata?.originalHeight,
@@ -2067,7 +2065,6 @@ export class AssetService {
id: a.id,
assetId: a.asset.id,
url,
mediaType: a.asset.mediaType,
proxyType: attachmentProxyType,
})
}
@@ -401,7 +401,6 @@ export class NotificationService {
info.asset = {
id: a.id,
name: a.name,
mediaType: a.mediaType || undefined,
proxyType: (a.media as PrismaJson.MediaInfo | null)?.proxyType || undefined,
preview: previewUrl || undefined,
thumbnailUrl: thumbnailUrl || undefined,