How jeanajsja/sgsdev works
Purpose and Entry Points
SGSDev is a Python web application for managing users, roles, teachers, rooms, and room reservations. The primary application entry point is backend/main.py; production-style WSGI hosting is exposed through wsgi.py. The browser UI is server-rendered from frontend/templates/login.html and frontend/templates/index.html.
HTTP/Application Boundary
backend/main.py likely composes the web server, template/static serving, and route registration. Controllers form the request-facing boundary for each business area:
• backend/controllers/usuario_controller.py
• backend/controllers/reserva_controller.py
• backend/controllers/salon_controller.py
Requests should enter controllers, which delegate domain work rather than directly owning persistence behavior.
Domain and Authorization Model
The central identity model is users with roles and role-specialized actors. Core entities are represented in:
• backend/models/usuario.py
• backend/models/rol.py
• backend/models/administrador.py
backend/models/docente.py and backend/models/operador.py indicate distinct teacher and operator responsibilities, while administrators are modeled separately. This structure makes role assignment and actor-specific permissions a material boundary around reservation operations.
Reservation Workflow
Reservations are a first-class domain flow connecting users/teachers to rooms. Its layers are:
• backend/controllers/reserva_controller.py
• backend/services/reserva_service.py
• backend/models/reserva.py
The service layer is the likely policy point for creating, querying, updating, or cancelling reservations and for enforcing room availability constraints. It coordinates the reservation model with the room domain rather than exposing database operations directly to controllers.
Room and Teacher Management
Room inventory and teacher records are independently managed, then consumed by reservation workflows:
• backend/services/salon_service.py
• backend/models/salon.py
• backend/services/docente_service.py
Their corresponding controllers, backend/controllers/salon_controller.py and backend/controllers/docente_controller.py, provide the application-facing operations. These domains should remain separate from reservation policy except through service/model interfaces.
Persistence Layer
Database integration is centralized under:
• backend/database/db_config.py
• backend/database/script.sql
script.sql defines the database bootstrap/schema contract; db_config.py is the runtime connection/configuration boundary. Models and services depend on this persistence layer, while controllers should not need database-specific knowledge.
Frontend and Runtime Assets
The frontend is a lightweight template-and-static-asset layer:
• frontend/templates/index.html
• frontend/static/js/dashboard.js
• frontend/static/css/styles.css
The dashboard JavaScript likely drives client-side interactions after login, while server endpoints provide user, room, and reservation data/actions. Python dependencies are defined in requirements.txt, and the selected interpreter version is pinned by .python-version.
Components 18
Runtime
- WSGI host · Production WSGI entry point.
wsgi.py - Application server · Composes server, templates, static assets, and routes.
backend/main.py
Frontend
- Login page
frontend/templates/login.html - Dashboard page
frontend/templates/index.html - Dashboard interactions
frontend/static/js/dashboard.js - Site styles
frontend/static/css/styles.css
HTTP Controllers
- User controller
backend/controllers/usuario_controller.py - Reservation controller
backend/controllers/reserva_controller.py - Room controller
backend/controllers/salon_controller.py - Teacher controller
backend/controllers/docente_controller.py
Domain Services & Models
- Reservation service · Coordinates reservation lifecycle and room availability.
backend/services/reserva_service.py - Room service
backend/services/salon_service.py - Teacher service
backend/services/docente_service.py - Users, roles & actors · Users, roles, administrators, teachers, and operators define authorization actors.
backend/models/usuario.py - Reservation model
backend/models/reserva.py - Room model
backend/models/salon.py
Persistence
- Database connection · Runtime database configuration boundary.
backend/database/db_config.py - Database schema · Database schema contract.
backend/database/script.sql
Connections 22
- WSGI host → Application server: hosts
- Application server → Login page: renders
- Application server → Dashboard page: renders
- Dashboard page → Dashboard interactions: loads
- Dashboard page → Site styles: loads
- Application server → User controller: routes requests
- Application server → Reservation controller: routes requests
- Application server → Room controller: routes requests
- Application server → Teacher controller: routes requests
- User controller → Users, roles & actors: manages
- Reservation controller → Reservation service: delegates
- Room controller → Room service: delegates
- Teacher controller → Teacher service: delegates
- Reservation service → Reservation model: manages
- Reservation service → Room model: checks availability
- Reservation service → Users, roles & actors: authorizes actors
- Room service → Room model: manages
- Teacher service → Users, roles & actors: manages teachers
- Users, roles & actors → Database connection: persists via
- Reservation model → Database connection: persists via
- Room model → Database connection: persists via
- Database connection → Database schema: uses schema