I am trying to model a subscription based service provider and running into a case of “vapor lock”, if you will. I have defined the following model, where the user subscribes to a Package of various services – each Package level contains one or more services:
+---------------+ +-----------------+ +----------+
| Packages |<--- | PackageServices | ---> | Services |
+---------------+ +-----------------+ +----------+
^
|
+---------------+ +----------+
| Subscriptions |---> | Users |
+---------------+ +----------+
However, each service then has their own user defined settings – and each service may have an associated array of other entities to store the service data. I can handle each Service’s data entities for the particular user, but I’m stumped on the settings table. I’ve thought of creating a “ServiceSettings” tabled keyed to Users and Services, but that seems a little weird. That approach leaves me with the following questions:
- What if they upgrade their Package and get new services?
- How would new ServiceSettings be set or constrained to only the Services the user has susbcribed to?
- What if I add a new Service?
Am I on the right track, or is there another alternative that I appear to be missing?
Thanks in advance!
I like your ServiceSettings; but only to define the list of settings for each service. The values of those service Settings must exist in either a SubscriptionServiceSettings or a UserServiceSettings depending on if multiple users can share a subscription but have different service settings or not. As you add a new service, you must provide default values so that when they are added; the user gets those defaults at first; but can change them to fit their needs. And/Or users need some sort of notification regarding new service settings.
So to directly address the questions:
What if they upgrade their Package and get new services?
Use a userServicesSettings to retain package settings and as they subscribe to a package that has those settings, use them, otherwise ignore them; but retain them for altered services in the future (again a business question)
How would new ServiceSettings be set or constrained to only the Services the user has susbcribed to?
That’s just a join between the subscription, pacakage, packageservices, and ServiceSettings. (Unless you want to maintain package versions; but that’s a whole different line of thought)
What if I add a new Service? So you add new serviceSettings, UserServiceSettings are defaulted (or notification to user is provided so they can fill in what they want, or both) and now you have the needed details. Defaults are useful in dynamic environments incase people don’t make decisions you NEED them to make. Default values say, you’ll get this unless you change it; causing people to accept default or take action.