I'm creating a subscription based website with exclusive video contents.
Types of Subscription
- Basic
- Hobbyist
- Professional
I have 3 subscription plans, and each subscription package can only access some videos indicated in the package. So, I have to create a column that indicate what subscription plans allowed to access each video.
In the example below, the video can only be access if the customer is using Professional Subscription plan
class Video(db.Model):
- id = 1
- name = 'video 1'
- allowed_subscription = ['professional']
In this another example, the video can be access by all subscription plan.
class Video(db.Model):
- id = 2
- name = 'video 2'
- allowed_subscription = ['basic', 'hobbyist', 'professional']
What's the best way to implement this type of model? How can I properly implement the allowed_subscription logic?
PS: I'm using Flask and SQLAlchemy (MySQL Database)