mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
feat: Search filtering logic (#6968)
* commit * controller/service/repository logic * use enum * openapi * suggest people * suggest place/camera * cursor hover * refactor * Add try catch * Remove get people with name service * Remove deadcode * people selection * People placement * sort people * Update server/src/domain/repositories/metadata.repository.ts Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> * pr feedback * styling * done * open api * fix test * use string type * remmove bad merge * use correct type * fix test * fix lint * remove unused code * remove unused code * pr feedback * pr feedback --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
parent
0c45f51a29
commit
4b3f8d1946
24 changed files with 1145 additions and 118 deletions
166
open-api/typescript-sdk/axios-client/api.ts
generated
166
open-api/typescript-sdk/axios-client/api.ts
generated
|
|
@ -2995,6 +2995,23 @@ export interface SearchResponseDto {
|
|||
*/
|
||||
'assets': SearchAssetResponseDto;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export const SearchSuggestionType = {
|
||||
Country: 'country',
|
||||
State: 'state',
|
||||
City: 'city',
|
||||
CameraMake: 'camera-make',
|
||||
CameraModel: 'camera-model'
|
||||
} as const;
|
||||
|
||||
export type SearchSuggestionType = typeof SearchSuggestionType[keyof typeof SearchSuggestionType];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
|
|
@ -14521,7 +14538,72 @@ export const SearchApiAxiosParamCreator = function (configuration?: Configuratio
|
|||
},
|
||||
/**
|
||||
*
|
||||
* @param {boolean} [clip] @deprecated
|
||||
* @param {SearchSuggestionType} type
|
||||
* @param {string} [country]
|
||||
* @param {string} [make]
|
||||
* @param {string} [model]
|
||||
* @param {string} [state]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
getSearchSuggestions: async (type: SearchSuggestionType, country?: string, make?: string, model?: string, state?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'type' is not null or undefined
|
||||
assertParamExists('getSearchSuggestions', 'type', type)
|
||||
const localVarPath = `/search/suggestions`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication cookie required
|
||||
|
||||
// authentication api_key required
|
||||
await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration)
|
||||
|
||||
// authentication bearer required
|
||||
// http bearer authentication required
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
|
||||
if (country !== undefined) {
|
||||
localVarQueryParameter['country'] = country;
|
||||
}
|
||||
|
||||
if (make !== undefined) {
|
||||
localVarQueryParameter['make'] = make;
|
||||
}
|
||||
|
||||
if (model !== undefined) {
|
||||
localVarQueryParameter['model'] = model;
|
||||
}
|
||||
|
||||
if (state !== undefined) {
|
||||
localVarQueryParameter['state'] = state;
|
||||
}
|
||||
|
||||
if (type !== undefined) {
|
||||
localVarQueryParameter['type'] = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {boolean} [clip]
|
||||
* @param {boolean} [motion]
|
||||
* @param {number} [page]
|
||||
* @param {string} [q]
|
||||
|
|
@ -15151,7 +15233,23 @@ export const SearchApiFp = function(configuration?: Configuration) {
|
|||
},
|
||||
/**
|
||||
*
|
||||
* @param {boolean} [clip] @deprecated
|
||||
* @param {SearchSuggestionType} type
|
||||
* @param {string} [country]
|
||||
* @param {string} [make]
|
||||
* @param {string} [model]
|
||||
* @param {string} [state]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async getSearchSuggestions(type: SearchSuggestionType, country?: string, make?: string, model?: string, state?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<string>>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getSearchSuggestions(type, country, make, model, state, options);
|
||||
const index = configuration?.serverIndex ?? 0;
|
||||
const operationBasePath = operationServerMap['SearchApi.getSearchSuggestions']?.[index]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {boolean} [clip]
|
||||
* @param {boolean} [motion]
|
||||
* @param {number} [page]
|
||||
* @param {string} [q]
|
||||
|
|
@ -15296,6 +15394,15 @@ export const SearchApiFactory = function (configuration?: Configuration, basePat
|
|||
getExploreData(options?: RawAxiosRequestConfig): AxiosPromise<Array<SearchExploreResponseDto>> {
|
||||
return localVarFp.getExploreData(options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {SearchApiGetSearchSuggestionsRequest} requestParameters Request parameters.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
getSearchSuggestions(requestParameters: SearchApiGetSearchSuggestionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<string>> {
|
||||
return localVarFp.getSearchSuggestions(requestParameters.type, requestParameters.country, requestParameters.make, requestParameters.model, requestParameters.state, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {SearchApiSearchRequest} requestParameters Request parameters.
|
||||
|
|
@ -15336,6 +15443,48 @@ export const SearchApiFactory = function (configuration?: Configuration, basePat
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Request parameters for getSearchSuggestions operation in SearchApi.
|
||||
* @export
|
||||
* @interface SearchApiGetSearchSuggestionsRequest
|
||||
*/
|
||||
export interface SearchApiGetSearchSuggestionsRequest {
|
||||
/**
|
||||
*
|
||||
* @type {SearchSuggestionType}
|
||||
* @memberof SearchApiGetSearchSuggestions
|
||||
*/
|
||||
readonly type: SearchSuggestionType
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SearchApiGetSearchSuggestions
|
||||
*/
|
||||
readonly country?: string
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SearchApiGetSearchSuggestions
|
||||
*/
|
||||
readonly make?: string
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SearchApiGetSearchSuggestions
|
||||
*/
|
||||
readonly model?: string
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SearchApiGetSearchSuggestions
|
||||
*/
|
||||
readonly state?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Request parameters for search operation in SearchApi.
|
||||
* @export
|
||||
|
|
@ -15343,7 +15492,7 @@ export const SearchApiFactory = function (configuration?: Configuration, basePat
|
|||
*/
|
||||
export interface SearchApiSearchRequest {
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof SearchApiSearch
|
||||
*/
|
||||
|
|
@ -15969,6 +16118,17 @@ export class SearchApi extends BaseAPI {
|
|||
return SearchApiFp(this.configuration).getExploreData(options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {SearchApiGetSearchSuggestionsRequest} requestParameters Request parameters.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SearchApi
|
||||
*/
|
||||
public getSearchSuggestions(requestParameters: SearchApiGetSearchSuggestionsRequest, options?: RawAxiosRequestConfig) {
|
||||
return SearchApiFp(this.configuration).getSearchSuggestions(requestParameters.type, requestParameters.country, requestParameters.make, requestParameters.model, requestParameters.state, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {SearchApiSearchRequest} requestParameters Request parameters.
|
||||
|
|
|
|||
21
open-api/typescript-sdk/fetch-client.ts
generated
21
open-api/typescript-sdk/fetch-client.ts
generated
|
|
@ -603,6 +603,7 @@ export type SearchExploreResponseDto = {
|
|||
fieldName: string;
|
||||
items: SearchExploreItem[];
|
||||
};
|
||||
export type SearchSuggestionType = "country" | "state" | "city" | "camera-make" | "camera-model";
|
||||
export type ServerInfoResponseDto = {
|
||||
diskAvailable: string;
|
||||
diskAvailableRaw: number;
|
||||
|
|
@ -2266,6 +2267,26 @@ export function searchSmart({ city, country, createdAfter, createdBefore, device
|
|||
...opts
|
||||
}));
|
||||
}
|
||||
export function getSearchSuggestions({ country, make, model, state, $type }: {
|
||||
country?: string;
|
||||
make?: string;
|
||||
model?: string;
|
||||
state?: string;
|
||||
$type: SearchSuggestionType;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: string[];
|
||||
}>(`/search/suggestions${QS.query(QS.explode({
|
||||
country,
|
||||
make,
|
||||
model,
|
||||
state,
|
||||
"type": $type
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function getServerInfo(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue