mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(server): add originalFileName to asset table (#2231)
This commit is contained in:
@@ -13,6 +13,7 @@ export class AssetResponseDto {
|
||||
@ApiProperty({ enumName: 'AssetTypeEnum', enum: AssetType })
|
||||
type!: AssetType;
|
||||
originalPath!: string;
|
||||
originalFileName!: string;
|
||||
resizePath!: string | null;
|
||||
fileCreatedAt!: string;
|
||||
fileModifiedAt!: string;
|
||||
@@ -36,6 +37,7 @@ export function mapAsset(entity: AssetEntity): AssetResponseDto {
|
||||
deviceId: entity.deviceId,
|
||||
type: entity.type,
|
||||
originalPath: entity.originalPath,
|
||||
originalFileName: entity.originalFileName,
|
||||
resizePath: entity.resizePath,
|
||||
fileCreatedAt: entity.fileCreatedAt,
|
||||
fileModifiedAt: entity.fileModifiedAt,
|
||||
@@ -60,6 +62,7 @@ export function mapAssetWithoutExif(entity: AssetEntity): AssetResponseDto {
|
||||
deviceId: entity.deviceId,
|
||||
type: entity.type,
|
||||
originalPath: entity.originalPath,
|
||||
originalFileName: entity.originalFileName,
|
||||
resizePath: entity.resizePath,
|
||||
fileCreatedAt: entity.fileCreatedAt,
|
||||
fileModifiedAt: entity.fileModifiedAt,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
export class ExifResponseDto {
|
||||
make?: string | null = null;
|
||||
model?: string | null = null;
|
||||
imageName?: string | null = null;
|
||||
exifImageWidth?: number | null = null;
|
||||
exifImageHeight?: number | null = null;
|
||||
|
||||
@@ -30,7 +29,6 @@ export function mapExif(entity: ExifEntity): ExifResponseDto {
|
||||
return {
|
||||
make: entity.make,
|
||||
model: entity.model,
|
||||
imageName: entity.imageName,
|
||||
exifImageWidth: entity.exifImageWidth,
|
||||
exifImageHeight: entity.exifImageHeight,
|
||||
fileSizeInByte: entity.fileSizeInByte ? parseInt(entity.fileSizeInByte.toString()) : null,
|
||||
|
||||
@@ -26,7 +26,7 @@ export class StorageTemplateService {
|
||||
const { asset } = data;
|
||||
|
||||
try {
|
||||
const filename = asset.exifInfo?.imageName || asset.id;
|
||||
const filename = asset.originalFileName || asset.id;
|
||||
await this.moveAsset(asset, filename);
|
||||
|
||||
// move motion part of live photo
|
||||
@@ -56,7 +56,7 @@ export class StorageTemplateService {
|
||||
for (const asset of assets) {
|
||||
const livePhotoParentAsset = livePhotoMap[asset.id];
|
||||
// TODO: remove livePhoto specific stuff once upload is fixed
|
||||
const filename = asset.exifInfo?.imageName || livePhotoParentAsset?.exifInfo?.imageName || asset.id;
|
||||
const filename = asset.originalFileName || livePhotoParentAsset?.originalFileName || asset.id;
|
||||
await this.moveAsset(asset, filename);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ export const fileStub = {
|
||||
export const assetEntityStub = {
|
||||
noResizePath: Object.freeze<AssetEntity>({
|
||||
id: 'asset-id',
|
||||
originalFileName: 'asset_1.jpeg',
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: '2023-02-23T05:06:29.716Z',
|
||||
fileCreatedAt: '2023-02-23T05:06:29.716Z',
|
||||
@@ -163,9 +164,11 @@ export const assetEntityStub = {
|
||||
livePhotoVideoId: null,
|
||||
tags: [],
|
||||
sharedLinks: [],
|
||||
originalFileName: 'asset-id.ext',
|
||||
}),
|
||||
video: Object.freeze<AssetEntity>({
|
||||
id: 'asset-id',
|
||||
originalFileName: 'asset-id.ext',
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: '2023-02-23T05:06:29.716Z',
|
||||
fileCreatedAt: '2023-02-23T05:06:29.716Z',
|
||||
@@ -320,7 +323,6 @@ export const albumStub = {
|
||||
const assetInfo: ExifResponseDto = {
|
||||
make: 'camera-make',
|
||||
model: 'camera-model',
|
||||
imageName: 'fancy-image',
|
||||
exifImageWidth: 500,
|
||||
exifImageHeight: 500,
|
||||
fileSizeInByte: 100,
|
||||
@@ -347,6 +349,7 @@ const assetResponse: AssetResponseDto = {
|
||||
deviceId: 'device_id_1',
|
||||
type: AssetType.VIDEO,
|
||||
originalPath: 'fake_path/jpeg',
|
||||
originalFileName: 'asset_1.jpeg',
|
||||
resizePath: '',
|
||||
fileModifiedAt: today.toISOString(),
|
||||
fileCreatedAt: today.toISOString(),
|
||||
@@ -602,6 +605,7 @@ export const sharedLinkStub = {
|
||||
isVisible: true,
|
||||
livePhotoVideo: null,
|
||||
livePhotoVideoId: null,
|
||||
originalFileName: 'asset_1.jpeg',
|
||||
exifInfo: {
|
||||
livePhotoCID: null,
|
||||
assetId: 'id_1',
|
||||
@@ -620,7 +624,6 @@ export const sharedLinkStub = {
|
||||
country: 'country',
|
||||
make: 'camera-make',
|
||||
model: 'camera-model',
|
||||
imageName: 'fancy-image',
|
||||
lensModel: 'fancy',
|
||||
fNumber: 100,
|
||||
focalLength: 100,
|
||||
|
||||
Reference in New Issue
Block a user