How joacocavest/tp_apis works
Project type and purpose
• This is a Django-based REST API project for an auction system (“subastas_clase”).
• It follows Django’s Model-View-Template (MVT) architecture extended with Django REST Framework (DRF).
• Two core domains (apps): “anuncio” (auction listings) and “usuario” (user management).
File structure
• Top-level Django project folder: subastas_clase/ (contains settings.py, urls.py, asgi.py, wsgi.py, router.py).
• Apps subdirectory: apps/anuncio/ and apps/usuario/. Each app has models.py, views.py or api.py, serializers.py (in anuncio), filters.py (in TP4), urls.py or router.py, migrations, tests.py.
• manage.py at project root and a local SQLite database (db.sqlite3).
• Evolution: TP1 was minimal; by TP4 filters, routers, serializers and API endpoints are in place.
README insights
• The Google Doc describes mobile-first requirements, listing endpoints for auctions and users.
• It outlines features: create/list/update auctions, user registration/authentication.
Components
a. External Clients
• Mobile app / Web front-end
• Postman or any REST client
b. API Gateway / HTTP Interface
• Django’s URL dispatcher (urls.py and router.py)
• asgi.py / wsgi.py
c. Django Application Layers
• Views / API views (apps/anuncio/views.py or api.py, apps/usuario/views.py or api.py)
• Serializers (apps/anuncio/serializers.py)
• Filters (apps/anuncio/filters.py)
• Business Logic (in views or service modules if any)
• Models (apps/*/models.py)
d. Persistence
• Django ORM
• SQLite database (db.sqlite3)
e. Admin Interface (optional)
• Django Admin (apps/*/admin.py)
f. External Services (if any in future)
• Email service for user notifications
• Third-party authentication
Relationships and interactions
• Client issues HTTP requests to the API endpoint (e.g., POST /api/anuncios/).
• Django URL router directs requests to the appropriate viewset or view function.
• View invokes serializer to validate and transform data.
• Serializer interacts with models (via ORM) to perform create, read, update, delete operations on the database.
• Database returns results back up the chain; view serializes response JSON; HTTP response goes back to client.
Architectural patterns and design principles
• MVT (Django’s variant of MVC): Models, Views (controllers), Templates (not used here), extended by DRF Views/Serializers.
• RESTful API principles: resource-based endpoints, HTTP verbs.
• Modular app structure: each domain in its own app folder.
• Use of routers for automatic URL generation (router.py in project and apps).
Elements
• Labels: “Mobile Client”, “Django API Gateway”, “Anuncio App”, “Usuario App”, “SQLite DB”.
• Client → API Gateway (HTTP request)
• API Gateway → Views/Router → Serializers → ORM → Database
• Database → ORM → Serializers → API Gateway → Client
• Rectangles for services (API Gateway, Apps)
Detailed capture of essential elements
• Break out the URL router as a distinct node.
• Both asgi.py (async entry) and wsgi.py (sync entry) if needed.
• Core settings.py module as the place configuring installed apps, middleware, REST framework settings.
• Optionally, include the admin interface and migrations folder to show schema evolution process.