-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORE-2017: added support for specified start dates #65
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't catch any issues 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just spotted a couple typos, otherwise I think this looks right to me.
internal/db/subscriptions.go
Outdated
Where("users.username=?", username). | ||
Where( | ||
db.Where("? BETWEEN subscriptions.effective_start_date AND subscriptions.effective_end_date", date). | ||
Or("? > subscriptions.effective_start_date AND subscriptions.effecrtive_end_date IS NULL"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
effecrtive
is a typo here, I suspect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, that is a typo. Thanks for catching that.
internal/db/subscriptions.go
Outdated
@@ -265,8 +301,8 @@ func ListSubscriptions(ctx context.Context, db *gorm.DB, params *SubscriptionLis | |||
// GetActiveSubscriptionDetails retrieves the user plan information that is currently active for the user. The effective | |||
// start date must be before the current date and the effective end date must either be null or after the current date. | |||
// If multiple active user plans exist, the one with the most recent effective start date is used. If no active user | |||
// plans exist for the user then a new one for the basic plan is created. This funciton is like GetActiveSubscription except | |||
// that it also loads all of the user plan details from the database. | |||
// plans exist for the user then a new one for the basic plan is created. This funciton is like GetActiveSubscription |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unimportant but: funciton
Thanks for the reviews! 👍 |
The purpose of this change is to enable subscription renewals. The basic use case is that the user has a subscription that lasts until a specific date and wants to extend the subscription. This will be done by creating a new subscription with its effective date set to the time when the current subscription ends. Since this is a generalized feature, we need to address cases where subscriptions overlap.