Commit Graph

5 Commits

Author SHA1 Message Date
Fabien O'Carroll
ec8dbf2890 Added products as default relation when fetching members
no-issue

As subscriptions are a default relation, and we now require products to
populate subscriptions for comped members, we need to include products
by default when reading members.
2021-08-26 16:10:13 +02:00
Fabien O'Carroll
83d4b5f834 Handled missing data in read method bread service
refs https://github.com/TryGhost/Team/issues/873

The `get` method of the member repository will return null when no
member is found - we must ensure that we don't attempt to call toJSON!

It is also possible for a member to not have any products, in which case
we should not attempt to iterate over them, and we can return early.
2021-08-26 12:58:39 +02:00
Fabien O'Carroll
3a91687b08 Used current time for created_at for missing events
refs https://github.com/TryGhost/Team/issues/873

This is an unexpected state, but possible if the alpha version of tier
has been enabled previous to the events being added.
2021-08-26 11:52:53 +02:00
Fabien O'Carroll
86f5879432 Added dummy subscriptions for comped members
refs https://github.com/TryGhost/Team/issues/873

This adds a dummy subscription for each product that a member has
without an associated stripe subscription. It allows clients to deal
with things like a created date for comped members.
2021-08-25 21:26:04 +02:00
Fabien O'Carroll
c17442cf4b Added memberService to members-api
no-issue

The idea of this service is to sit infront of the repository and handle
application logic which does not belong at the data layer. The exact
naming and structure is TBC but this gives us a place to start pulling
logic out of the controllers, without having to mash it all into the
repository.

Also important to note is that is does not return instances of bookshelf
models, but a JSON representation of the model, this allows us to not
leak internal implementation to consumers.
2021-08-25 21:25:19 +02:00