Initial commit: Pole Dance Championships App
Full-stack mobile app for pole dance championship management. Backend: FastAPI + SQLAlchemy 2 (async) + SQLite (dev) / PostgreSQL (prod) - JWT auth with refresh token rotation - Championship CRUD with Instagram Graph API sync (APScheduler) - Registration flow with status management - Participant list publish with Expo push notifications - Alembic migrations, pytest test suite Mobile: React Native + Expo (TypeScript) - Auth gate: pending approval screen for new members - Championships list & detail screens - Registration form with status tracking - React Query + Zustand + React Navigation v6 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
49
backend/app/services/participant_service.py
Normal file
49
backend/app/services/participant_service.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.crud import crud_championship, crud_participant, crud_registration, crud_user
|
||||
from app.models.participant_list import ParticipantList
|
||||
from app.models.user import User
|
||||
from app.services import notification_service
|
||||
|
||||
|
||||
async def publish_participant_list(
|
||||
db: AsyncSession,
|
||||
championship_id: uuid.UUID,
|
||||
organizer: User,
|
||||
) -> ParticipantList:
|
||||
pl = await crud_participant.get_by_championship(db, championship_id)
|
||||
if not pl:
|
||||
raise ValueError("Participant list not found — create it first")
|
||||
|
||||
pl = await crud_participant.publish(db, pl)
|
||||
|
||||
championship = await crud_championship.get(db, championship_id)
|
||||
registrations = await crud_registration.list_by_championship(db, championship_id)
|
||||
|
||||
for reg in registrations:
|
||||
user = await crud_user.get(db, reg.user_id)
|
||||
if not user:
|
||||
continue
|
||||
|
||||
if reg.status == "accepted":
|
||||
title = "Congratulations!"
|
||||
body = f"You've been accepted to {championship.title}!"
|
||||
elif reg.status == "rejected":
|
||||
title = "Application Update"
|
||||
body = f"Unfortunately, your application to {championship.title} was not accepted this time."
|
||||
else:
|
||||
title = "Application Update"
|
||||
body = f"You are on the waitlist for {championship.title}."
|
||||
|
||||
await notification_service.send_push_notification(
|
||||
db=db,
|
||||
user=user,
|
||||
title=title,
|
||||
body=body,
|
||||
notif_type=reg.status,
|
||||
registration_id=str(reg.id),
|
||||
)
|
||||
|
||||
return pl
|
||||
Reference in New Issue
Block a user