mirror of
https://github.com/immich-app/immich.git
synced 2024-12-27 10:58:13 +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:
parent
0eacdf93eb
commit
f040c9fb38
@ -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 =
|
||||
|
@ -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
BIN
mobile/openapi/README.md
generated
Binary file not shown.
BIN
mobile/openapi/lib/api/deprecated_api.dart
generated
BIN
mobile/openapi/lib/api/deprecated_api.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/api/people_api.dart
generated
BIN
mobile/openapi/lib/api/people_api.dart
generated
Binary file not shown.
@ -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": {
|
||||
|
@ -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) {
|
||||
|
@ -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[]> {
|
||||
|
Loading…
Reference in New Issue
Block a user