242 lines
10 KiB
TypeScript
242 lines
10 KiB
TypeScript
/**
|
|
* Database Constants - SSOT (Single Source of Truth)
|
|
*
|
|
* IMPORTANTE: Este archivo es la UNICA fuente de verdad para nombres de
|
|
* schemas, tablas y columnas. Cualquier hardcoding sera detectado por
|
|
* el script validate-constants-usage.ts
|
|
*
|
|
* @module @shared/constants/database
|
|
*/
|
|
/**
|
|
* Database Schemas
|
|
* Todos los schemas de la base de datos PostgreSQL
|
|
*/
|
|
export declare const DB_SCHEMAS: {
|
|
readonly AUTH: "auth";
|
|
readonly CORE: "core";
|
|
readonly CONSTRUCTION: "construction";
|
|
readonly HR: "hr";
|
|
readonly HSE: "hse";
|
|
readonly ESTIMATES: "estimates";
|
|
readonly INFONAVIT: "infonavit";
|
|
readonly INVENTORY: "inventory";
|
|
readonly PURCHASE: "purchase";
|
|
readonly FINANCIAL: "financial";
|
|
readonly ANALYTICS: "analytics";
|
|
readonly AUDIT: "audit";
|
|
readonly SYSTEM: "system";
|
|
};
|
|
export type DBSchema = typeof DB_SCHEMAS[keyof typeof DB_SCHEMAS];
|
|
/**
|
|
* Database Tables organized by Schema
|
|
*/
|
|
export declare const DB_TABLES: {
|
|
readonly auth: {
|
|
readonly USERS: "users";
|
|
readonly ROLES: "roles";
|
|
readonly PERMISSIONS: "permissions";
|
|
readonly ROLE_PERMISSIONS: "role_permissions";
|
|
readonly USER_ROLES: "user_roles";
|
|
readonly SESSIONS: "sessions";
|
|
readonly REFRESH_TOKENS: "refresh_tokens";
|
|
readonly TENANTS: "tenants";
|
|
readonly TENANT_USERS: "tenant_users";
|
|
readonly PASSWORD_RESETS: "password_resets";
|
|
};
|
|
readonly core: {
|
|
readonly COMPANIES: "companies";
|
|
readonly PARTNERS: "partners";
|
|
readonly CURRENCIES: "currencies";
|
|
readonly COUNTRIES: "countries";
|
|
readonly STATES: "states";
|
|
readonly CITIES: "cities";
|
|
readonly UOM: "units_of_measure";
|
|
readonly UOM_CATEGORIES: "uom_categories";
|
|
readonly SEQUENCES: "sequences";
|
|
readonly ATTACHMENTS: "attachments";
|
|
};
|
|
readonly construction: {
|
|
readonly PROYECTOS: "proyectos";
|
|
readonly FRACCIONAMIENTOS: "fraccionamientos";
|
|
readonly ETAPAS: "etapas";
|
|
readonly MANZANAS: "manzanas";
|
|
readonly LOTES: "lotes";
|
|
readonly TORRES: "torres";
|
|
readonly NIVELES: "niveles";
|
|
readonly DEPARTAMENTOS: "departamentos";
|
|
readonly PROTOTIPOS: "prototipos";
|
|
readonly CONCEPTOS: "conceptos";
|
|
readonly PRESUPUESTOS: "presupuestos";
|
|
readonly PRESUPUESTO_PARTIDAS: "presupuesto_partidas";
|
|
readonly PROGRAMA_OBRA: "programa_obra";
|
|
readonly PROGRAMA_ACTIVIDADES: "programa_actividades";
|
|
readonly AVANCES_OBRA: "avances_obra";
|
|
readonly FOTOS_AVANCE: "fotos_avance";
|
|
readonly BITACORA_OBRA: "bitacora_obra";
|
|
readonly CHECKLISTS: "checklists";
|
|
readonly CHECKLIST_ITEMS: "checklist_items";
|
|
readonly INSPECCIONES: "inspecciones";
|
|
readonly INSPECCION_RESULTADOS: "inspeccion_resultados";
|
|
readonly TICKETS_POSTVENTA: "tickets_postventa";
|
|
readonly SUBCONTRATISTAS: "subcontratistas";
|
|
readonly CONTRATOS: "contratos";
|
|
readonly CONTRATO_PARTIDAS: "contrato_partidas";
|
|
};
|
|
readonly hr: {
|
|
readonly EMPLOYEES: "employees";
|
|
readonly EMPLOYEE_CONSTRUCTION: "employee_construction";
|
|
readonly PUESTOS: "puestos";
|
|
readonly ASISTENCIAS: "asistencias";
|
|
readonly ASISTENCIA_BIOMETRICO: "asistencia_biometrico";
|
|
readonly GEOCERCAS: "geocercas";
|
|
readonly DESTAJO: "destajo";
|
|
readonly DESTAJO_DETALLE: "destajo_detalle";
|
|
readonly CUADRILLAS: "cuadrillas";
|
|
readonly CUADRILLA_MIEMBROS: "cuadrilla_miembros";
|
|
readonly EMPLOYEE_FRACCIONAMIENTOS: "employee_fraccionamientos";
|
|
};
|
|
readonly hse: {
|
|
readonly INCIDENTES: "incidentes";
|
|
readonly INCIDENTE_INVOLUCRADOS: "incidente_involucrados";
|
|
readonly INCIDENTE_ACCIONES: "incidente_acciones";
|
|
readonly INCIDENTE_EVIDENCIAS: "incidente_evidencias";
|
|
readonly INCIDENTE_CAUSAS: "incidente_causas";
|
|
readonly CAPACITACIONES: "capacitaciones";
|
|
readonly CAPACITACION_PARTICIPANTES: "capacitacion_participantes";
|
|
readonly CAPACITACION_MATERIALES: "capacitacion_materiales";
|
|
readonly CERTIFICACIONES: "certificaciones";
|
|
readonly CERTIFICACION_EMPLEADOS: "certificacion_empleados";
|
|
readonly PLAN_CAPACITACION: "plan_capacitacion";
|
|
readonly INSPECCIONES_SEGURIDAD: "inspecciones_seguridad";
|
|
readonly INSPECCION_HALLAZGOS: "inspeccion_hallazgos";
|
|
readonly CHECKLIST_SEGURIDAD: "checklist_seguridad";
|
|
readonly CHECKLIST_SEGURIDAD_ITEMS: "checklist_seguridad_items";
|
|
readonly AREAS_RIESGO: "areas_riesgo";
|
|
readonly RONDAS_SEGURIDAD: "rondas_seguridad";
|
|
readonly RONDA_PUNTOS: "ronda_puntos";
|
|
readonly EPP_CATALOGO: "epp_catalogo";
|
|
readonly EPP_ASIGNACIONES: "epp_asignaciones";
|
|
readonly EPP_ENTREGAS: "epp_entregas";
|
|
readonly EPP_DEVOLUCIONES: "epp_devoluciones";
|
|
readonly EPP_INSPECCIONES: "epp_inspecciones";
|
|
readonly EPP_VIDA_UTIL: "epp_vida_util";
|
|
readonly EPP_STOCK: "epp_stock";
|
|
readonly NORMAS_STPS: "normas_stps";
|
|
readonly REQUISITOS_NORMA: "requisitos_norma";
|
|
readonly CUMPLIMIENTO_NORMA: "cumplimiento_norma";
|
|
readonly AUDITORIAS_STPS: "auditorias_stps";
|
|
readonly AUDITORIA_HALLAZGOS: "auditoria_hallazgos";
|
|
readonly PLANES_ACCION: "planes_accion";
|
|
readonly ACCIONES_CORRECTIVAS: "acciones_correctivas";
|
|
readonly COMISION_SEGURIDAD: "comision_seguridad";
|
|
readonly COMISION_MIEMBROS: "comision_miembros";
|
|
readonly RECORRIDOS_COMISION: "recorridos_comision";
|
|
readonly ACTAS_COMISION: "actas_comision";
|
|
readonly IMPACTOS_AMBIENTALES: "impactos_ambientales";
|
|
readonly RESIDUOS: "residuos";
|
|
readonly RESIDUO_MOVIMIENTOS: "residuo_movimientos";
|
|
readonly MANIFIESTOS_RESIDUOS: "manifiestos_residuos";
|
|
readonly MONITOREO_AMBIENTAL: "monitoreo_ambiental";
|
|
readonly PERMISOS_AMBIENTALES: "permisos_ambientales";
|
|
readonly PROGRAMAS_AMBIENTALES: "programas_ambientales";
|
|
readonly INDICADORES_AMBIENTALES: "indicadores_ambientales";
|
|
readonly EVENTOS_AMBIENTALES: "eventos_ambientales";
|
|
readonly PERMISOS_TRABAJO: "permisos_trabajo";
|
|
readonly PERMISO_RIESGOS: "permiso_riesgos";
|
|
readonly PERMISO_AUTORIZACIONES: "permiso_autorizaciones";
|
|
readonly PERMISOS_ALTURA: "permisos_altura";
|
|
readonly PERMISOS_CALIENTE: "permisos_caliente";
|
|
readonly PERMISOS_CONFINADO: "permisos_confinado";
|
|
readonly PERMISOS_ELECTRICO: "permisos_electrico";
|
|
readonly PERMISOS_EXCAVACION: "permisos_excavacion";
|
|
readonly KPI_CONFIGURACION: "kpi_configuracion";
|
|
readonly KPI_VALORES: "kpi_valores";
|
|
readonly KPI_METAS: "kpi_metas";
|
|
readonly DASHBOARDS_HSE: "dashboards_hse";
|
|
readonly ALERTAS_HSE: "alertas_hse";
|
|
readonly REPORTES_HSE: "reportes_hse";
|
|
readonly ESTADISTICAS_PERIODO: "estadisticas_periodo";
|
|
};
|
|
readonly estimates: {
|
|
readonly ESTIMACIONES: "estimaciones";
|
|
readonly ESTIMACION_CONCEPTOS: "estimacion_conceptos";
|
|
readonly GENERADORES: "generadores";
|
|
readonly ANTICIPOS: "anticipos";
|
|
readonly AMORTIZACIONES: "amortizaciones";
|
|
readonly RETENCIONES: "retenciones";
|
|
readonly FONDO_GARANTIA: "fondo_garantia";
|
|
readonly ESTIMACION_WORKFLOW: "estimacion_workflow";
|
|
};
|
|
readonly infonavit: {
|
|
readonly REGISTRO_INFONAVIT: "registro_infonavit";
|
|
readonly OFERTA_VIVIENDA: "oferta_vivienda";
|
|
readonly DERECHOHABIENTES: "derechohabientes";
|
|
readonly ASIGNACION_VIVIENDA: "asignacion_vivienda";
|
|
readonly ACTAS: "actas";
|
|
readonly ACTA_VIVIENDAS: "acta_viviendas";
|
|
readonly REPORTES_INFONAVIT: "reportes_infonavit";
|
|
readonly HISTORICO_PUNTOS: "historico_puntos";
|
|
};
|
|
readonly inventory: {
|
|
readonly ALMACENES_PROYECTO: "almacenes_proyecto";
|
|
readonly REQUISICIONES_OBRA: "requisiciones_obra";
|
|
readonly REQUISICION_LINEAS: "requisicion_lineas";
|
|
readonly CONSUMOS_OBRA: "consumos_obra";
|
|
readonly PRODUCTS: "products";
|
|
readonly LOCATIONS: "locations";
|
|
readonly STOCK_MOVES: "stock_moves";
|
|
readonly STOCK_QUANTS: "stock_quants";
|
|
};
|
|
readonly purchase: {
|
|
readonly PURCHASE_ORDER_CONSTRUCTION: "purchase_order_construction";
|
|
readonly SUPPLIER_CONSTRUCTION: "supplier_construction";
|
|
readonly COMPARATIVO_COTIZACIONES: "comparativo_cotizaciones";
|
|
readonly COMPARATIVO_PROVEEDORES: "comparativo_proveedores";
|
|
readonly COMPARATIVO_PRODUCTOS: "comparativo_productos";
|
|
readonly PURCHASE_ORDERS: "purchase_orders";
|
|
readonly PURCHASE_ORDER_LINES: "purchase_order_lines";
|
|
readonly SUPPLIERS: "suppliers";
|
|
};
|
|
readonly audit: {
|
|
readonly AUDIT_LOG: "audit_log";
|
|
readonly CHANGE_HISTORY: "change_history";
|
|
readonly USER_ACTIVITY: "user_activity";
|
|
};
|
|
};
|
|
/**
|
|
* Common Column Names (to avoid hardcoding)
|
|
*/
|
|
export declare const DB_COLUMNS: {
|
|
readonly ID: "id";
|
|
readonly CREATED_AT: "created_at";
|
|
readonly UPDATED_AT: "updated_at";
|
|
readonly CREATED_BY: "created_by";
|
|
readonly UPDATED_BY: "updated_by";
|
|
readonly DELETED_AT: "deleted_at";
|
|
readonly TENANT_ID: "tenant_id";
|
|
readonly USER_ID: "user_id";
|
|
readonly PROJECT_ID: "proyecto_id";
|
|
readonly FRACCIONAMIENTO_ID: "fraccionamiento_id";
|
|
readonly EMPLOYEE_ID: "employee_id";
|
|
readonly STATUS: "status";
|
|
readonly IS_ACTIVE: "is_active";
|
|
readonly ANALYTIC_ACCOUNT_ID: "analytic_account_id";
|
|
};
|
|
/**
|
|
* Helper function to get full table name
|
|
*/
|
|
export declare function getFullTableName(schema: DBSchema, table: string): string;
|
|
/**
|
|
* Get schema.table reference
|
|
*/
|
|
export declare const TABLE_REFS: {
|
|
readonly USERS: string;
|
|
readonly TENANTS: string;
|
|
readonly ROLES: string;
|
|
readonly PROYECTOS: string;
|
|
readonly FRACCIONAMIENTOS: string;
|
|
readonly EMPLOYEES: string;
|
|
readonly INCIDENTES: string;
|
|
readonly CAPACITACIONES: string;
|
|
};
|
|
//# sourceMappingURL=database.constants.d.ts.map
|