feat: combine with handleSidecarCheck
This commit is contained in:
@@ -21,6 +21,22 @@ limit
|
|||||||
select
|
select
|
||||||
"id",
|
"id",
|
||||||
"originalPath",
|
"originalPath",
|
||||||
|
(
|
||||||
|
select
|
||||||
|
coalesce(json_agg(agg), '[]')
|
||||||
|
from
|
||||||
|
(
|
||||||
|
select
|
||||||
|
"asset_file"."id",
|
||||||
|
"asset_file"."path",
|
||||||
|
"asset_file"."type"
|
||||||
|
from
|
||||||
|
"asset_file"
|
||||||
|
where
|
||||||
|
"asset_file"."assetId" = "asset"."id"
|
||||||
|
and "asset_file"."type" = $1
|
||||||
|
) as agg
|
||||||
|
) as "files",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
coalesce(json_agg(agg), '[]')
|
coalesce(json_agg(agg), '[]')
|
||||||
@@ -34,7 +50,18 @@ select
|
|||||||
where
|
where
|
||||||
"asset"."id" = "tag_asset"."assetsId"
|
"asset"."id" = "tag_asset"."assetsId"
|
||||||
) as agg
|
) as agg
|
||||||
) as "tags",
|
) as "tags"
|
||||||
|
from
|
||||||
|
"asset"
|
||||||
|
where
|
||||||
|
"asset"."id" = $2::uuid
|
||||||
|
limit
|
||||||
|
$3
|
||||||
|
|
||||||
|
-- AssetJobRepository.getForSidecarCheckJob
|
||||||
|
select
|
||||||
|
"id",
|
||||||
|
"originalPath",
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
coalesce(json_agg(agg), '[]')
|
coalesce(json_agg(agg), '[]')
|
||||||
@@ -48,23 +75,10 @@ select
|
|||||||
"asset_file"
|
"asset_file"
|
||||||
where
|
where
|
||||||
"asset_file"."assetId" = "asset"."id"
|
"asset_file"."assetId" = "asset"."id"
|
||||||
and "asset_file"."type" = $1
|
|
||||||
) as agg
|
) as agg
|
||||||
) as "files"
|
) as "files"
|
||||||
from
|
from
|
||||||
"asset"
|
"asset"
|
||||||
where
|
|
||||||
"asset"."id" = $2::uuid
|
|
||||||
limit
|
|
||||||
$3
|
|
||||||
|
|
||||||
-- AssetJobRepository.getForSidecarCheckJob
|
|
||||||
select
|
|
||||||
"id",
|
|
||||||
"sidecarPath",
|
|
||||||
"originalPath"
|
|
||||||
from
|
|
||||||
"asset"
|
|
||||||
where
|
where
|
||||||
"asset"."id" = $1::uuid
|
"asset"."id" = $1::uuid
|
||||||
limit
|
limit
|
||||||
|
|||||||
@@ -27,13 +27,12 @@ const forSidecarJob = (
|
|||||||
asset: {
|
asset: {
|
||||||
id?: string;
|
id?: string;
|
||||||
originalPath?: string;
|
originalPath?: string;
|
||||||
sidecarPath?: string | null;
|
files: { id: string; type: AssetFileType; path: string }[];
|
||||||
} = {},
|
} = {},
|
||||||
) => {
|
) => {
|
||||||
return {
|
return {
|
||||||
id: factory.uuid(),
|
id: factory.uuid(),
|
||||||
originalPath: '/path/to/IMG_123.jpg',
|
originalPath: '/path/to/IMG_123.jpg',
|
||||||
sidecarPath: null,
|
|
||||||
...asset,
|
...asset,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -58,13 +57,6 @@ const makeFaceTags = (face: Partial<{ Name: string }> = {}, orientation?: Immich
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function removeNonSidecarFiles(asset: any) {
|
|
||||||
return {
|
|
||||||
...asset,
|
|
||||||
files: asset.files.filter((file: any) => file.type === AssetFileType.Sidecar),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
describe(MetadataService.name, () => {
|
describe(MetadataService.name, () => {
|
||||||
let sut: MetadataService;
|
let sut: MetadataService;
|
||||||
let mocks: ServiceMocks;
|
let mocks: ServiceMocks;
|
||||||
|
|||||||
Reference in New Issue
Block a user