feat(server): add /search/statistics resource (#18885)

This commit is contained in:
Jonathan Gilbert
2025-06-07 11:12:53 +10:00
committed by GitHub
parent ecb16d9907
commit fb4be6e231
14 changed files with 954 additions and 16 deletions

View File

@@ -37,12 +37,6 @@ class BaseSearchDto {
@ValidateAssetVisibility({ optional: true })
visibility?: AssetVisibility;
@ValidateBoolean({ optional: true })
withDeleted?: boolean;
@ValidateBoolean({ optional: true })
withExif?: boolean;
@ValidateDate({ optional: true })
createdBefore?: Date;
@@ -92,13 +86,6 @@ class BaseSearchDto {
@Optional({ nullable: true, emptyToNull: true })
lensModel?: string | null;
@IsInt()
@Min(1)
@Max(1000)
@Type(() => Number)
@Optional()
size?: number;
@ValidateBoolean({ optional: true })
isNotInAlbum?: boolean;
@@ -115,7 +102,22 @@ class BaseSearchDto {
rating?: number;
}
export class RandomSearchDto extends BaseSearchDto {
class BaseSearchWithResultsDto extends BaseSearchDto {
@ValidateBoolean({ optional: true })
withDeleted?: boolean;
@ValidateBoolean({ optional: true })
withExif?: boolean;
@IsInt()
@Min(1)
@Max(1000)
@Type(() => Number)
@Optional()
size?: number;
}
export class RandomSearchDto extends BaseSearchWithResultsDto {
@ValidateBoolean({ optional: true })
withStacked?: boolean;
@@ -179,7 +181,14 @@ export class MetadataSearchDto extends RandomSearchDto {
page?: number;
}
export class SmartSearchDto extends BaseSearchDto {
export class StatisticsSearchDto extends BaseSearchDto {
@IsString()
@IsNotEmpty()
@Optional()
description?: string;
}
export class SmartSearchDto extends BaseSearchWithResultsDto {
@IsString()
@IsNotEmpty()
query!: string;
@@ -299,6 +308,11 @@ export class SearchResponseDto {
assets!: SearchAssetResponseDto;
}
export class SearchStatisticsResponseDto {
@ApiProperty({ type: 'integer' })
total!: number;
}
class SearchExploreItem {
value!: string;
data!: AssetResponseDto;