fix: resolve indentation and import errors in backend
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
- Fix indentation in main.py (scheduler if/else blocks) - Fix indentation in deps.py (credentials check) - Fix indentation in auctions.py (filter blocks) - Add BackgroundTasks import to admin.py - Fix settings import in yield_domains.py (use get_settings())
This commit is contained in:
@ -11,7 +11,7 @@ Provides admin-only access to:
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from fastapi import APIRouter, HTTPException, status, Depends
|
from fastapi import APIRouter, HTTPException, status, Depends, BackgroundTasks
|
||||||
from pydantic import BaseModel, EmailStr
|
from pydantic import BaseModel, EmailStr
|
||||||
from sqlalchemy import select, func, desc
|
from sqlalchemy import select, func, desc
|
||||||
|
|
||||||
|
|||||||
@ -899,9 +899,9 @@ async def get_market_feed(
|
|||||||
# Build base filters (SQL-side)
|
# Build base filters (SQL-side)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
listing_filters = [DomainListing.status == ListingStatus.ACTIVE.value]
|
listing_filters = [DomainListing.status == ListingStatus.ACTIVE.value]
|
||||||
if keyword:
|
if keyword:
|
||||||
listing_filters.append(DomainListing.domain.ilike(f"%{keyword}%"))
|
listing_filters.append(DomainListing.domain.ilike(f"%{keyword}%"))
|
||||||
if verified_only:
|
if verified_only:
|
||||||
listing_filters.append(DomainListing.verification_status == VerificationStatus.VERIFIED.value)
|
listing_filters.append(DomainListing.verification_status == VerificationStatus.VERIFIED.value)
|
||||||
if min_price is not None:
|
if min_price is not None:
|
||||||
listing_filters.append(DomainListing.asking_price >= min_price)
|
listing_filters.append(DomainListing.asking_price >= min_price)
|
||||||
@ -918,9 +918,9 @@ async def get_market_feed(
|
|||||||
auction_filters.append(DomainAuction.domain.ilike(f"%{keyword}%"))
|
auction_filters.append(DomainAuction.domain.ilike(f"%{keyword}%"))
|
||||||
if tld_clean:
|
if tld_clean:
|
||||||
auction_filters.append(DomainAuction.tld == tld_clean)
|
auction_filters.append(DomainAuction.tld == tld_clean)
|
||||||
if min_price is not None:
|
if min_price is not None:
|
||||||
auction_filters.append(DomainAuction.current_bid >= min_price)
|
auction_filters.append(DomainAuction.current_bid >= min_price)
|
||||||
if max_price is not None:
|
if max_price is not None:
|
||||||
auction_filters.append(DomainAuction.current_bid <= max_price)
|
auction_filters.append(DomainAuction.current_bid <= max_price)
|
||||||
if ending_within:
|
if ending_within:
|
||||||
cutoff = now + timedelta(hours=ending_within)
|
cutoff = now + timedelta(hours=ending_within)
|
||||||
@ -1026,13 +1026,13 @@ async def get_market_feed(
|
|||||||
|
|
||||||
pounce_score = auction.pounce_score
|
pounce_score = auction.pounce_score
|
||||||
if pounce_score is None:
|
if pounce_score is None:
|
||||||
pounce_score = _calculate_pounce_score_v2(
|
pounce_score = _calculate_pounce_score_v2(
|
||||||
auction.domain,
|
auction.domain,
|
||||||
auction.tld,
|
auction.tld,
|
||||||
num_bids=auction.num_bids,
|
num_bids=auction.num_bids,
|
||||||
age_years=auction.age_years or 0,
|
age_years=auction.age_years or 0,
|
||||||
is_pounce=False,
|
is_pounce=False,
|
||||||
)
|
)
|
||||||
if pounce_score < min_score:
|
if pounce_score < min_score:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ async def get_current_user(
|
|||||||
|
|
||||||
token: Optional[str] = None
|
token: Optional[str] = None
|
||||||
if credentials is not None:
|
if credentials is not None:
|
||||||
token = credentials.credentials
|
token = credentials.credentials
|
||||||
if not token:
|
if not token:
|
||||||
token = request.cookies.get(AUTH_COOKIE_NAME)
|
token = request.cookies.get(AUTH_COOKIE_NAME)
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,9 @@ from sqlalchemy.orm import Session
|
|||||||
from app.api.deps import get_db, get_current_user
|
from app.api.deps import get_db, get_current_user
|
||||||
from app.models.user import User
|
from app.models.user import User
|
||||||
from app.models.yield_domain import YieldDomain, YieldTransaction, YieldPayout, AffiliatePartner
|
from app.models.yield_domain import YieldDomain, YieldTransaction, YieldPayout, AffiliatePartner
|
||||||
from app.config import settings
|
from app.config import get_settings
|
||||||
|
|
||||||
|
settings = get_settings()
|
||||||
from app.schemas.yield_domain import (
|
from app.schemas.yield_domain import (
|
||||||
YieldDomainCreate,
|
YieldDomainCreate,
|
||||||
YieldDomainUpdate,
|
YieldDomainUpdate,
|
||||||
|
|||||||
@ -49,8 +49,8 @@ async def lifespan(app: FastAPI):
|
|||||||
|
|
||||||
# Start scheduler (optional - recommended: run in separate process/container)
|
# Start scheduler (optional - recommended: run in separate process/container)
|
||||||
if settings.enable_scheduler:
|
if settings.enable_scheduler:
|
||||||
start_scheduler()
|
start_scheduler()
|
||||||
logger.info("Scheduler started")
|
logger.info("Scheduler started")
|
||||||
else:
|
else:
|
||||||
logger.info("Scheduler disabled (ENABLE_SCHEDULER=false)")
|
logger.info("Scheduler disabled (ENABLE_SCHEDULER=false)")
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ async def lifespan(app: FastAPI):
|
|||||||
|
|
||||||
# Shutdown
|
# Shutdown
|
||||||
if settings.enable_scheduler:
|
if settings.enable_scheduler:
|
||||||
stop_scheduler()
|
stop_scheduler()
|
||||||
logger.info("Application shutdown complete")
|
logger.info("Application shutdown complete")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user