Ghost/ghost/core/test/e2e-api
Simon Backx b545dfa0cc
Improved recommendation controller structure (#18208)
fixes https://github.com/TryGhost/Product/issues/3900

1. The service never returns a Recommendation Entity, but always plain
objects (which for now is the same as Recommendation without the
methods).
2. Updated the controller to be more readable and minimal (we keep this
controller, in addition to the existing endpoints and serializers)
- The controller does minimal validation and allows for type checking
(so we get compile time errors in case the service expects new fields)
- The controller uses the `UnsafeData` class to easily validate the
input from requests, and throws appropriate errors (with correct field
descriptions — "Expected a string at recommendations.0.title") without
too much boilerplate code. In addition the interface is typed, so we get
compile errors if there are breaking changes in the service.
- Removed `EntityWithIncludes`, since we now use plain objects, we
inject the relations directly into those plain objects (with some new
types that add type support)
- Added new tests to make sure that edits only affect the given fields,
and never undefined fields
2023-09-18 14:36:49 +00:00
..
admin Improved recommendation controller structure (#18208) 2023-09-18 14:36:49 +00:00
content Added stats to recommendations endpoints 2023-09-15 15:57:27 +02:00
members Added click tracking endpoints for recommendations 2023-09-14 14:47:02 +02:00
members-comments Updated to use assert/strict everywhere (#17047) 2023-06-21 09:56:59 +01:00
shared Updated Portal to always honor outboundLinkTagging setting (#18079) 2023-09-12 10:27:04 +00:00
webmentions Updated to use assert/strict everywhere (#17047) 2023-06-21 09:56:59 +01:00