Commit Graph

41 Commits

Author SHA1 Message Date
Cauê Faleiros
9ffcfcdcc8 chore: add automated database backup service and tighten backend security
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m56s
- Added `databack/mysql-backup` service to the production docker-compose Swarm stack, scheduling a daily 02:55 AM cron backup of the database with a 3-day local retention policy.

- Fixed a critical race condition in the backend JWT authentication middleware where an invalid token returning 401 could crash the response flow if the route executed before the defensive checks caught it.

- Added strict undefined defensive checks to the `getUserById` endpoint and RBAC middleware to gracefully reject requests that somehow bypass the token parser.

- Updated `GEMINI.md` technical documentation to fully match the real codebase logic.

- Fixed UX rule to prevent `manager` role from seeing Funnels or Origins tabs in the sidebar.

- Blocked `agent` role from modifying their own 'fullName' string in the Profile UI.
2026-03-25 12:40:53 -03:00
Cauê Faleiros
8f7e5ee487 feat: synchronize dashboard origins with management page and add integration endpoints
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m53s
- Updated Dashboard origin chart to strictly reflect only configured origins, grouping unmapped data into an 'Outros' category.

- Added GET /api/integration/funnels and GET /api/integration/origins endpoints to allow external AIs to dynamically map stages and lead sources.
2026-03-18 16:43:42 -03:00
Cauê Faleiros
f11db95a2f fix: allow origin colors to be edited and display correctly in dashboard
- Fixed database initialization where default origins were seeded without color_classes.

- Added a visual color picker to the Origens admin page to allow users to assign colors to origin tags.

- Updated Dashboard Pie Chart to read the color classes correctly and display them.
2026-03-18 13:43:43 -03:00
Cauê Faleiros
1d3315a1d0 feat: implement relational lead origins with team assignments
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m51s
- Dropped simple origins table in favor of origin_groups and origin_items to match the Funnels architecture.

- Added origin_group_id to teams table to assign specific origins to specific teams.

- Updated /admin/origins page to support creating origin groups, adding origin items to them, and assigning teams to groups.

- Updated Dashboard and UserDetail pages to dynamically load the exact origin items belonging to the active team/user.
2026-03-18 11:18:30 -03:00
Cauê Faleiros
22a1228a60 fix: resolve login persistence bug and aggressive logout on network blips
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m58s
- Updated Login.tsx to automatically redirect users to the dashboard if a valid token is already present in localStorage.

- Refactored getUserById to properly throw server/network errors instead of silently returning undefined.

- Updated AuthGuard in App.tsx to gracefully handle network errors without destroying the user's valid localStorage tokens.
2026-03-17 15:40:13 -03:00
Cauê Faleiros
96cfb3d125 refactor: remove mock data and finalize n8n data schema
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m50s
- Removed all hardcoded MOCK_ATTENDANCES, USERS, and TENANTS generators from constants.ts since the system is now production-ready.

- Renamed 'summary' to 'title' in the database and across all frontend components for clarity.

- Added 'full_summary' to the attendances schema to explicitly store the large, detailed AI analysis texts from n8n.

- Updated the 'Resumo da Interação' UI to render the 'full_summary' without adding any artificial filler text.

- Localized all dates and times across the dashboard to Brazilian formatting (pt-BR).
2026-03-17 12:45:15 -03:00
Cauê Faleiros
fbf3edb7a1 feat: migrate api key management to dedicated super admin page
- Extracted API Key generation and management from UserProfile to a new /super-admin/api-keys route.

- Added cross-tenant selection in the new ApiKeys page so Super Admins can manage integrations for any organization.
2026-03-16 14:44:16 -03:00
Cauê Faleiros
ef6d1582b3 feat: implement n8n api integration endpoints and api key management
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m6s
- Added api_keys table to database schema.

- Added API Key authentication middleware to express router.

- Created GET /api/integration/users endpoint for n8n to map agents.

- Created POST /api/integration/attendances endpoint to accept webhooks from n8n.

- Added UI in UserProfile (for Admins/Owners) to generate, view, and revoke API keys.
2026-03-16 14:29:21 -03:00
Cauê Faleiros
750ad525c8 fix: resolve notification ui bugs, audio playback, and team deletion
- Fixed audio playback by rendering a hidden audio tag to comply with browser policies.

- Renamed DELETE /notifications to /notifications/clear-all to prevent route conflicts.

- Notifications badge now clears automatically when the tray is opened.

- Translated notification types to Portuguese (SUCESSO, AVISO, ERRO, INFO).

- Implemented team deletion functionality for Admins.
2026-03-13 15:52:27 -03:00
Cauê Faleiros
4b0d84f2a0 style: rename 'Meus Funis' to 'Gerenciar Funis'
- Updated sidebar navigation and page title to accurately reflect the management nature of the funnels page.
2026-03-13 15:00:14 -03:00
Cauê Faleiros
ea8441d4be feat: implement advanced funnel management with multiple funnels and team assignments
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m32s
- Updated DB schema to support multiple funnels (funnels table) and their stages (funnel_stages table).

- Added funnel_id to teams table to link teams to specific funnels.

- Redesigned /admin/funnels page ('Meus Funis') to allow creating multiple funnels, managing their stages, and assigning them to teams.

- Updated Dashboard, UserDetail, and AttendanceDetail to dynamically load the correct funnel based on the selected team or user's assigned team.
2026-03-13 14:19:52 -03:00
Cauê Faleiros
7ab54053db feat: implement customizable funnel stages per tenant
- Modified attendances.funnel_stage in DB from ENUM to VARCHAR.

- Created tenant_funnels table and backend API routes to manage custom stages.

- Added /admin/funnels page for Admins/Managers to create, edit, order, and color-code their funnel stages.

- Updated Dashboard, UserDetail, and AttendanceDetail to fetch and render dynamic funnel stages instead of hardcoded enums.

- Added defensive checks and logging to GET /users/:idOrSlug to fix sporadic 500 errors during impersonation handoffs.
2026-03-13 10:25:23 -03:00
Cauê Faleiros
bf157687d4 fix: resolve race conditions during impersonation handoff by reloading directly from dataService 2026-03-11 15:33:38 -03:00
Cauê Faleiros
684b98bd0e fix: resolve HashRouter reload issues during impersonation handoffs
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m2s
- Updated Layout and SuperAdmin to explicitly set window.location.hash before triggering window.location.reload() to guarantee correct routing after state resets.
2026-03-11 14:54:35 -03:00
Cauê Faleiros
671633b813 style: remove hover requirement for action buttons across all tables
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m6s
- Action buttons (Edit, Delete, Impersonate) are now permanently visible for better UX and discoverability.
2026-03-11 14:37:23 -03:00
Cauê Faleiros
bff54def9f fix: include missing files for tenant impersonation feature
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m7s
- Added backend impersonate endpoint.

- Added frontend impersonate button and functions.

- Fixed build failure by including missing exported functions in dataService.ts.
2026-03-11 14:16:41 -03:00
Cauê Faleiros
ee3b9f4ce6 feat: add loading animation to tenant creation button
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m10s
- Implemented isSaving state in SuperAdmin to provide visual feedback during organization creation and updates.
2026-03-10 15:10:44 -03:00
Cauê Faleiros
754c1e2a21 feat: add user preference for audio notifications and play sound on new alerts
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m53s
- Added sound_enabled column to users table with a default of true.

- Implemented a pleasant pop sound (notification.mp3) that plays when a new unread notification arrives.

- Added a toggle in the User Profile page allowing users to enable/disable the sound.
2026-03-10 10:38:03 -03:00
Cauê Faleiros
000bc38712 fix: remove duplicated layout titles and use singular team terminology for managers
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m48s
2026-03-09 11:07:18 -03:00
Cauê Faleiros
cbbe519b5a feat: allow admins to edit member emails
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m14s
2026-03-06 14:56:16 -03:00
Cauê Faleiros
13b4c0316b feat: restrict managers to their own team
- Backend now only returns users, teams, and attendances from a manager's own team.

- Hidden 'Todas as Equipes' filter from manager dashboard.

- Removed manager ability to create or edit teams.
2026-03-06 14:54:42 -03:00
Cauê Faleiros
ae81df759f fix: allow managers to see the add member button
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m23s
2026-03-06 14:20:58 -03:00
Cauê Faleiros
38eb55793f feat: complete fine-grained RBAC rules across all roles
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m52s
- Restricted Agent view to own dashboard and hid management tabs.

- Allowed Managers to create teams and members but restricted them from editing roles or emails.

- Allowed Admins to update their own email via profile.

- Protected Admin roles from being modified by anyone other than Super Admins.
2026-03-06 13:27:43 -03:00
Cauê Faleiros
3efb949605 fix: register setup-account route and correctly name component
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m5s
2026-03-06 09:24:08 -03:00
Cauê Faleiros
c4bd4d58a1 feat: complete UI/UX refinement, email flow updates, and deep black theme
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m18s
- Updated all email templates to a clean light theme and changed button text to 'Finalizar Cadastro'.

- Enforced a strict 15-minute expiration on all auth/reset tokens.

- Created SetupAccount flow distinct from ResetPassword to capture user name during admin init.

- Refined dark mode to a premium True Black (Onyx) palette using Zinc.

- Fixed Dashboard KPI visibility and true period-over-period trend logic.

- Enhanced TeamManagement with global tenant filtering for Super Admins.

- Implemented secure User URL routing via slugs instead of raw UUIDs.

- Enforced strict Agent-level RBAC for viewing attendances.
2026-03-05 15:33:03 -03:00
Cauê Faleiros
d5b57835a7 fix: resolve super_admin privileges and tenant management issues
- Fixed real backend deletion for tenants

- Allowed super_admins to manage other super_admins in Global Users

- Filtered teams based on selected tenant in user creation

- Protected system tenant from deletion
2026-03-04 11:36:47 -03:00
Cauê Faleiros
75631909df fix: correct parameter order in resetPassword call 2026-03-04 10:51:57 -03:00
Cauê Faleiros
997546915f fix: propagate and display backend errors correctly when creating or updating users
All checks were successful
Build and Deploy / build-and-push (push) Successful in 58s
2026-03-03 18:12:57 -03:00
Cauê Faleiros
e050cbfab1 fix: prevent long team names from breaking UI layout
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m0s
- Added maxLength to team creation input

- Truncated long team badges in user profile
2026-03-03 17:51:15 -03:00
Cauê Faleiros
aa122d646c fix: display correct team name in user profile 2026-03-03 17:39:25 -03:00
Cauê Faleiros
20bdf510fd feat: implement secure multi-tenancy, RBAC, and premium dark mode
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m54s
- Enforced tenant isolation and Role-Based Access Control across all API routes

- Implemented secure profile avatar upload using multer and UUIDs

- Redesigned UI with a premium "Onyx & Gold" Charcoal dark mode

- Added Funnel Stage and Origin filters to Dashboard and User Detail pages

- Replaced "Referral" with "Indicação" across the platform and database

- Optimized Dockerfile and local environment setup for reliable deployments

- Fixed frontend syntax errors and improved KPI/Chart visualizations
2026-03-03 17:16:55 -03:00
Cauê Faleiros
b7e73fce3d feat: replace mock system with real backend, RBAC, and Teams management
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m3s
- Implemented real JWT authentication and persistent user sessions
- Replaced all hardcoded mock data with dynamic MySQL-backed API calls
- Created new 'Times' (Teams) dashboard with performance metrics
- Renamed 'Equipe' to 'Membros' and centralized team management
- Added Role-Based Access Control (RBAC) for Admin/Manager/Agent roles
- Implemented secure invite-only member creation and password setup flow
- Enhanced Login with password visibility and real-time validation
- Added safe delete confirmation modal and custom Toast notifications
2026-03-02 10:26:20 -03:00
Cauê Faleiros
76b919d857 feat: implement real profile save functionality
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m49s
2026-02-26 10:42:01 -03:00
Cauê Faleiros
6fb86b4806 feat: implement real user profile and authentication state
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m3s
2026-02-26 10:36:59 -03:00
Cauê Faleiros
dda606ef9b feat: implement real user profile viewing and auth state 2026-02-26 10:18:27 -03:00
Cauê Faleiros
a175315437 fix: resolve ReferenceError by using tenants state instead of constant
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m10s
2026-02-24 16:19:32 -03:00
Cauê Faleiros
3198784087 fix: update SuperAdmin to use real API
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m22s
2026-02-24 15:53:15 -03:00
Cauê Faleiros
96a96498b9 fix: restore SuperAdmin page to valid mock state
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m41s
2026-02-24 14:19:13 -03:00
Cauê Faleiros
37f6ae042d Revert "feat: implement real tenant creation and listing"
All checks were successful
Build and Deploy / build-and-push (push) Successful in 3m17s
This reverts commit 2742bafb00.
2026-02-24 14:10:53 -03:00
Cauê Faleiros
2742bafb00 feat: implement real tenant creation and listing
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m34s
2026-02-24 11:44:28 -03:00
farelos
3250ad7537 feat: Implement backend API and basic frontend structure
Adds initial backend API endpoints for fetching users and attendances, including basic filtering. Sets up the frontend routing with a layout component and includes placeholder pages for dashboard, users, and login. Refactors the README for local development setup.
2026-02-23 10:36:00 -03:00