Ghost/core/server/api/canary/utils
Fabien 'egg' O'Carroll c19d282a51
Ensured Admin API members resource only returns known fields (#12240)
refs #12055

As part of the work in TryGhost/Members#206 we load the stripeCustomers relation on the member model, and we do not want this to be part of the API response. The changes here include a refactor but the main thing is that the serialized object is explicit and does not include unexpected or unknown fields.

* Moved mapMember out of mapper file

This cleans up the serializer a bit by keeping it's functionality all in
one place, rather than a shared mapper file

* Refactored members controller to return models

Previously the controller was calling toJSON, which is serialization,
this updates the controller to only deal with models, leaving all of the
serialization to the serializer!

* Refactored members serializer

This adds typings to all of the methods/functions in the serializer, as
well as making the serializating explicit, rather than returning the
result of toJSON, we explicitly set the properties we expect to be on
the output object. This protects us against accidental API changes in
the future.
2020-09-30 10:22:22 +01:00
..
serializers Ensured Admin API members resource only returns known fields (#12240) 2020-09-30 10:22:22 +01:00
validators Extracted Admin API JSON schemas into @tryghost/admin-api-schema (#12237) 2020-09-30 16:25:12 +13:00
index.js 💡 Added canary api endpoint 2019-08-09 20:46:49 +05:30
permissions.js Refactored common lib import to use destructuring (#11835) 2020-05-22 19:22:20 +01:00