closes ENG-730
closes https://linear.app/tryghost/issue/ENG-730/
We've updated the input serializer to parse the filter, and responded
with an error if it cannot be parsed correctly.
Now that it's parsed, we can pass a mongo query object through the
stack, which will lend itself to better typing for this code, which is a
direction we want to go in anyway. We've had to update all the internal
usages of the `browse` method to use mongo query objects.
refs https://github.com/TryGhost/Team/issues/2077
- The "productRepository" methods have been deprecated in favor of "tiers" and "Tiers API".
- The changes migrated usages of "productRepository.getDefaultProduct" to Tiers API's "readDefaultTier"
refs https://github.com/TryGhost/Team/issues/2078
These events are all required for other parts of the Ghost system to stay in
sync. The events on each Tier object will be dispatched by the TierRepository
once they've been persisted.
TierCreatedEvent - generate Stripe Products & Prices
TierNameChangeEvent - update Stripe Products
TierPriceChangeEvent - update Stripe Products & Prices
TierArchivedEvent - update the Portal settings for visible tiers
- disable Stripe Products & Prices
TierActivatedEvent - enable Stripe Products & Prices
refs https://github.com/TryGhost/Team/issues/2078
The check for creating free Tiers needs to be explicit, rather than implicit
because the type is optional, we only want to error if it is explicitly passed
as "free", not if it is missing as "paid".
refs https://github.com/TryGhost/Team/issues/2078
Having to map between snake_case and camelCase was becoming confusing, so this
updates the Tier object to exclusively use camelCase, and the snake_case for the
API can be handled by the serializer/mapper or at the controller level.
refs https://github.com/TryGhost/Team/issues/2078
This removes the burden from the Tier object, and allows us to reuse
the existing slug generation implementation we have in our bookshelf
models.
refs https://github.com/TryGhost/Team/issues/2078
This pulls the current Tiers logic into its own package, the persistence part of
the work has not been done yet, that will be handled in core, so all bookshelf
model specific stuff is kept together.