Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename searchMetadata to searchAssets #14151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions e2e/src/api/specs/library.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('/libraries', () => {

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`,
});
expect(assets.count).toBe(1);
Expand All @@ -320,7 +320,7 @@ describe('/libraries', () => {

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.items[0].originalPath.includes('directoryB'));
Expand All @@ -340,7 +340,7 @@ describe('/libraries', () => {

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.items.find((asset) => asset.originalPath.includes('directoryA'))).toBeDefined();
Expand All @@ -365,7 +365,7 @@ describe('/libraries', () => {

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.items.find((asset) => asset.originalPath.includes('folder, a'))).toBeDefined();
Expand Down Expand Up @@ -393,7 +393,7 @@ describe('/libraries', () => {

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.items.find((asset) => asset.originalPath.includes('folder{ a'))).toBeDefined();
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('/libraries', () => {
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
utils.removeImageFile(`${testAssetDir}/temp/directoryA/assetB.jpg`);

const { assets } = await utils.metadataSearch(admin.accessToken, {
const { assets } = await utils.searchAssets(admin.accessToken, {
libraryId: library.id,
model: 'NIKON D750',
});
Expand Down Expand Up @@ -460,7 +460,7 @@ describe('/libraries', () => {
await utils.waitForQueueFinish(admin.accessToken, 'metadataExtraction');
utils.removeImageFile(`${testAssetDir}/temp/directoryA/assetB.jpg`);

const { assets } = await utils.metadataSearch(admin.accessToken, {
const { assets } = await utils.searchAssets(admin.accessToken, {
libraryId: library.id,
model: 'NIKON D750',
});
Expand All @@ -478,7 +478,7 @@ describe('/libraries', () => {
await scan(admin.accessToken, library.id);
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);

utils.removeImageFile(`${testAssetDir}/temp/offline/offline.png`);
Expand All @@ -495,7 +495,7 @@ describe('/libraries', () => {
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/offline/offline.png`);
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([]);
});

Expand All @@ -510,7 +510,7 @@ describe('/libraries', () => {
await scan(admin.accessToken, library.id);
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);

utils.createDirectory(`${testAssetDir}/temp/another-path/`);
Expand All @@ -532,7 +532,7 @@ describe('/libraries', () => {
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/offline/offline.png`);
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([]);

Expand All @@ -549,7 +549,7 @@ describe('/libraries', () => {
await scan(admin.accessToken, library.id);
await utils.waitForQueueFinish(admin.accessToken, 'library');

const { assets } = await utils.metadataSearch(admin.accessToken, {
const { assets } = await utils.searchAssets(admin.accessToken, {
libraryId: library.id,
originalFileName: 'assetB.png',
});
Expand All @@ -568,7 +568,7 @@ describe('/libraries', () => {
expect(trashedAsset.originalPath).toBe(`${testAssetDirInternal}/temp/directoryB/assetB.png`);
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.objectContaining({
Expand All @@ -586,7 +586,7 @@ describe('/libraries', () => {
await scan(admin.accessToken, library.id);
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);

const { status } = await request(app)
Expand All @@ -597,7 +597,7 @@ describe('/libraries', () => {

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);
});
Expand Down
6 changes: 3 additions & 3 deletions e2e/src/api/specs/trash.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('/trash', () => {
await scan(admin.accessToken, library.id);
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);
const asset = assets.items[0];

Expand Down Expand Up @@ -148,7 +148,7 @@ describe('/trash', () => {
await scan(admin.accessToken, library.id);
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);
const assetId = assets.items[0].id;

Expand Down Expand Up @@ -206,7 +206,7 @@ describe('/trash', () => {
await scan(admin.accessToken, library.id);
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);
const assetId = assets.items[0].id;

Expand Down
6 changes: 3 additions & 3 deletions e2e/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
getAssetInfo,
getConfigDefaults,
login,
searchMetadata,
searchAssets,
setBaseUrl,
signUpAdmin,
updateAdminOnboarding,
Expand Down Expand Up @@ -400,8 +400,8 @@ export const utils = {
checkExistingAssets: (accessToken: string, checkExistingAssetsDto: CheckExistingAssetsDto) =>
checkExistingAssets({ checkExistingAssetsDto }, { headers: asBearerAuth(accessToken) }),

metadataSearch: async (accessToken: string, dto: MetadataSearchDto) => {
return searchMetadata({ metadataSearchDto: dto }, { headers: asBearerAuth(accessToken) });
searchAssets: async (accessToken: string, dto: MetadataSearchDto) => {
return searchAssets({ metadataSearchDto: dto }, { headers: asBearerAuth(accessToken) });
},

archiveAssets: (accessToken: string, ids: string[]) =>
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/repositories/asset_api.repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AssetApiRepository extends ApiRepository implements IAssetApiRepository {
int currentPage = 1;
while (hasNext) {
final response = await checkNull(
_searchApi.searchMetadata(
_searchApi.searchAssets(
MetadataSearchDto(
personIds: personIds,
page: currentPage,
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/services/search.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SearchService {
),
);
} else {
response = await _apiService.searchApi.searchMetadata(
response = await _apiService.searchApi.searchAssets(
MetadataSearchDto(
originalFileName:
filter.filename != null && filter.filename!.isNotEmpty
Expand Down
2 changes: 1 addition & 1 deletion mobile/openapi/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions mobile/openapi/lib/api/search_api.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4409,7 +4409,7 @@
},
"/search/metadata": {
"post": {
"operationId": "searchMetadata",
"operationId": "searchAssets",
"parameters": [],
"requestBody": {
"content": {
Expand Down
2 changes: 1 addition & 1 deletion open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,7 @@ export function getExploreData(opts?: Oazapfts.RequestOpts) {
...opts
}));
}
export function searchMetadata({ metadataSearchDto }: {
export function searchAssets({ metadataSearchDto }: {
metadataSearchDto: MetadataSearchDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/search.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class SearchController {
@Post('metadata')
@HttpCode(HttpStatus.OK)
@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);
}

Expand Down
Loading