How ch4zzy/checks-api works
Project type and purpose
• This is a Django-based backend microservice (“Checks API”) whose sole responsibility is to accept new order data via REST endpoints, create “check” records for each printer at a given location, and asynchronously generate PDF receipts.
• Key indicators:
• apps/reciept: Django app with models, serializers, views, templates (PDF).
• config/celery.py + tasks.py: Asynchronous PDF generation.
• Dockerfile / docker-compose.yml: Containerized deployment.
File structure
• Top-level:
• apps/reciept: Core Django app: models.py, serializers.py, views.py, urls.py, tasks.py, templates/pdf_template.html.
• config: Django settings, URL routing, WSGI, Celery config, custom storage backends, media dirs.
• manage.py, Dockerfile, docker-compose.yml: orchestration and containerization.
• .github/workflows: CI for linting, tests, migrations.
• Patterns:
• MVC (Django’s MTV): models ↔ views ↔ templates.
• Asynchronous worker pattern (Celery + broker).
• PDF generation via HTML template and storage backend.
README for additional insights
• Defines REST endpoints for listing, retrieving, updating “checks,” and creating them.
• Describes error-handling rules when no printers exist or if checks already created.
• Notes pytest-django integration.
Detailed yet focused
• Django component: APIView/Serializer → Model → Task
• Template rendering → PDF file path registration
• Error-path checks (e.g., “No printers → API returns 400”)