mirror of
https://github.com/immich-app/immich.git
synced 2025-01-23 12:12:45 +01:00
refactor: rename searchMetadata to searchAssets (#14151)
This commit is contained in:
parent
ed8a3101a8
commit
9e1e9b1fbf
11 changed files with 28 additions and 28 deletions
e2e/src
mobile
lib
openapi
open-api
server/src/controllers
web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]
|
@ -299,7 +299,7 @@ describe('/libraries', () => {
|
||||||
|
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, {
|
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||||
originalPath: `${testAssetDirInternal}/temp/directoryA/assetA.png`,
|
originalPath: `${testAssetDirInternal}/temp/directoryA/assetA.png`,
|
||||||
});
|
});
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
|
@ -320,7 +320,7 @@ describe('/libraries', () => {
|
||||||
|
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
expect(assets.items[0].originalPath.includes('directoryB'));
|
expect(assets.items[0].originalPath.includes('directoryB'));
|
||||||
|
@ -340,7 +340,7 @@ describe('/libraries', () => {
|
||||||
|
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(assets.count).toBe(2);
|
expect(assets.count).toBe(2);
|
||||||
expect(assets.items.find((asset) => asset.originalPath.includes('directoryA'))).toBeDefined();
|
expect(assets.items.find((asset) => asset.originalPath.includes('directoryA'))).toBeDefined();
|
||||||
|
@ -365,7 +365,7 @@ describe('/libraries', () => {
|
||||||
|
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(assets.count).toBe(2);
|
expect(assets.count).toBe(2);
|
||||||
expect(assets.items.find((asset) => asset.originalPath.includes('folder, a'))).toBeDefined();
|
expect(assets.items.find((asset) => asset.originalPath.includes('folder, a'))).toBeDefined();
|
||||||
|
@ -393,7 +393,7 @@ describe('/libraries', () => {
|
||||||
|
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(assets.count).toBe(2);
|
expect(assets.count).toBe(2);
|
||||||
expect(assets.items.find((asset) => asset.originalPath.includes('folder{ a'))).toBeDefined();
|
expect(assets.items.find((asset) => asset.originalPath.includes('folder{ a'))).toBeDefined();
|
||||||
|
@ -428,7 +428,7 @@ describe('/libraries', () => {
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
|
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
|
||||||
utils.removeImageFile(`${testAssetDir}/temp/directoryA/assetB.jpg`);
|
utils.removeImageFile(`${testAssetDir}/temp/directoryA/assetB.jpg`);
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, {
|
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||||
libraryId: library.id,
|
libraryId: library.id,
|
||||||
model: 'NIKON D750',
|
model: 'NIKON D750',
|
||||||
});
|
});
|
||||||
|
@ -460,7 +460,7 @@ describe('/libraries', () => {
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
|
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
|
||||||
utils.removeImageFile(`${testAssetDir}/temp/directoryA/assetB.jpg`);
|
utils.removeImageFile(`${testAssetDir}/temp/directoryA/assetB.jpg`);
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, {
|
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||||
libraryId: library.id,
|
libraryId: library.id,
|
||||||
model: 'NIKON D750',
|
model: 'NIKON D750',
|
||||||
});
|
});
|
||||||
|
@ -478,7 +478,7 @@ describe('/libraries', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
|
|
||||||
utils.removeImageFile(`${testAssetDir}/temp/offline/offline.png`);
|
utils.removeImageFile(`${testAssetDir}/temp/offline/offline.png`);
|
||||||
|
@ -495,7 +495,7 @@ describe('/libraries', () => {
|
||||||
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/offline/offline.png`);
|
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/offline/offline.png`);
|
||||||
expect(trashedAsset.isOffline).toEqual(true);
|
expect(trashedAsset.isOffline).toEqual(true);
|
||||||
|
|
||||||
const { assets: newAssets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets: newAssets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(newAssets.items).toEqual([]);
|
expect(newAssets.items).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ describe('/libraries', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
|
|
||||||
utils.createDirectory(`${testAssetDir}/temp/another-path/`);
|
utils.createDirectory(`${testAssetDir}/temp/another-path/`);
|
||||||
|
@ -532,7 +532,7 @@ describe('/libraries', () => {
|
||||||
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/offline/offline.png`);
|
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/offline/offline.png`);
|
||||||
expect(trashedAsset.isOffline).toBe(true);
|
expect(trashedAsset.isOffline).toBe(true);
|
||||||
|
|
||||||
const { assets: newAssets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets: newAssets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(newAssets.items).toEqual([]);
|
expect(newAssets.items).toEqual([]);
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ describe('/libraries', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, {
|
const { assets } = await utils.searchAssets(admin.accessToken, {
|
||||||
libraryId: library.id,
|
libraryId: library.id,
|
||||||
originalFileName: 'assetB.png',
|
originalFileName: 'assetB.png',
|
||||||
});
|
});
|
||||||
|
@ -568,7 +568,7 @@ describe('/libraries', () => {
|
||||||
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/directoryB/assetB.png`);
|
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/directoryB/assetB.png`);
|
||||||
expect(trashedAsset.isOffline).toBe(true);
|
expect(trashedAsset.isOffline).toBe(true);
|
||||||
|
|
||||||
const { assets: newAssets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets: newAssets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(newAssets.items).toEqual([
|
expect(newAssets.items).toEqual([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
|
@ -586,7 +586,7 @@ describe('/libraries', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets: assetsBefore } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets: assetsBefore } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(assetsBefore.count).toBeGreaterThan(1);
|
expect(assetsBefore.count).toBeGreaterThan(1);
|
||||||
|
|
||||||
const { status } = await request(app)
|
const { status } = await request(app)
|
||||||
|
@ -597,7 +597,7 @@ describe('/libraries', () => {
|
||||||
|
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
|
|
||||||
expect(assets).toEqual(assetsBefore);
|
expect(assets).toEqual(assetsBefore);
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,7 +84,7 @@ describe('/trash', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(assets.items.length).toBe(1);
|
expect(assets.items.length).toBe(1);
|
||||||
const asset = assets.items[0];
|
const asset = assets.items[0];
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ describe('/trash', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
const assetId = assets.items[0].id;
|
const assetId = assets.items[0].id;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ describe('/trash', () => {
|
||||||
await scan(admin.accessToken, library.id);
|
await scan(admin.accessToken, library.id);
|
||||||
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
await utils.waitForQueueFinish(admin.accessToken, 'library');
|
||||||
|
|
||||||
const { assets } = await utils.metadataSearch(admin.accessToken, { libraryId: library.id });
|
const { assets } = await utils.searchAssets(admin.accessToken, { libraryId: library.id });
|
||||||
expect(assets.count).toBe(1);
|
expect(assets.count).toBe(1);
|
||||||
const assetId = assets.items[0].id;
|
const assetId = assets.items[0].id;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import {
|
||||||
getAssetInfo,
|
getAssetInfo,
|
||||||
getConfigDefaults,
|
getConfigDefaults,
|
||||||
login,
|
login,
|
||||||
searchMetadata,
|
searchAssets,
|
||||||
setBaseUrl,
|
setBaseUrl,
|
||||||
signUpAdmin,
|
signUpAdmin,
|
||||||
tagAssets,
|
tagAssets,
|
||||||
|
@ -405,8 +405,8 @@ export const utils = {
|
||||||
checkExistingAssets: (accessToken: string, checkExistingAssetsDto: CheckExistingAssetsDto) =>
|
checkExistingAssets: (accessToken: string, checkExistingAssetsDto: CheckExistingAssetsDto) =>
|
||||||
checkExistingAssets({ checkExistingAssetsDto }, { headers: asBearerAuth(accessToken) }),
|
checkExistingAssets({ checkExistingAssetsDto }, { headers: asBearerAuth(accessToken) }),
|
||||||
|
|
||||||
metadataSearch: async (accessToken: string, dto: MetadataSearchDto) => {
|
searchAssets: async (accessToken: string, dto: MetadataSearchDto) => {
|
||||||
return searchMetadata({ metadataSearchDto: dto }, { headers: asBearerAuth(accessToken) });
|
return searchAssets({ metadataSearchDto: dto }, { headers: asBearerAuth(accessToken) });
|
||||||
},
|
},
|
||||||
|
|
||||||
archiveAssets: (accessToken: string, ids: string[]) =>
|
archiveAssets: (accessToken: string, ids: string[]) =>
|
||||||
|
|
|
@ -34,7 +34,7 @@ class AssetApiRepository extends ApiRepository implements IAssetApiRepository {
|
||||||
int currentPage = 1;
|
int currentPage = 1;
|
||||||
while (hasNext) {
|
while (hasNext) {
|
||||||
final response = await checkNull(
|
final response = await checkNull(
|
||||||
_searchApi.searchMetadata(
|
_searchApi.searchAssets(
|
||||||
MetadataSearchDto(
|
MetadataSearchDto(
|
||||||
personIds: personIds,
|
personIds: personIds,
|
||||||
page: currentPage,
|
page: currentPage,
|
||||||
|
|
|
@ -77,7 +77,7 @@ class SearchService {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
response = await _apiService.searchApi.searchMetadata(
|
response = await _apiService.searchApi.searchAssets(
|
||||||
MetadataSearchDto(
|
MetadataSearchDto(
|
||||||
originalFileName:
|
originalFileName:
|
||||||
filter.filename != null && filter.filename!.isNotEmpty
|
filter.filename != null && filter.filename!.isNotEmpty
|
||||||
|
|
BIN
mobile/openapi/README.md
generated
BIN
mobile/openapi/README.md
generated
Binary file not shown.
BIN
mobile/openapi/lib/api/search_api.dart
generated
BIN
mobile/openapi/lib/api/search_api.dart
generated
Binary file not shown.
|
@ -4409,7 +4409,7 @@
|
||||||
},
|
},
|
||||||
"/search/metadata": {
|
"/search/metadata": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "searchMetadata",
|
"operationId": "searchAssets",
|
||||||
"parameters": [],
|
"parameters": [],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"content": {
|
"content": {
|
||||||
|
|
|
@ -2483,7 +2483,7 @@ export function getExploreData(opts?: Oazapfts.RequestOpts) {
|
||||||
...opts
|
...opts
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
export function searchMetadata({ metadataSearchDto }: {
|
export function searchAssets({ metadataSearchDto }: {
|
||||||
metadataSearchDto: MetadataSearchDto;
|
metadataSearchDto: MetadataSearchDto;
|
||||||
}, opts?: Oazapfts.RequestOpts) {
|
}, opts?: Oazapfts.RequestOpts) {
|
||||||
return oazapfts.ok(oazapfts.fetchJson<{
|
return oazapfts.ok(oazapfts.fetchJson<{
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class SearchController {
|
||||||
@Post('metadata')
|
@Post('metadata')
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Authenticated()
|
@Authenticated()
|
||||||
searchMetadata(@Auth() auth: AuthDto, @Body() dto: MetadataSearchDto): Promise<SearchResponseDto> {
|
searchAssets(@Auth() auth: AuthDto, @Body() dto: MetadataSearchDto): Promise<SearchResponseDto> {
|
||||||
return this.service.searchMetadata(auth, dto);
|
return this.service.searchMetadata(auth, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
import { shortcut } from '$lib/actions/shortcut';
|
import { shortcut } from '$lib/actions/shortcut';
|
||||||
import {
|
import {
|
||||||
type AssetResponseDto,
|
type AssetResponseDto,
|
||||||
|
searchAssets,
|
||||||
searchSmart,
|
searchSmart,
|
||||||
searchMetadata,
|
|
||||||
getPerson,
|
getPerson,
|
||||||
type SmartSearchDto,
|
type SmartSearchDto,
|
||||||
type MetadataSearchDto,
|
type MetadataSearchDto,
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
const { albums, assets } =
|
const { albums, assets } =
|
||||||
'query' in searchDto && $featureFlags.smartSearch
|
'query' in searchDto && $featureFlags.smartSearch
|
||||||
? await searchSmart({ smartSearchDto: searchDto })
|
? await searchSmart({ smartSearchDto: searchDto })
|
||||||
: await searchMetadata({ metadataSearchDto: searchDto });
|
: await searchAssets({ metadataSearchDto: searchDto });
|
||||||
|
|
||||||
searchResultAlbums.push(...albums.items);
|
searchResultAlbums.push(...albums.items);
|
||||||
searchResultAssets.push(...assets.items);
|
searchResultAssets.push(...assets.items);
|
||||||
|
|
Loading…
Reference in a new issue