fixing !rank currency
This commit is contained in:
@@ -40,9 +40,6 @@ class PostgresConnection:
|
||||
|
||||
# Tạo client với SSL context
|
||||
self.supabase: Client = create_client(url, key)
|
||||
|
||||
# Test connection
|
||||
self.supabase.table('discord_server').select('count').limit(1).execute()
|
||||
print("Successfully connected to Supabase!")
|
||||
except Exception as e:
|
||||
raise Exception(f"Failed to connect to Supabase: {str(e)}")
|
||||
|
||||
@@ -20,6 +20,7 @@ class DiscordCurrency:
|
||||
return {
|
||||
"id": self.id,
|
||||
"user_id": self.user_id,
|
||||
"user_name": self.user_name,
|
||||
"balance": self.balance,
|
||||
"updated_at": self.updated_at
|
||||
}
|
||||
|
||||
@@ -64,13 +64,14 @@ class CurrencyRepository:
|
||||
response = self.table.select('*').order("balance", desc=True).execute()
|
||||
currencies = []
|
||||
for data in response.data:
|
||||
currencies.append(DiscordCurrency(
|
||||
currency = DiscordCurrency(
|
||||
id=data.get('id'),
|
||||
user_id=data['user_id'],
|
||||
user_name=data['user_name'],
|
||||
balance=data['balance'],
|
||||
updated_at=datetime.fromisoformat(data['updated_at'].replace('Z', '+00:00')) if data['updated_at'] else datetime.now()
|
||||
))
|
||||
updated_at=datetime.now()
|
||||
)
|
||||
currencies.append(currency)
|
||||
return currencies
|
||||
except Exception as e:
|
||||
print(f"Error getting all users: {e}")
|
||||
|
||||
Reference in New Issue
Block a user