Update routes/stylist.py
Browse files- routes/stylist.py +4 -1
routes/stylist.py
CHANGED
@@ -138,7 +138,10 @@ def format_subscription_date(created_at_str: str) -> str:
|
|
138 |
def get_active_subscribers(user_id: str, page: int) -> Dict[str, Any]:
|
139 |
limit = 30
|
140 |
offset = page * limit
|
141 |
-
|
|
|
|
|
|
|
142 |
response = requests.get(url, headers=SUPABASE_HEADERS)
|
143 |
if response.status_code == 200:
|
144 |
subscribers = response.json()
|
|
|
138 |
def get_active_subscribers(user_id: str, page: int) -> Dict[str, Any]:
|
139 |
limit = 30
|
140 |
offset = page * limit
|
141 |
+
|
142 |
+
# Ordenar por created_at em ordem decrescente (mais recente primeiro)
|
143 |
+
url = f"{SUPABASE_URL}/rest/v1/Subscriptions?stylist_id=eq.{user_id}&active=eq.true&order=created_at.desc&limit={limit}&offset={offset}"
|
144 |
+
|
145 |
response = requests.get(url, headers=SUPABASE_HEADERS)
|
146 |
if response.status_code == 200:
|
147 |
subscribers = response.json()
|