Commit Graph

5 Commits

Author SHA1 Message Date
Simon Backx
383069a1e5 Fixed NQL filter column mapping for BookskhelfRepository
no issue

When filtering and using the BookshelfRepository, you had to use the column names instead of the entitiy field names. This is fixed by adding a transformer. Long term we want to move the NQL parsing away from the repository and into the API layer, and pass along the Mongo filter probably.
2023-09-14 14:47:02 +02:00
Simon Backx
f566729ed6
Fixed recommendation order (#18060)
fixes https://github.com/TryGhost/Product/issues/3851

- Order was not applied via the CRUD plugin
- Removed usage of CRUD findAll, and swapped to Bookshelf fetchAll
instead, to decrease dependencies of invisible Bookshelf plugins logic
- Reverted page and limit options possibility via findAll method
2023-09-11 11:04:34 +00:00
Daniel Lockyer
6dc1d08590 Re-enabled general eslint rules in TS config
refs https://github.com/TryGhost/DevOps/issues/50

- when creating a TS config in our `eslint-plugin-ghost` dependency, I
  only extended the recommended config, which left out a lot of
  stylistic things we used to enforce in JS
- this fixes that by bumping the dependency to a version which extends
  those shared configs, and fixes all the code that currently goes
  against those rules
2023-09-08 13:47:42 +02:00
Simon Backx
669be72673
Wired up pagination to recommendations (#18018)
fixes https://github.com/TryGhost/Product/issues/3822
fixes https://github.com/TryGhost/Product/issues/3838

This PR became a bit big because it affected multiple parts of Ghost
that needed to be updated to prevent breaking anything.

### Backend
- Added pagination to the recommendations API's
- Updated BookshelfRepository template implementation to handle
pagination
- Allow to pass `page` and `limit` options to Models `findAll`, to allow
fetching a page without also fetching the count/metadata (=> in the
repository pattern we prefer to fetch the count explicitly if we need
pagination metadata)
- Added E2E tests for public recommendations API (content API)
- Extended E2E tests of admin recommendations API

### Portal
- Corrected recommendations always loaded in Portal. Instead they are
now only fetched when the recommendations page is opened.

### Admin-X
- Added `usePagination` hook: internally used in the new
`usePaginatedQuery` hook. This automatically adds working pagination to
a query that can be used to display in a table by passing the
`pagination` and `isLoading` results to the `<Table>`
- Added placeholder `<LoadingIndicator>` component
- Added a loading indicator to `<Table>`. This remembers the previous
height of the table, to avoid layout jumps when going to the next page.
2023-09-08 12:32:06 +02:00
Simon Backx
8600ccf387 Added BookshelfRepository and BookshelfRecommendationRepository
refs https://github.com/TryGhost/Product/issues/3800
2023-09-01 15:10:34 +02:00