How saphire23/pf_bases works
Project Type and Purpose
• This is a full-stack web application for managing “citas” (appointments) and “usuarios” (users).
• Frontend: Angular (RRS) handles UI, routing, authentication and communicates via REST.
• Backend: FastAPI serves JSON APIs, implements business logic in “services” and persistence in “models” (Pydantic + database).
• Database: Relational (via pyodbc/SQLAlchemy or native DB-API) storing Usuario and Cita tables.
File-Structure Analysis
• Top-level “Frontend” and “Backend” directories clearly separate client and server.
• Backend/app/main.py spins up the FastAPI app; routers are in Backend/app/routers; services in Backend/app/services; data models in Backend/app/models; DB setup in Backend/app/database.py.
• Frontend/RRS/src/app contains feature modules: auth, citas, dashboard (admin/empresa), home, login, register, shared header/footer.
• Requirements.txt and package.json enumerate dependencies (FastAPI, Pydantic, Angular, etc.).
Key Architectural Patterns
• Layered architecture on the backend:
• Routers (API layer) → Services (business logic) → Models/Database (persistence).
• Frontend: Component-based modular design with guards (AuthGuard) and environment-specific config/routes files.
• Stateless REST API, token- or session-based auth (auth.service.ts + auth.guard.ts).
Main Components and Interactions
• Browser/UI (Angular app)
↕ HTTPS/JSON
• FastAPI Backend
• API Layer (routers/citas.py, routers/usuarios.py)
• Service Layer (services/*.py)
• Data Access (database.py + models/citas.py, models/usuarios.py)
• Relational Database (e.g., SQL Server/MySQL/Postgres)
• Tables:
[Usuarios]
• id (PK)
• nombre
• email (unique)
• hashed_password
• created_at
[Citas]
• id (PK)
• usuario_id (FK → Usuarios.id)
• fecha_hora
• descripcion
• estado
• Relationship: Usuarios 1 ──< Citas (one user can have many appointments)
+----------------+ +-----------------+
| Usuarios | | Citas |
|----------------| |-----------------|
| PK id |◄───(1:M)──| FK usuario_id |
| nombre | | fecha_hora |
| email | | descripcion |
| hashed_pw | | estado |
| created_at | | PK id |
+----------------+ +-----------------+