refactor: stream asset ids for library queue jobs (#16666)

This commit is contained in:
Jason Rasmussen
2025-03-06 20:22:17 -05:00
committed by GitHub
parent 5c82c485d7
commit d45fa491ce
6 changed files with 65 additions and 66 deletions

View File

@@ -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

View File

@@ -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();
}
}