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

- 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:
yves.gugger
2025-12-12 15:06:47 +01:00
parent 1705b5cc6e
commit dc12f14638
5 changed files with 18 additions and 16 deletions

View File

@ -11,7 +11,7 @@ Provides admin-only access to:
from datetime import datetime, timedelta
from pathlib import Path
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 sqlalchemy import select, func, desc

View File

@ -899,9 +899,9 @@ async def get_market_feed(
# Build base filters (SQL-side)
# -----------------------------
listing_filters = [DomainListing.status == ListingStatus.ACTIVE.value]
if keyword:
if keyword:
listing_filters.append(DomainListing.domain.ilike(f"%{keyword}%"))
if verified_only:
if verified_only:
listing_filters.append(DomainListing.verification_status == VerificationStatus.VERIFIED.value)
if min_price is not None:
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}%"))
if 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)
if max_price is not None:
if max_price is not None:
auction_filters.append(DomainAuction.current_bid <= max_price)
if ending_within:
cutoff = now + timedelta(hours=ending_within)
@ -1026,13 +1026,13 @@ async def get_market_feed(
pounce_score = auction.pounce_score
if pounce_score is None:
pounce_score = _calculate_pounce_score_v2(
auction.domain,
auction.tld,
num_bids=auction.num_bids,
age_years=auction.age_years or 0,
pounce_score = _calculate_pounce_score_v2(
auction.domain,
auction.tld,
num_bids=auction.num_bids,
age_years=auction.age_years or 0,
is_pounce=False,
)
)
if pounce_score < min_score:
continue

View File

@ -28,7 +28,7 @@ async def get_current_user(
token: Optional[str] = None
if credentials is not None:
token = credentials.credentials
token = credentials.credentials
if not token:
token = request.cookies.get(AUTH_COOKIE_NAME)

View File

@ -15,7 +15,9 @@ from sqlalchemy.orm import Session
from app.api.deps import get_db, get_current_user
from app.models.user import User
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 (
YieldDomainCreate,
YieldDomainUpdate,

View File

@ -49,8 +49,8 @@ async def lifespan(app: FastAPI):
# Start scheduler (optional - recommended: run in separate process/container)
if settings.enable_scheduler:
start_scheduler()
logger.info("Scheduler started")
start_scheduler()
logger.info("Scheduler started")
else:
logger.info("Scheduler disabled (ENABLE_SCHEDULER=false)")
@ -58,7 +58,7 @@ async def lifespan(app: FastAPI):
# Shutdown
if settings.enable_scheduler:
stop_scheduler()
stop_scheduler()
logger.info("Application shutdown complete")