mirror of
https://github.com/immich-app/immich.git
synced 2025-12-26 17:25:00 +03:00
feat(server): add /search/statistics resource (#18885)
This commit is contained in:
@@ -10,9 +10,11 @@ import {
|
||||
SearchPeopleDto,
|
||||
SearchPlacesDto,
|
||||
SearchResponseDto,
|
||||
SearchStatisticsResponseDto,
|
||||
SearchSuggestionRequestDto,
|
||||
SearchSuggestionType,
|
||||
SmartSearchDto,
|
||||
StatisticsSearchDto,
|
||||
} from 'src/dtos/search.dto';
|
||||
import { AssetOrder, AssetVisibility } from 'src/enum';
|
||||
import { BaseService } from 'src/services/base.service';
|
||||
@@ -67,6 +69,15 @@ export class SearchService extends BaseService {
|
||||
return this.mapResponse(items, hasNextPage ? (page + 1).toString() : null, { auth });
|
||||
}
|
||||
|
||||
async searchStatistics(auth: AuthDto, dto: StatisticsSearchDto): Promise<SearchStatisticsResponseDto> {
|
||||
const userIds = await this.getUserIdsToSearch(auth);
|
||||
|
||||
return await this.searchRepository.searchStatistics({
|
||||
...dto,
|
||||
userIds,
|
||||
});
|
||||
}
|
||||
|
||||
async searchRandom(auth: AuthDto, dto: RandomSearchDto): Promise<AssetResponseDto[]> {
|
||||
if (dto.visibility === AssetVisibility.LOCKED) {
|
||||
requireElevatedPermission(auth);
|
||||
|
||||
Reference in New Issue
Block a user