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
232 lines
8.4 KiB
SQL
232 lines
8.4 KiB
SQL
-- phpMyAdmin SQL Dump
|
|
-- version 5.2.2
|
|
-- https://www.phpmyadmin.net/
|
|
--
|
|
-- Host: localhost:3306
|
|
-- Tempo de geração: 23-Fev-2026 às 10:41
|
|
-- Versão do servidor: 8.0.45
|
|
-- versão do PHP: 8.3.30
|
|
|
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
START TRANSACTION;
|
|
SET time_zone = "+00:00";
|
|
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
/*!40101 SET NAMES utf8mb4 */;
|
|
|
|
--
|
|
-- Base de dados: `agenciac_comia`
|
|
--
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Estrutura da tabela `attendances`
|
|
--
|
|
|
|
CREATE TABLE `attendances` (
|
|
`id` varchar(36) NOT NULL,
|
|
`tenant_id` varchar(36) NOT NULL,
|
|
`user_id` varchar(36) NOT NULL,
|
|
`summary` text,
|
|
`score` int DEFAULT NULL,
|
|
`first_response_time_min` int DEFAULT '0',
|
|
`handling_time_min` int DEFAULT '0',
|
|
`funnel_stage` enum('Sem atendimento','Identificação','Negociação','Ganhos','Perdidos') NOT NULL,
|
|
`origin` enum('WhatsApp','Instagram','Website','LinkedIn','Indicação') NOT NULL,
|
|
`product_requested` varchar(255) DEFAULT NULL,
|
|
`product_sold` varchar(255) DEFAULT NULL,
|
|
`converted` tinyint(1) DEFAULT '0',
|
|
`attention_points` json DEFAULT NULL,
|
|
`improvement_points` json DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Extraindo dados da tabela `attendances`
|
|
--
|
|
|
|
INSERT INTO `attendances` (`id`, `tenant_id`, `user_id`, `summary`, `score`, `first_response_time_min`, `handling_time_min`, `funnel_stage`, `origin`, `product_requested`, `product_sold`, `converted`, `attention_points`, `improvement_points`, `created_at`) VALUES
|
|
('att_demo_1', 'tenant_123', 'u2', 'Cliente interessado no plano Enterprise.', 95, 5, 30, 'Ganhos', 'LinkedIn', 'Suíte Enterprise', 'Suíte Enterprise', 1, '[]', '[\"Oferecer desconto anual na próxima\"]', '2026-02-20 12:42:10');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Estrutura da tabela `teams`
|
|
--
|
|
|
|
CREATE TABLE `teams` (
|
|
`id` varchar(36) NOT NULL,
|
|
`tenant_id` varchar(36) NOT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`description` text,
|
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Extraindo dados da tabela `teams`
|
|
--
|
|
|
|
INSERT INTO `teams` (`id`, `tenant_id`, `name`, `description`, `created_at`) VALUES
|
|
('sales_1', 'tenant_123', 'Vendas Alpha', NULL, '2026-02-20 12:42:10'),
|
|
('sales_2', 'tenant_123', 'Vendas Beta', NULL, '2026-02-20 12:42:10');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Estrutura da tabela `tenants`
|
|
--
|
|
|
|
CREATE TABLE `tenants` (
|
|
`id` varchar(36) NOT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`slug` varchar(255) NOT NULL,
|
|
`admin_email` varchar(255) DEFAULT NULL,
|
|
`logo_url` text,
|
|
`status` enum('active','inactive','trial') DEFAULT 'active',
|
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Extraindo dados da tabela `tenants`
|
|
--
|
|
|
|
INSERT INTO `tenants` (`id`, `name`, `slug`, `admin_email`, `logo_url`, `status`, `created_at`, `updated_at`) VALUES
|
|
('system', 'System Admin', 'system', 'root@system.com', NULL, 'active', '2026-02-20 12:42:10', '2026-02-20 12:42:10'),
|
|
('tenant_101', 'Soylent Green', 'soylent', 'admin@soylent.com', NULL, 'active', '2023-02-10 14:20:00', '2026-02-20 12:42:10'),
|
|
('tenant_123', 'Fasto Corp', 'fasto', 'admin@fasto.com', NULL, 'active', '2023-01-15 13:00:00', '2026-02-20 12:42:10'),
|
|
('tenant_456', 'Acme Inc', 'acme-inc', 'contact@acme.com', NULL, 'trial', '2023-06-20 17:30:00', '2026-02-20 12:42:10'),
|
|
('tenant_789', 'Globex Utils', 'globex', 'sysadmin@globex.com', NULL, 'inactive', '2022-11-05 12:15:00', '2026-02-20 12:42:10');
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Estrutura da tabela `pending_registrations`
|
|
--
|
|
|
|
CREATE TABLE `pending_registrations` (
|
|
`email` varchar(255) NOT NULL,
|
|
`password_hash` varchar(255) NOT NULL,
|
|
`full_name` varchar(255) NOT NULL,
|
|
`organization_name` varchar(255) NOT NULL,
|
|
`verification_code` varchar(10) NOT NULL,
|
|
`expires_at` timestamp NOT NULL,
|
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`email`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Estrutura da tabela `password_resets`
|
|
--
|
|
|
|
CREATE TABLE `password_resets` (
|
|
`email` varchar(255) NOT NULL,
|
|
`token` varchar(255) NOT NULL,
|
|
`expires_at` timestamp NOT NULL,
|
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`token`),
|
|
KEY `email` (`email`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Estrutura da tabela `users`
|
|
--
|
|
|
|
CREATE TABLE `users` (
|
|
`id` varchar(36) NOT NULL,
|
|
`tenant_id` varchar(36) DEFAULT NULL,
|
|
`team_id` varchar(36) DEFAULT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
`email` varchar(255) NOT NULL,
|
|
`password_hash` varchar(255) NOT NULL DEFAULT 'hash_placeholder',
|
|
`avatar_url` text,
|
|
`role` enum('super_admin','admin','manager','agent') NOT NULL DEFAULT 'agent',
|
|
`bio` text,
|
|
`status` enum('active','inactive') DEFAULT 'active',
|
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Extraindo dados da tabela `users`
|
|
--
|
|
|
|
INSERT INTO `users` (`id`, `tenant_id`, `team_id`, `name`, `email`, `password_hash`, `avatar_url`, `role`, `bio`, `status`, `created_at`) VALUES
|
|
('sa1', 'system', NULL, 'Super Administrator', 'root@system.com', 'hash_placeholder', 'https://ui-avatars.com/api/?name=Super+Admin&background=0f172a&color=fff', 'super_admin', 'Administrador Global', 'active', '2026-02-20 12:42:10'),
|
|
('u1', 'tenant_123', 'sales_1', 'Lidya Chan', 'lidya@fasto.com', 'hash_placeholder', 'https://picsum.photos/id/1011/200/200', 'manager', 'Gerente de Vendas Experiente', 'active', '2026-02-20 12:42:10'),
|
|
('u2', 'tenant_123', 'sales_1', 'Alex Noer', 'alex@fasto.com', 'hash_placeholder', 'https://picsum.photos/id/1012/200/200', 'agent', 'Top performer Q3', 'active', '2026-02-20 12:42:10'),
|
|
('u3', 'tenant_123', 'sales_1', 'Angela Moss', 'angela@fasto.com', 'hash_placeholder', 'https://picsum.photos/id/1013/200/200', 'agent', '', 'inactive', '2026-02-20 12:42:10'),
|
|
('u4', 'tenant_123', 'sales_2', 'Brian Samuel', 'brian@fasto.com', 'hash_placeholder', 'https://picsum.photos/id/1014/200/200', 'agent', '', 'active', '2026-02-20 12:42:10'),
|
|
('u5', 'tenant_123', 'sales_2', 'Benny Chagur', 'benny@fasto.com', 'hash_placeholder', 'https://picsum.photos/id/1025/200/200', 'agent', '', 'active', '2026-02-20 12:42:10');
|
|
|
|
--
|
|
-- Índices para tabelas despejadas
|
|
--
|
|
|
|
--
|
|
-- Índices para tabela `attendances`
|
|
--
|
|
ALTER TABLE `attendances`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `tenant_id` (`tenant_id`),
|
|
ADD KEY `user_id` (`user_id`);
|
|
|
|
--
|
|
-- Índices para tabela `teams`
|
|
--
|
|
ALTER TABLE `teams`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD KEY `tenant_id` (`tenant_id`);
|
|
|
|
--
|
|
-- Índices para tabela `tenants`
|
|
--
|
|
ALTER TABLE `tenants`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `slug` (`slug`);
|
|
|
|
--
|
|
-- Índices para tabela `users`
|
|
--
|
|
ALTER TABLE `users`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `email` (`email`),
|
|
ADD KEY `tenant_id` (`tenant_id`),
|
|
ADD KEY `team_id` (`team_id`);
|
|
|
|
--
|
|
-- Restrições para despejos de tabelas
|
|
--
|
|
|
|
--
|
|
-- Limitadores para a tabela `attendances`
|
|
--
|
|
ALTER TABLE `attendances`
|
|
ADD CONSTRAINT `attendances_ibfk_1` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
|
|
ADD CONSTRAINT `attendances_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
|
|
|
|
--
|
|
-- Limitadores para a tabela `teams`
|
|
--
|
|
ALTER TABLE `teams`
|
|
ADD CONSTRAINT `teams_ibfk_1` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;
|
|
|
|
--
|
|
-- Limitadores para a tabela `users`
|
|
--
|
|
ALTER TABLE `users`
|
|
ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
|
|
ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL;
|
|
COMMIT;
|
|
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|