Skip to content

Commit

Permalink
fix: add hasMore property to pokemon pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
fdorantesm committed Jan 15, 2024
1 parent d6fcddd commit cee3e04
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/domain/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export interface Pagination<T> {
offset?: number | undefined;
nextPage: number | null;
prevPage: number | null;
hasMore: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export class BaseMemoryRepository<I, E extends Entity<I>> implements Crud<I, E>
offset: options.offset,
nextPage: page < pages ? page + 1 : null,
prevPage: page > 1 ? page - 1 : null,
hasMore: page < pages,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class GetPokemonsUseCase implements Executable {
prevPage: prevPage,
nextPage: nextPage,
offset: result.offset,
hasMore: result.page < result.pages,
};
}

Expand Down

0 comments on commit cee3e04

Please sign in to comment.