mirror of
https://github.com/immich-app/immich.git
synced 2025-02-11 01:18:24 -05:00
fix: user specific fields in asset search (#12125)
This commit is contained in:
parent
715ac4c599
commit
c63f63cc15
1 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
|
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
|
||||||
import { SystemConfigCore } from 'src/cores/system-config.core';
|
import { SystemConfigCore } from 'src/cores/system-config.core';
|
||||||
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
|
import { AssetMapOptions, AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
|
||||||
import { AuthDto } from 'src/dtos/auth.dto';
|
import { AuthDto } from 'src/dtos/auth.dto';
|
||||||
import { PersonResponseDto } from 'src/dtos/person.dto';
|
import { PersonResponseDto } from 'src/dtos/person.dto';
|
||||||
import {
|
import {
|
||||||
|
@ -92,7 +92,7 @@ export class SearchService {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.mapResponse(items, hasNextPage ? (page + 1).toString() : null);
|
return this.mapResponse(items, hasNextPage ? (page + 1).toString() : null, { auth });
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchSmart(auth: AuthDto, dto: SmartSearchDto): Promise<SearchResponseDto> {
|
async searchSmart(auth: AuthDto, dto: SmartSearchDto): Promise<SearchResponseDto> {
|
||||||
|
@ -111,7 +111,7 @@ export class SearchService {
|
||||||
{ ...dto, userIds, embedding },
|
{ ...dto, userIds, embedding },
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.mapResponse(items, hasNextPage ? (page + 1).toString() : null);
|
return this.mapResponse(items, hasNextPage ? (page + 1).toString() : null, { auth });
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAssetsByCity(auth: AuthDto): Promise<AssetResponseDto[]> {
|
async getAssetsByCity(auth: AuthDto): Promise<AssetResponseDto[]> {
|
||||||
|
@ -157,13 +157,13 @@ export class SearchService {
|
||||||
return [auth.user.id, ...partnerIds];
|
return [auth.user.id, ...partnerIds];
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapResponse(assets: AssetEntity[], nextPage: string | null): SearchResponseDto {
|
private mapResponse(assets: AssetEntity[], nextPage: string | null, options: AssetMapOptions): SearchResponseDto {
|
||||||
return {
|
return {
|
||||||
albums: { total: 0, count: 0, items: [], facets: [] },
|
albums: { total: 0, count: 0, items: [], facets: [] },
|
||||||
assets: {
|
assets: {
|
||||||
total: assets.length,
|
total: assets.length,
|
||||||
count: assets.length,
|
count: assets.length,
|
||||||
items: assets.map((asset) => mapAsset(asset)),
|
items: assets.map((asset) => mapAsset(asset, options)),
|
||||||
facets: [],
|
facets: [],
|
||||||
nextPage,
|
nextPage,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue