1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

chore(server): remove get person asset limit (#11597)

* chore(server): remover get person asset limit

* sql

* remove getPersonAsset endpoint

* remove getPersonAsset endpoint

* use search endpoint to get people

* fix: server test

* mobile linter

* fix: server test

* remove debuglog

* deprecated endpoint

* change page size on mobile

* revert max size

* fix test
This commit is contained in:
Alex 2024-08-06 11:22:13 -05:00 committed by GitHub
parent 0eacdf93eb
commit f040c9fb38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 44 additions and 10 deletions

View File

@ -22,9 +22,6 @@ Future<List<PersonResponseDto>> getAllPeople(
Future<RenderList> personAssets(PersonAssetsRef ref, String personId) async {
final PersonService personService = ref.read(personServiceProvider);
final assets = await personService.getPersonAssets(personId);
if (assets == null) {
return RenderList.empty();
}
final settings = ref.read(appSettingsServiceProvider);
final groupBy =

View File

@ -30,15 +30,41 @@ class PersonService {
}
}
Future<List<Asset>?> getPersonAssets(String id) async {
Future<List<Asset>> getPersonAssets(String id) async {
List<Asset> result = [];
var hasNext = true;
var currentPage = 1;
try {
final assets = await _apiService.peopleApi.getPersonAssets(id);
if (assets == null) return null;
return await _db.assets.getAllByRemoteId(assets.map((e) => e.id));
while (hasNext) {
final response = await _apiService.searchApi.searchMetadata(
MetadataSearchDto(
personIds: [id],
page: currentPage,
size: 1000,
),
);
if (response == null) {
break;
}
if (response.assets.nextPage == null) {
hasNext = false;
}
final assets = response.assets.items;
final mapAssets =
await _db.assets.getAllByRemoteId(assets.map((e) => e.id));
result.addAll(mapAssets);
currentPage++;
}
} catch (error, stack) {
_log.severe("Error while fetching person assets", error, stack);
}
return null;
return result;
}
Future<PersonResponseDto?> updateName(String id, String name) async {

BIN
mobile/openapi/README.md generated

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4115,6 +4115,8 @@
},
"/people/{id}/assets": {
"get": {
"deprecated": true,
"description": "This property was deprecated in v1.113.0",
"operationId": "getPersonAssets",
"parameters": [
{
@ -4154,8 +4156,12 @@
}
],
"tags": [
"People"
]
"People",
"Deprecated"
],
"x-immich-lifecycle": {
"deprecatedAt": "v1.113.0"
}
}
},
"/people/{id}/merge": {

View File

@ -2267,6 +2267,9 @@ export function updatePerson({ id, personUpdateDto }: {
body: personUpdateDto
})));
}
/**
* This property was deprecated in v1.113.0
*/
export function getPersonAssets({ id }: {
id: string;
}, opts?: Oazapfts.RequestOpts) {

View File

@ -1,6 +1,7 @@
import { Body, Controller, Get, Inject, Next, Param, Post, Put, Query, Res } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { NextFunction, Response } from 'express';
import { EndpointLifecycle } from 'src/decorators';
import { BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto';
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
import { AuthDto } from 'src/dtos/auth.dto';
@ -81,6 +82,7 @@ export class PersonController {
await sendFile(res, next, () => this.service.getThumbnail(auth, id), this.logger);
}
@EndpointLifecycle({ deprecatedAt: 'v1.113.0' })
@Get(':id/assets')
@Authenticated()
getPersonAssets(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto[]> {