0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server
Katharina Irrgang 9ede5905f6
Reduce toJSON implementation: use the power of bookshelf (#9423)
refs #6103

- simplify `toJSON`
- `baseKey` was not used - have not find a single use case
- all the functionality of our `toJSON` is offered in bookshelf
- `omitPivot` does remove pivot elements from the JSON obj (bookshelf feature)
- `shallow` allows you to not return relations
- make use of `serialize`, see http://bookshelfjs.org/docs/src_base_model.js.html#line260
- fetching nested relations e.g. `users.roles` still works (unrelated to this refactoring)

> pick('shallow', 'baseKey', 'include', 'context')

We will re-add options validation in https://github.com/TryGhost/Ghost/pull/9427, but then with the official way: use `filterOptions`.

---

We return all fetched relations (pre-defined with `withRelated`) by default.
You can disable it with `shallow:true`.
2018-02-14 17:32:11 +01:00
..
adapters Moved utils constants to lib/constants 2017-12-14 14:13:40 +01:00
api Contributor Role (#9315) 2018-02-07 10:46:22 +01:00
apps Moved make-absolute-urls to url service 2017-12-14 22:34:37 +01:00
config Update Notification improvements (#9123) 2018-01-09 15:20:00 +01:00
controllers Moved tokens, url safe and safe string utility to lib/security 2017-12-14 13:38:00 +01:00
data 🐛 Fixed migrating from < 1.13 to 1.21 2018-02-07 12:31:21 +01:00
helpers Removed html usage in error messages (#9444) 2018-02-07 09:35:48 +01:00
lib Fixed missing export of card-markdown card and broken tests 2018-02-01 16:26:56 +01:00
models Reduce toJSON implementation: use the power of bookshelf (#9423) 2018-02-14 17:32:11 +01:00
public 🛠 🙈 Rename ghost-url.js to ghost-sdk.js (#8767) 2017-07-28 18:23:32 +04:00
services 🐛 Reload translations if active theme get's overridden (#9392) 2018-01-12 09:19:28 +00:00
translations Removed html usage in error messages (#9444) 2018-02-07 09:35:48 +01:00
views Fixed error trying to render 404 for missing asset 2017-12-22 20:08:59 +00:00
web 🐛Fixed asset redirects (#9455) 2018-02-14 17:21:31 +01:00
analytics-events.js Cleared out old unused events 2017-12-13 09:08:25 +00:00
filters.js Moved pipeline/sequence to lib/promise 2017-12-13 22:20:02 +01:00
ghost-server.js Always require fs-extra - consistency change 2017-12-13 20:57:11 +01:00
index.js Theme translations and blog localisation (#8437) 2018-01-09 14:50:57 +01:00
overrides.js Set Promise to be Bluebird globally 2017-12-13 20:57:11 +01:00
update-check.js Update Notification improvements (#9123) 2018-01-09 15:20:00 +01:00