feat: metabase auto-registration + ui fixes + migration scripts

- Add metabase.service.ts for automatic DB registration on tenant creation
- Hook createTenant, addTenantToOwner and deleteTenant to sync with Metabase
- Add environment variables for Metabase integration
- Fix dashboard routing for global admin users
- Fix CFDI status casing (Vigente vs vigente)
- Fix sidebar empty nav crash
- Fix KPI null regimen_fiscal values
- Fix CFDI type mapping (EMITIDO/RECIBIDO)
- Update branding from Horux360 to Horux Despachos
- Add legacy migration scripts for central and tenant DBs
This commit is contained in:
Horux Dev
2026-04-28 00:34:41 +00:00
parent 56a05ba767
commit e8dc3aed67
18 changed files with 846 additions and 45 deletions

View File

@@ -7,7 +7,7 @@ import Image from 'next/image';
import { Button, Input, Label, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@horux/shared-ui';
import { login } from '@/lib/api/auth';
import { useAuthStore } from '@/stores/auth-store';
import { isGlobalAdminRfc } from '@horux/shared';
import { isGlobalAdminRfc, type PlatformRole } from '@horux/shared';
export default function LoginPage() {
const router = useRouter();
@@ -32,7 +32,7 @@ export default function LoginPage() {
const userRole = response.user?.role;
// Admin global aterriza directo en `/clientes` — su home natural es la
// gestión de tenants, no el dashboard operativo del despacho.
const platformRoles = (response.user as { platformRoles?: string[] }).platformRoles;
const platformRoles = (response.user as { platformRoles?: PlatformRole[] }).platformRoles;
const isGlobalAdmin = isGlobalAdminRfc(response.user?.tenantRfc, userRole, platformRoles);
if (isGlobalAdmin) {
router.push('/clientes');
@@ -58,7 +58,7 @@ export default function LoginPage() {
<div className="flex justify-center mb-4">
<Image
src="/logo.jpg"
alt="Horux360"
alt="Horux Despachos"
width={80}
height={80}
className="rounded-full"