Se han extraído los flujos de conversación de los handlers de y a archivos JSON dedicados dentro del nuevo directorio .
Este cambio tiene como objetivo:
1. **Centralizar y desacoplar la lógica de conversación**: Al separar las preguntas y los estados del código de Python, se facilita la visualización, edición y mantenimiento de los flujos sin necesidad de modificar la lógica de la aplicación.
2. **Facilitar la mejora de los flujos**: Con los flujos definidos en un formato de datos estructurado, es más sencillo analizarlos, identificar posibles errores o bucles, y realizar mejoras de manera más segura.
3. **Preparar para futuras funcionalidades**: Esta estructura sienta las bases para poder cargar y gestionar los flujos de conversación de manera dinámica, permitiendo, por ejemplo, la creación de un editor visual de flujos o la carga de flujos desde una base de datos.
Se han creado los siguientes archivos:
- : Contiene el flujo de onboarding de nuevas empleadas.
- : Define el flujo para solicitar vacaciones.
- : Especifica el flujo para solicitar permisos.
Este commit introduce las siguientes mejoras en el proceso de onboarding:
1. **Registro en Dos Fases**: El flujo de onboarding ahora registra a las nuevas usuarias en dos bases de datos distintas para mejorar la seguridad y la integridad de los datos:
* ****: Se crea un registro básico para la autenticación y el control de acceso del bot.
* ****: Se guarda un perfil completo y detallado de la empleada en la tabla .
2. **Modelos SQLAlchemy**: Se han actualizado los modelos de SQLAlchemy ( y ) para reflejar la estructura de las tablas de la base de datos.
3. **Lógica de Base de Datos Centralizada**: El módulo ahora contiene la lógica para gestionar el registro dual, asegurando que ambas operaciones se realicen de forma atómica.
4. **Flujo de Onboarding Actualizado**: El script de ha sido modificado para recopilar la información necesaria y pasarla al nuevo sistema de registro.
5. **Configuración de Docker**: Se ha ajustado el y los scripts de inicialización de la base de datos ( y ) para soportar el nuevo esquema de base de datos dual.
Estos cambios aseguran un proceso de registro más robusto, seguro y escalable, sentando las bases para futuras funcionalidades de RRHH.
Se ha actualizado el archivo para describir con mayor precisión el proceso de registro de usuarios en dos fases, que implica la creación de un registro tanto en la base de datos como en .
Además, se ha consolidado la documentación de la base de datos eliminando el archivo redundante y fusionando su contenido en . Esto asegura que sirva como la única fuente de verdad para la especificación técnica de la base de datos.
This commit introduces a three-database architecture to the application,
as specified in the `db_logic.md` file.
The changes include:
- A SQL initialization script (`db/init/init.sql`) to create the
`USERS_ALMA`, `vanity_hr`, and `vanity_attendance` databases and their
respective tables.
- SQLAlchemy models for all tables, organized into separate files
within the `models` directory.
- Refactoring of the database connection logic in `modules/database.py`
to support connections to all three databases.
- Creation of a `modules/logger.py` to handle request logging to the
`USERS_ALMA` database.
- Updates to `docker-compose.yml` to mount the initialization script and
build the bot image locally.
- Updates to `.env.example` to include the new database environment
variables.
- Restoration of the data dictionary to `db_tasks.md`.
This commit significantly enhances the database schema defined in `db_tasks.md` to create a robust system for tracking employee vacations and permission requests.
Key changes include:
- **`users` table:** Added `vacation_days_assigned` and `vacation_days_taken` fields to maintain a running balance of employee vacation days.
- **`vacations` table:** Overhauled the table with detailed fields such as `business_days`, `with_pay`, `approver_comments`, `approval_date`, and `affects_payroll` to create a comprehensive vacation tracking system.
- **`permission_requests` table:** Similarly enhanced with fields like `category`, `with_pay`, and `affects_payroll` for detailed tracking of hourly leaves.
- **Interaction Logic:** Updated the documentation to explain how vacation balances are automatically calculated and updated upon the approval of a request.
Updates the `db_tasks.md` file to reflect the new database schema and role-based permission system.
This change introduces:
- A new `vacations` table to track vacation requests.
- A new `permission_requests` table for hourly leave requests.
- A redesigned `users` table with more detailed employee information and a `role` column.
- A renamed and expanded `onboarding_data` table.
- An updated database interaction section explaining the `user`, `manager`, and `admin` roles.
Creates a new `db_tasks.md` file that defines the database schema for the bot.
This documentation includes table definitions for:
- `users`: To store user information.
- `permissions`: To manage user permissions for specific actions.
- `welcome_flow_data`: To store data collected during the `/welcome` onboarding flow.
The file also explains how the bot will interact with these tables to manage users, permissions, and the onboarding process.
- Add a check to see if a user's Telegram chat ID already exists in a Google Sheet.
- If the user is already registered, the 'welcome' option is hidden from the main menu.
- Added gspread and google-auth-oauthlib to requirements.txt.
- Modified database.py to support Google Service Account credentials from environment variables.
- Updated .env.example with the new environment variables.
This commit refactors the application to run in a containerized environment using Docker and Docker Compose. It also introduces a MySQL database for logging user requests and updates the print functionality to send emails via SMTP.
Key changes:
- Added `Dockerfile` and `docker-compose.yml` for containerization.
- Integrated a MySQL database for logging user requests.
- Updated the print module to send files as email attachments via SMTP.
- Added and updated configuration files (`.env`, `.env.example`) to manage secrets and environment variables.
- Removed hardcoded credentials from version control.
- Updated `Readme.md` with new setup and execution instructions.
This commit introduces Docker and Docker Compose to containerize the application and orchestrate it with a MySQL database.
Key changes include:
- Added a `Dockerfile` to create a container for the Python bot.
- Created a `docker-compose.yml` file to manage the bot and MySQL services.
- Added a `modules/database.py` module to handle database connections and logging with SQLAlchemy.
- Integrated request logging into all command handlers.
- Updated `requirements.txt` with necessary dependencies for MySQL.
- Updated `.env` and `.gitignore` to manage database credentials securely.
- Updated `Readme.md` with instructions on how to run the application using Docker Compose.