Skip to content

Commit 990b0e4

Browse files
committed
Cleanup frontend and unify typing
1 parent a42fd4c commit 990b0e4

19 files changed

+1080
-1101
lines changed

backend/app/routers/admin.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from fastapi import APIRouter, Depends, HTTPException, status, Response, Request
1010
from sqlalchemy import select, delete, func, text, desc, and_
1111
from sqlalchemy.ext.asyncio import AsyncSession
12+
import sqlparse
1213

1314
from ..database import get_database
1415
from ..admin_auth import (
@@ -1084,8 +1085,23 @@ async def execute_query(
10841085
admin_username = admin_session.github_username
10851086

10861087
try:
1087-
# Execute the query
1088-
result = await db.execute(text(query))
1088+
# Split statements using sqlparse and execute each separately
1089+
statements = [stmt.strip() for stmt in sqlparse.split(query) if stmt.strip()]
1090+
1091+
# Execute all statements
1092+
total_affected_rows = 0
1093+
for stmt in statements:
1094+
stmt_result = await db.execute(text(stmt))
1095+
total_affected_rows += stmt_result.rowcount
1096+
await db.commit()
1097+
1098+
# Create simple result object
1099+
class MultiStatementResult:
1100+
rowcount = total_affected_rows
1101+
def fetchall(self): return []
1102+
def keys(self): return []
1103+
1104+
result = MultiStatementResult()
10891105

10901106
if query_upper.startswith("SELECT") or query_upper.startswith("WITH"):
10911107
# For SELECT queries, fetch all results

backend/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ pytest
1111
pytest-asyncio
1212
httpx
1313
authlib>=1.2.0
14+
sqlparse

frontend/package-lock.json

Lines changed: 264 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)