Skip to content

Commit

Permalink
Add the 50k plan
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Apr 10, 2024
1 parent 4234693 commit 88b9afc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/pkg/entities/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func (subscription SubscriptionName) Limit() uint {
if subscription == SubscriptionName20KMonthly || subscription == SubscriptionName20KYearly {
return 20_000
}
if subscription == SubscriptionName50KMonthly || subscription == SubscriptionName50KYearly {
return 50_000
}
if subscription == SubscriptionName100KMonthly || subscription == SubscriptionName100KYearly {
return 100_000
}
Expand Down Expand Up @@ -59,12 +62,18 @@ const SubscriptionName20KMonthly = SubscriptionName("20k-monthly")
// SubscriptionName100KMonthly represents a monthly 100k subscription
const SubscriptionName100KMonthly = SubscriptionName("100k-monthly")

// SubscriptionName50KMonthly represents a monthly 50k subscription
const SubscriptionName50KMonthly = SubscriptionName("50k-monthly")

// SubscriptionName20KYearly represents a yearly 20k subscription
const SubscriptionName20KYearly = SubscriptionName("20k-yearly")

// SubscriptionName100KYearly represents a yearly 100k subscription
const SubscriptionName100KYearly = SubscriptionName("100k-yearly")

// SubscriptionName50KYearly represents a yearly 50k subscription
const SubscriptionName50KYearly = SubscriptionName("50k-yearly")

// User stores information about a user
type User struct {
ID UserID `json:"id" gorm:"primaryKey;type:string;" example:"WB7DRDWrJZRGbYrv2CKGkqbzvqdC"`
Expand Down
7 changes: 7 additions & 0 deletions api/pkg/services/lemonsqueezy_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,12 @@ func (service *LemonsqueezyService) subscriptionName(variant string) entities.Su
return entities.SubscriptionName100KYearly
}

if strings.Contains(strings.ToLower(variant), "50k") {
if strings.Contains(strings.ToLower(variant), "monthly") {
return entities.SubscriptionName50KMonthly
}
return entities.SubscriptionName50KYearly
}

return entities.SubscriptionNameFree
}

0 comments on commit 88b9afc

Please sign in to comment.