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

@@ -5158,6 +5158,48 @@
]
}
},
"/search/statistics": {
"post": {
"operationId": "searchAssetStatistics",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StatisticsSearchDto"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SearchStatisticsResponseDto"
}
}
},
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"tags": [
"Search"
]
}
},
"/search/suggestions": {
"get": {
"operationId": "getSearchSuggestions",
@@ -12069,6 +12111,17 @@
],
"type": "object"
},
"SearchStatisticsResponseDto": {
"properties": {
"total": {
"type": "integer"
}
},
"required": [
"total"
],
"type": "object"
},
"SearchSuggestionType": {
"enum": [
"country",
@@ -12974,6 +13027,125 @@
},
"type": "object"
},
"StatisticsSearchDto": {
"properties": {
"city": {
"nullable": true,
"type": "string"
},
"country": {
"nullable": true,
"type": "string"
},
"createdAfter": {
"format": "date-time",
"type": "string"
},
"createdBefore": {
"format": "date-time",
"type": "string"
},
"description": {
"type": "string"
},
"deviceId": {
"type": "string"
},
"isEncoded": {
"type": "boolean"
},
"isFavorite": {
"type": "boolean"
},
"isMotion": {
"type": "boolean"
},
"isNotInAlbum": {
"type": "boolean"
},
"isOffline": {
"type": "boolean"
},
"lensModel": {
"nullable": true,
"type": "string"
},
"libraryId": {
"format": "uuid",
"nullable": true,
"type": "string"
},
"make": {
"type": "string"
},
"model": {
"nullable": true,
"type": "string"
},
"personIds": {
"items": {
"format": "uuid",
"type": "string"
},
"type": "array"
},
"rating": {
"maximum": 5,
"minimum": -1,
"type": "number"
},
"state": {
"nullable": true,
"type": "string"
},
"tagIds": {
"items": {
"format": "uuid",
"type": "string"
},
"type": "array"
},
"takenAfter": {
"format": "date-time",
"type": "string"
},
"takenBefore": {
"format": "date-time",
"type": "string"
},
"trashedAfter": {
"format": "date-time",
"type": "string"
},
"trashedBefore": {
"format": "date-time",
"type": "string"
},
"type": {
"allOf": [
{
"$ref": "#/components/schemas/AssetTypeEnum"
}
]
},
"updatedAfter": {
"format": "date-time",
"type": "string"
},
"updatedBefore": {
"format": "date-time",
"type": "string"
},
"visibility": {
"allOf": [
{
"$ref": "#/components/schemas/AssetVisibility"
}
]
}
},
"type": "object"
},
"SyncAckDeleteDto": {
"properties": {
"types": {

View File

@@ -995,6 +995,38 @@ export type SmartSearchDto = {
withDeleted?: boolean;
withExif?: boolean;
};
export type StatisticsSearchDto = {
city?: string | null;
country?: string | null;
createdAfter?: string;
createdBefore?: string;
description?: string;
deviceId?: string;
isEncoded?: boolean;
isFavorite?: boolean;
isMotion?: boolean;
isNotInAlbum?: boolean;
isOffline?: boolean;
lensModel?: string | null;
libraryId?: string | null;
make?: string;
model?: string | null;
personIds?: string[];
rating?: number;
state?: string | null;
tagIds?: string[];
takenAfter?: string;
takenBefore?: string;
trashedAfter?: string;
trashedBefore?: string;
"type"?: AssetTypeEnum;
updatedAfter?: string;
updatedBefore?: string;
visibility?: AssetVisibility;
};
export type SearchStatisticsResponseDto = {
total: number;
};
export type ServerAboutResponseDto = {
build?: string;
buildImage?: string;
@@ -2882,6 +2914,18 @@ export function searchSmart({ smartSearchDto }: {
body: smartSearchDto
})));
}
export function searchAssetStatistics({ statisticsSearchDto }: {
statisticsSearchDto: StatisticsSearchDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: SearchStatisticsResponseDto;
}>("/search/statistics", oazapfts.json({
...opts,
method: "POST",
body: statisticsSearchDto
})));
}
export function getSearchSuggestions({ country, includeNull, make, model, state, $type }: {
country?: string;
includeNull?: boolean;