mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
chore: remove unused types and code (#17999)
This commit is contained in:
parent
526c02297c
commit
1fde02ee1e
6 changed files with 13 additions and 73 deletions
|
|
@ -8,22 +8,6 @@ export interface PaginationResult<T> {
|
|||
hasNextPage: boolean;
|
||||
}
|
||||
|
||||
export type Paginated<T> = Promise<PaginationResult<T>>;
|
||||
|
||||
/** @deprecated use `this.db. ... .stream()` instead */
|
||||
export async function* usePagination<T>(
|
||||
pageSize: number,
|
||||
getNextPage: (pagination: PaginationOptions) => PaginationResult<T> | Paginated<T>,
|
||||
) {
|
||||
let hasNextPage = true;
|
||||
|
||||
for (let skip = 0; hasNextPage; skip += pageSize) {
|
||||
const result = await getNextPage({ take: pageSize, skip });
|
||||
hasNextPage = result.hasNextPage;
|
||||
yield result.items;
|
||||
}
|
||||
}
|
||||
|
||||
export function paginationHelper<Entity extends object>(items: Entity[], take: number): PaginationResult<Entity> {
|
||||
const hasNextPage = items.length > take;
|
||||
items.splice(take);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue