1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-16 03:40:33 +02:00

feat(server): sort assets randomly from the API 'api/search/metadata' endpoint by including 'order': 'rand' in the API call. (#12741)

feat(server): search metadata random sort order

Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
jschwalbe
2024-09-23 12:09:26 -04:00
committed by GitHub
parent a7719a94fc
commit 9f8a7e0bea
15 changed files with 967 additions and 11 deletions

View File

@ -837,6 +837,40 @@ export type PlacesResponseDto = {
longitude: number;
name: string;
};
export type RandomSearchDto = {
city?: string | null;
country?: string | null;
createdAfter?: string;
createdBefore?: string;
deviceId?: string;
isArchived?: boolean;
isEncoded?: boolean;
isFavorite?: boolean;
isMotion?: boolean;
isNotInAlbum?: boolean;
isOffline?: boolean;
isVisible?: boolean;
lensModel?: string | null;
libraryId?: string | null;
make?: string;
model?: string | null;
page?: number;
personIds?: string[];
size?: number;
state?: string | null;
takenAfter?: string;
takenBefore?: string;
trashedAfter?: string;
trashedBefore?: string;
"type"?: AssetTypeEnum;
updatedAfter?: string;
updatedBefore?: string;
withArchived?: boolean;
withDeleted?: boolean;
withExif?: boolean;
withPeople?: boolean;
withStacked?: boolean;
};
export type SmartSearchDto = {
city?: string | null;
country?: string | null;
@ -1696,6 +1730,9 @@ export function getMemoryLane({ day, month }: {
...opts
}));
}
/**
* This property was deprecated in v1.116.0
*/
export function getRandom({ count }: {
count?: number;
}, opts?: Oazapfts.RequestOpts) {
@ -2500,6 +2537,18 @@ export function searchPlaces({ name }: {
...opts
}));
}
export function searchRandom({ randomSearchDto }: {
randomSearchDto: RandomSearchDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: SearchResponseDto;
}>("/search/random", oazapfts.json({
...opts,
method: "POST",
body: randomSearchDto
})));
}
export function searchSmart({ smartSearchDto }: {
smartSearchDto: SmartSearchDto;
}, opts?: Oazapfts.RequestOpts) {