Skip to content

Commit 5d411cb

Browse files
committed
Refactor kit and trip APIs to adjust user subscription limits
- Removed the subscription check for creating kits, allowing all users to create kits regardless of subscription status. - Increased the limit of active trips for non-subscribed users from 1 to 3, enabling greater flexibility for free users.
1 parent 1c5c590 commit 5d411cb

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

app/api/kit.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ def get_kit(kit_id: int, user: User = Depends(authenticate)):
3939

4040
@route.post("", status_code=201)
4141
def create_kit(payload: KitType, user: User = Depends(authenticate)):
42-
# Kits are a premium feature. Existing free users who already created kits
43-
# before the paywall are grandfathered in; brand-new free users are gated.
44-
if not user.is_subscribed:
45-
existing_kits = db.session.query(Kit).filter_by(user_id=user.id).count()
46-
if existing_kits == 0:
47-
raise HTTPException(402, "Upgrade to create kits.")
48-
4942
kit = Kit(name=payload.name, user_id=user.id)
5043

5144
try:

app/api/trip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
route = APIRouter()
1818

1919
# Number of active (non-removed) trips a non-subscribed user may have.
20-
FREE_TRIP_LIMIT = 1
20+
FREE_TRIP_LIMIT = 3
2121

2222

2323
def _enforce_trip_limit(user: User):
@@ -30,7 +30,7 @@ def _enforce_trip_limit(user: User):
3030

3131
if active_trips >= FREE_TRIP_LIMIT:
3232
raise HTTPException(
33-
402, "Upgrade to create more than one trip.")
33+
402, "Upgrade to create more than three packs.")
3434

3535

3636
@route.get("")

0 commit comments

Comments
 (0)