Migrar resolución de tenant del panel a la sesión
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import { eq } from 'drizzle-orm';
|
||||
import { db } from './index';
|
||||
import { pricingConfig, catalogItems, tenants } from './schema';
|
||||
import { TENANT_SLUG } from '@/lib/funnel';
|
||||
import { pricingConfig, catalogItems } from './schema';
|
||||
import type { PricingConfig, CatalogItem, ManoObraKey } from '@/budget/types';
|
||||
|
||||
async function getTenantId(): Promise<string> {
|
||||
const [tenant] = await db.select().from(tenants).where(eq(tenants.slug, TENANT_SLUG)).limit(1);
|
||||
if (!tenant) throw new Error(`Tenant "${TENANT_SLUG}" no existe. ¿Has corrido npm run db:seed?`);
|
||||
return tenant.id;
|
||||
}
|
||||
import { getCurrentTenantId as getTenantId } from '@/lib/auth/current-user';
|
||||
|
||||
const MANO_OBRA_DEFAULT: Record<ManoObraKey, number> = {
|
||||
demolicion: 0,
|
||||
|
||||
@@ -6,15 +6,8 @@ import {
|
||||
leadEstadoHistory,
|
||||
leadPipelineEventos,
|
||||
precisionHistory,
|
||||
tenants,
|
||||
} from './schema';
|
||||
import { TENANT_SLUG } from '@/lib/funnel';
|
||||
|
||||
async function getTenantId(): Promise<string> {
|
||||
const [tenant] = await db.select().from(tenants).where(eq(tenants.slug, TENANT_SLUG)).limit(1);
|
||||
if (!tenant) throw new Error(`Tenant "${TENANT_SLUG}" no existe. ¿Has corrido npm run db:seed?`);
|
||||
return tenant.id;
|
||||
}
|
||||
import { getCurrentTenantId as getTenantId } from '@/lib/auth/current-user';
|
||||
|
||||
export type LeadFiltro = (typeof leads.estado.enumValues)[number] | 'todos';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user