I've added a new capability to synchronize employee data from the local database to an external database on a daily basis.
Key changes:
- **`worker/sync-empleados.js`**: This new script:
- Connects to the local Prisma database to fetch `Cliente` records where `empleado` is true.
- Provides clear placeholders and guidance for connecting to an external database (you must configure details like host, credentials, DB type, and table name, and implement specific DB client logic).
- Outlines a conceptual "upsert" logic (update existing, insert new) for the external database.
- Includes extensive comments on configuration, operation, and testing considerations.
- **`worker/cron-worker.js`**:
- I modified this to import and schedule the `syncEmpleadosToExternalDB` function from the new script.
- The synchronization is scheduled to run daily at midnight.
- The existing example 5-second cron job has been commented as an example.
- **Documentation**:
- I added in-code comments to both modified/new files to explain functionality.
- `sync-empleados.js` includes sections on external DB configuration and detailed testing considerations (manual and automated).
You will need to provide the actual connection details and logic for your specific external database system.
This commit introduces two new Makefile targets:
- `sync-to-github`: Synchronizes the local repository to a GitHub remote.
It will add the 'github' remote if it doesn't exist and then push all
branches and tags. The GitHub repository URL is configurable via the
`GITHUB_REPO_URL` variable (e.g., `https://github.com/josedario87/your-repo-name.git`).
- `sync-to-gitea`: Synchronizes the local repository to a Gitea remote.
It will add the 'gitea' remote if it doesn't exist and then push all
branches and tags. The Gitea repository URL is configurable via the
`GITEA_REPO_URL` variable, which uses placeholders for server details
(e.g., `ssh://<GITEA_USER>@<GITEA_HOST>:<GITEA_PORT>/nucleo000/your-repo-name.git`).
Both new targets have been added to `.PHONY` to ensure correct behavior.
The repository name is dynamically determined from the local Git configuration.
This commit introduces the following features:
1. **Empleado UI Components:**
* `EmpleadoForm.vue`: A form for creating and editing employee data.
* `cardEmpleado.vue`: A component to display a summary of employee information in a card format.
* `tablaEmpleados.vue`: A component to display a list of employees in a table format.
* `EmpleadosIndex.vue`: A view that displays both the card and table components, allowing you to switch between views and create new employees.
2. **Chat Interface Integration:**
* Modified `agent/handlers.js` to parse specific chat commands:
* "Quiero crear un nuevo @empleado": Responds with the `EmpleadoForm`.
* "Ver @empleado<CEDULA>": Responds with the `cardEmpleado` for the specified employee.
* "Mostrame los primeros X @empleados": Responds with `tablaEmpleados` displaying the requested number of employees.
* I send formatted messages (e.g., `CHAT_UI_COMPONENT::EmpleadoForm`) that the chat UI can interpret to render the Vue components.
3. **Tests:**
* Added unit tests for the new Vue components (`EmpleadoForm.vue`, `cardEmpleado.vue`, `tablaEmpleados.vue`) using Vitest.
* Added integration tests for the chat command handling in `agent/handlers.js` using Jest.
* (Note: Test execution was inconclusive, but all necessary files and configurations are included).
These changes fulfill the issue requirements by creating the necessary UI for the empleado module and enabling the summoning of these UI elements through the chat interface.