How wsa-2002/pd6-be works
Project type and purpose
• This is a standalone async web‑backend service (no built‑in frontend) for “PDOGS 6,” exposing HTTP endpoints via FastAPI and handling background tasks via AMQP and other async mechanisms.
• Its primary use cases are BREAD operations (Browse, Read, Edit, Add, Delete) on academic resources (accounts, courses, problems, submissions, etc.), plus asynchronous judge pipelines, email notifications, and file/object storage.
File structure
• Top‐level components:
• main.py – Application entry point (FastAPI + Uvicorn)
• middleware/ – HTTP middleware layers (authentication, routing, logging, envelope formatting)
• processor/
– http_api/ – Controllers/handlers for each resource
– amqp/ – AMQP‐driven background consumers
• service/ – Business logic layer (judging, notifications, scoreboard, RBAC, CSV export)
• persistence/ – Data access layer
· database/ – ORM or DAO classes for each table/view
· amqp_publisher / amqp_consumer – enqueue/dequeue tasks
· s3/ – object storage interactions
· email/ – SMTP or email API wrappers
· http_client/ – calls to external HTTP services
• base/, common/, util/ – shared utilities, value objects (VOs), models, enums, metaclasses, context managers
• Config & infra: .env.example, Dockerfile, gitlab‑ci.yml
README for technical stack
• Python 3.10 + asyncio
• FastAPI + Uvicorn
• Uses AMQP broker (e.g., RabbitMQ) for background tasks
• Relational database (implied by DAOs in persistence/database)
• S3‑compatible storage for large artifacts
• SMTP or third‑party email provider
• Logging via YAML config
• Unit tests orchestrated by run_test.py