-
Notifications
You must be signed in to change notification settings - Fork 54
Refactor UI components for dark mode support and improve styling #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,8 @@ | ||||||||||||
| from fastapi import APIRouter, Depends, HTTPException | ||||||||||||
| from sqlalchemy.ext.asyncio import AsyncSession | ||||||||||||
| from sqlalchemy.future import select | ||||||||||||
| from db.db import AsyncSessionLocal | ||||||||||||
| from models.models import ( | ||||||||||||
| from app.db.db import AsyncSessionLocal | ||||||||||||
| from app.models.models import ( | ||||||||||||
| User, AudienceInsights, Sponsorship, UserPost, | ||||||||||||
| SponsorshipApplication, SponsorshipPayment, Collaboration | ||||||||||||
| ) | ||||||||||||
|
Comment on lines
+4
to
8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused SQLAlchemy imports. The static analysis tools correctly identify that all the imported SQLAlchemy-related classes and -from app.db.db import AsyncSessionLocal
-from app.models.models import (
- User, AudienceInsights, Sponsorship, UserPost,
- SponsorshipApplication, SponsorshipPayment, Collaboration
-)Also remove the unused schema imports from lines 9-12: -from schemas.schema import (
- UserCreate, AudienceInsightsCreate, SponsorshipCreate, UserPostCreate,
- SponsorshipApplicationCreate, SponsorshipPaymentCreate, CollaborationCreate
-)π Committable suggestion
Suggested change
π§° Toolsπͺ Ruff (0.11.9)4-4: Remove unused import: (F401) 6-6: Remove unused import (F401) 6-6: Remove unused import (F401) 6-6: Remove unused import (F401) 6-6: Remove unused import (F401) 7-7: Remove unused import (F401) 7-7: Remove unused import (F401) 7-7: Remove unused import (F401) πͺ Flake8 (7.2.0)[error] 4-4: 'app.db.db.AsyncSessionLocal' imported but unused (F401) [error] 5-5: 'app.models.models.User' imported but unused (F401) [error] 5-5: 'app.models.models.AudienceInsights' imported but unused (F401) [error] 5-5: 'app.models.models.Sponsorship' imported but unused (F401) [error] 5-5: 'app.models.models.UserPost' imported but unused (F401) [error] 5-5: 'app.models.models.SponsorshipApplication' imported but unused (F401) [error] 5-5: 'app.models.models.SponsorshipPayment' imported but unused (F401) [error] 5-5: 'app.models.models.Collaboration' imported but unused (F401) π€ Prompt for AI Agents |
||||||||||||
|
|
@@ -20,21 +20,30 @@ | |||||||||||
|
|
||||||||||||
| # Load environment variables | ||||||||||||
| load_dotenv() | ||||||||||||
| url: str = os.getenv("SUPABASE_URL") | ||||||||||||
| key: str = os.getenv("SUPABASE_KEY") | ||||||||||||
| url = os.getenv("SUPABASE_URL") | ||||||||||||
| key = os.getenv("SUPABASE_KEY") | ||||||||||||
| if url is None: | ||||||||||||
| raise RuntimeError("SUPABASE_URL environment variable is not set") | ||||||||||||
| if key is None: | ||||||||||||
| raise RuntimeError("SUPABASE_KEY environment variable is not set") | ||||||||||||
| supabase: Client = create_client(url, key) | ||||||||||||
|
|
||||||||||||
| # Define Router | ||||||||||||
| router = APIRouter() | ||||||||||||
|
|
||||||||||||
| # Helper Functions | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def generate_uuid(): | ||||||||||||
| return str(uuid.uuid4()) | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def current_timestamp(): | ||||||||||||
| return datetime.now(timezone.utc).isoformat() | ||||||||||||
|
|
||||||||||||
| # ========== USER ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/users/") | ||||||||||||
| async def create_user(user: UserCreate): | ||||||||||||
| user_id = generate_uuid() | ||||||||||||
|
|
@@ -53,12 +62,15 @@ async def create_user(user: UserCreate): | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/users/") | ||||||||||||
| async def get_users(): | ||||||||||||
| result = supabase.table("users").select("*").execute() | ||||||||||||
| return result | ||||||||||||
|
|
||||||||||||
| # ========== AUDIENCE INSIGHTS ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/audience-insights/") | ||||||||||||
| async def create_audience_insights(insights: AudienceInsightsCreate): | ||||||||||||
| insight_id = generate_uuid() | ||||||||||||
|
|
@@ -78,12 +90,15 @@ async def create_audience_insights(insights: AudienceInsightsCreate): | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/audience-insights/") | ||||||||||||
| async def get_audience_insights(): | ||||||||||||
| result = supabase.table("audience_insights").select("*").execute() | ||||||||||||
| return result | ||||||||||||
|
|
||||||||||||
| # ========== SPONSORSHIP ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/sponsorships/") | ||||||||||||
| async def create_sponsorship(sponsorship: SponsorshipCreate): | ||||||||||||
| sponsorship_id = generate_uuid() | ||||||||||||
|
|
@@ -103,12 +118,15 @@ async def create_sponsorship(sponsorship: SponsorshipCreate): | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/sponsorships/") | ||||||||||||
| async def get_sponsorships(): | ||||||||||||
| result = supabase.table("sponsorships").select("*").execute() | ||||||||||||
| return result | ||||||||||||
|
|
||||||||||||
| # ========== USER POST ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/posts/") | ||||||||||||
| async def create_post(post: UserPostCreate): | ||||||||||||
| post_id = generate_uuid() | ||||||||||||
|
|
@@ -127,12 +145,15 @@ async def create_post(post: UserPostCreate): | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/posts/") | ||||||||||||
| async def get_posts(): | ||||||||||||
| result = supabase.table("user_posts").select("*").execute() | ||||||||||||
| return result | ||||||||||||
|
|
||||||||||||
| # ========== SPONSORSHIP APPLICATION ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/sponsorship-applications/") | ||||||||||||
| async def create_sponsorship_application(application: SponsorshipApplicationCreate): | ||||||||||||
| application_id = generate_uuid() | ||||||||||||
|
|
@@ -150,12 +171,15 @@ async def create_sponsorship_application(application: SponsorshipApplicationCrea | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/sponsorship-applications/") | ||||||||||||
| async def get_sponsorship_applications(): | ||||||||||||
| result = supabase.table("sponsorship_applications").select("*").execute() | ||||||||||||
| return result | ||||||||||||
|
|
||||||||||||
| # ========== SPONSORSHIP PAYMENT ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/sponsorship-payments/") | ||||||||||||
| async def create_sponsorship_payment(payment: SponsorshipPaymentCreate): | ||||||||||||
| payment_id = generate_uuid() | ||||||||||||
|
|
@@ -172,12 +196,15 @@ async def create_sponsorship_payment(payment: SponsorshipPaymentCreate): | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/sponsorship-payments/") | ||||||||||||
| async def get_sponsorship_payments(): | ||||||||||||
| result = supabase.table("sponsorship_payments").select("*").execute() | ||||||||||||
| return result | ||||||||||||
|
|
||||||||||||
| # ========== COLLABORATION ROUTES ========== | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.post("/collaborations/") | ||||||||||||
| async def create_collaboration(collab: CollaborationCreate): | ||||||||||||
| collaboration_id = generate_uuid() | ||||||||||||
|
|
@@ -194,6 +221,7 @@ async def create_collaboration(collab: CollaborationCreate): | |||||||||||
|
|
||||||||||||
| return response | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @router.get("/collaborations/") | ||||||||||||
| async def get_collaborations(): | ||||||||||||
| result = supabase.table("collaborations").select("*").execute() | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Refactor or relocate the
sys.pathhack.The runtime path append appears after the imports, so it won't help resolve them and is fragile across environments. Consider moving this line above the imports or, better, removing it entirely by structuring the project as a proper Python package (e.g., using
setup.pyorpyproject.toml) and running withpython -m.Apply this diff to reorder and harden path setup:
π Committable suggestion
π€ Prompt for AI Agents