[34588f42] Chore: Build-Artefakte und UI-Struktur-Fixes

- Frontend Produktions-Build aktualisiert.
- Syntax-Fehler in App.tsx korrigiert und Tabs-Layout stabilisiert.
This commit is contained in:
2026-04-18 13:09:23 +00:00
parent 2a85cab4ab
commit e6061868e6
9 changed files with 674 additions and 364 deletions

View File

@@ -42,6 +42,13 @@ class ReleaseParticipant(Base):
first_name = Column(String)
last_updated = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)
class ReleaseHistory(Base):
__tablename__ = "release_history"
id = Column(Integer, primary_key=True)
timestamp = Column(DateTime, default=datetime.datetime.utcnow)
recipient_count = Column(Integer)
scheduled_time = Column(String, nullable=True)
Base.metadata.create_all(bind=engine)
def get_db():

View File

@@ -1,7 +1,7 @@
from fastapi import APIRouter, Depends, HTTPException, Request, BackgroundTasks
from pydantic import BaseModel
from sqlalchemy.orm import Session
from database import get_db, DiscountCode, ReleaseParticipant
from database import get_db, DiscountCode, ReleaseParticipant, ReleaseHistory
import datetime
import logging
from gmail_service import GmailService
@@ -96,9 +96,18 @@ async def send_requests(data: SendReleaseRequest, background_tasks: BackgroundTa
if data.scheduled_time:
# Pass a way to get a new session to the background task
from database import SessionLocal
# Log to history
db.add(ReleaseHistory(recipient_count=len(data.emails), scheduled_time=data.scheduled_time))
db.commit()
background_tasks.add_task(delayed_send, data.emails, data.scheduled_time, SessionLocal)
return {"status": "scheduled", "message": f"Versand für {data.scheduled_time} geplant."}
# Log immediate send to history
db.add(ReleaseHistory(recipient_count=len(data.emails), scheduled_time="Sofort"))
db.commit()
# Immediate send
service = GmailService(db)
success = 0
@@ -111,6 +120,11 @@ async def send_requests(data: SendReleaseRequest, background_tasks: BackgroundTa
return {"status": "success", "success": success, "failed": failed}
@router.get("/history")
def get_history(db: Session = Depends(get_db)):
history = db.query(ReleaseHistory).order_by(ReleaseHistory.timestamp.desc()).all()
return [{"id": h.id, "timestamp": h.timestamp.isoformat(), "recipient_count": h.recipient_count, "scheduled_time": h.scheduled_time} for h in history]
@router.get("/stats")
def get_stats(db: Session = Depends(get_db)):
total = db.query(DiscountCode).count()