Setting Booking rules


I am currently building a booking app for fitness gym.
I am having trouble defining rules for booking restriction based on the account subscription.
We have a 2 classes a week subscription, but I can’t figure how to limit that for next weeks.

Plus, I don’t get how to implement subscription pause (holydays…) and booking restrictions.

Any ideas how to structure database for that case?

You could store the allowable classes per week as a numerical value under the user. Then have a date start and end field under the user for each subscription period.

If you had a scheduled API workflow, you could then tell the workflow to run every day at a certain time to check all users and reset the allowable classes per week, start date, end date, fields for users past the end date.

This does take some workflow knowledge, but it is possible. Your other option is to use database triggers.