mirror of
https://github.com/immich-app/immich.git
synced 2026-03-01 18:19:10 +03:00
refactor: stream asset ids for library queue jobs (#16666)
This commit is contained in:
@@ -431,17 +431,6 @@ export class AssetRepository {
|
||||
return paginationHelper(items as any as AssetEntity[], pagination.take);
|
||||
}
|
||||
|
||||
async getAllInLibrary(pagination: PaginationOptions, libraryId: string): Paginated<AssetEntity> {
|
||||
const builder = this.db
|
||||
.selectFrom('assets')
|
||||
.select('id')
|
||||
.where('libraryId', '=', asUuid(libraryId))
|
||||
.limit(pagination.take + 1)
|
||||
.offset(pagination.skip ?? 0);
|
||||
const items = await builder.execute();
|
||||
return paginationHelper(items as any as AssetEntity[], pagination.take);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get assets by device's Id on the database
|
||||
* @param ownerId
|
||||
|
||||
@@ -144,4 +144,8 @@ export class LibraryRepository {
|
||||
total: Number(stats.photos) + Number(stats.videos),
|
||||
};
|
||||
}
|
||||
|
||||
streamAssetIds(libraryId: string) {
|
||||
return this.db.selectFrom('assets').select(['id']).where('libraryId', '=', libraryId).stream();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user