diff --git a/infra/db/postgres.py b/infra/db/postgres.py index 90d8849..c64aa08 100644 --- a/infra/db/postgres.py +++ b/infra/db/postgres.py @@ -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)}") diff --git a/models/currency.py b/models/currency.py index a494b90..5b27dd3 100644 --- a/models/currency.py +++ b/models/currency.py @@ -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 } diff --git a/repositories/currency.py b/repositories/currency.py index d90ec0a..128ad60 100644 --- a/repositories/currency.py +++ b/repositories/currency.py @@ -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}")