226 lines
9.3 KiB
JavaScript
226 lines
9.3 KiB
JavaScript
"use strict";
|
|
/**
|
|
* API Constants - SSOT (Single Source of Truth)
|
|
*
|
|
* Todas las rutas de API, versiones y endpoints.
|
|
* NO hardcodear rutas en controllers o frontend.
|
|
*
|
|
* @module @shared/constants/api
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.CONTENT_TYPES = exports.HTTP_STATUS = exports.HTTP_METHODS = exports.API_ROUTES = exports.API_PREFIX = exports.API_VERSION = void 0;
|
|
/**
|
|
* API Version
|
|
*/
|
|
exports.API_VERSION = 'v1';
|
|
exports.API_PREFIX = `/api/${exports.API_VERSION}`;
|
|
/**
|
|
* API Routes organized by Module
|
|
*/
|
|
exports.API_ROUTES = {
|
|
// Base
|
|
ROOT: '/',
|
|
HEALTH: '/health',
|
|
DOCS: `${exports.API_PREFIX}/docs`,
|
|
// Auth Module
|
|
AUTH: {
|
|
BASE: `${exports.API_PREFIX}/auth`,
|
|
LOGIN: `${exports.API_PREFIX}/auth/login`,
|
|
LOGOUT: `${exports.API_PREFIX}/auth/logout`,
|
|
REFRESH: `${exports.API_PREFIX}/auth/refresh`,
|
|
REGISTER: `${exports.API_PREFIX}/auth/register`,
|
|
FORGOT_PASSWORD: `${exports.API_PREFIX}/auth/forgot-password`,
|
|
RESET_PASSWORD: `${exports.API_PREFIX}/auth/reset-password`,
|
|
ME: `${exports.API_PREFIX}/auth/me`,
|
|
CHANGE_PASSWORD: `${exports.API_PREFIX}/auth/change-password`,
|
|
},
|
|
// Users Module
|
|
USERS: {
|
|
BASE: `${exports.API_PREFIX}/users`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/users/${id}`,
|
|
ROLES: (id) => `${exports.API_PREFIX}/users/${id}/roles`,
|
|
},
|
|
// Tenants Module
|
|
TENANTS: {
|
|
BASE: `${exports.API_PREFIX}/tenants`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/tenants/${id}`,
|
|
CURRENT: `${exports.API_PREFIX}/tenants/current`,
|
|
},
|
|
// Construction Module
|
|
PROYECTOS: {
|
|
BASE: `${exports.API_PREFIX}/proyectos`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/proyectos/${id}`,
|
|
FRACCIONAMIENTOS: (id) => `${exports.API_PREFIX}/proyectos/${id}/fraccionamientos`,
|
|
DASHBOARD: (id) => `${exports.API_PREFIX}/proyectos/${id}/dashboard`,
|
|
PROGRESS: (id) => `${exports.API_PREFIX}/proyectos/${id}/progress`,
|
|
},
|
|
FRACCIONAMIENTOS: {
|
|
BASE: `${exports.API_PREFIX}/fraccionamientos`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/fraccionamientos/${id}`,
|
|
ETAPAS: (id) => `${exports.API_PREFIX}/fraccionamientos/${id}/etapas`,
|
|
MANZANAS: (id) => `${exports.API_PREFIX}/fraccionamientos/${id}/manzanas`,
|
|
LOTES: (id) => `${exports.API_PREFIX}/fraccionamientos/${id}/lotes`,
|
|
},
|
|
PRESUPUESTOS: {
|
|
BASE: `${exports.API_PREFIX}/presupuestos`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/presupuestos/${id}`,
|
|
PARTIDAS: (id) => `${exports.API_PREFIX}/presupuestos/${id}/partidas`,
|
|
COMPARE: (id) => `${exports.API_PREFIX}/presupuestos/${id}/compare`,
|
|
VERSIONS: (id) => `${exports.API_PREFIX}/presupuestos/${id}/versions`,
|
|
},
|
|
AVANCES: {
|
|
BASE: `${exports.API_PREFIX}/avances`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/avances/${id}`,
|
|
BY_PROYECTO: (proyectoId) => `${exports.API_PREFIX}/proyectos/${proyectoId}/avances`,
|
|
CURVA_S: (proyectoId) => `${exports.API_PREFIX}/proyectos/${proyectoId}/curva-s`,
|
|
FOTOS: (id) => `${exports.API_PREFIX}/avances/${id}/fotos`,
|
|
},
|
|
// HR Module
|
|
EMPLOYEES: {
|
|
BASE: `${exports.API_PREFIX}/employees`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/employees/${id}`,
|
|
ASISTENCIAS: (id) => `${exports.API_PREFIX}/employees/${id}/asistencias`,
|
|
CAPACITACIONES: (id) => `${exports.API_PREFIX}/employees/${id}/capacitaciones`,
|
|
},
|
|
ASISTENCIAS: {
|
|
BASE: `${exports.API_PREFIX}/asistencias`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/asistencias/${id}`,
|
|
CHECK_IN: `${exports.API_PREFIX}/asistencias/check-in`,
|
|
CHECK_OUT: `${exports.API_PREFIX}/asistencias/check-out`,
|
|
BY_PROYECTO: (proyectoId) => `${exports.API_PREFIX}/proyectos/${proyectoId}/asistencias`,
|
|
},
|
|
CUADRILLAS: {
|
|
BASE: `${exports.API_PREFIX}/cuadrillas`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/cuadrillas/${id}`,
|
|
MIEMBROS: (id) => `${exports.API_PREFIX}/cuadrillas/${id}/miembros`,
|
|
},
|
|
// HSE Module
|
|
INCIDENTES: {
|
|
BASE: `${exports.API_PREFIX}/incidentes`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/incidentes/${id}`,
|
|
INVOLUCRADOS: (id) => `${exports.API_PREFIX}/incidentes/${id}/involucrados`,
|
|
ACCIONES: (id) => `${exports.API_PREFIX}/incidentes/${id}/acciones`,
|
|
BY_PROYECTO: (proyectoId) => `${exports.API_PREFIX}/proyectos/${proyectoId}/incidentes`,
|
|
},
|
|
CAPACITACIONES: {
|
|
BASE: `${exports.API_PREFIX}/capacitaciones`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/capacitaciones/${id}`,
|
|
PARTICIPANTES: (id) => `${exports.API_PREFIX}/capacitaciones/${id}/participantes`,
|
|
CERTIFICADOS: (id) => `${exports.API_PREFIX}/capacitaciones/${id}/certificados`,
|
|
},
|
|
INSPECCIONES: {
|
|
BASE: `${exports.API_PREFIX}/inspecciones`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/inspecciones/${id}`,
|
|
HALLAZGOS: (id) => `${exports.API_PREFIX}/inspecciones/${id}/hallazgos`,
|
|
},
|
|
EPP: {
|
|
BASE: `${exports.API_PREFIX}/epp`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/epp/${id}`,
|
|
ASIGNACIONES: `${exports.API_PREFIX}/epp/asignaciones`,
|
|
ENTREGAS: `${exports.API_PREFIX}/epp/entregas`,
|
|
STOCK: `${exports.API_PREFIX}/epp/stock`,
|
|
},
|
|
// Estimates Module
|
|
ESTIMACIONES: {
|
|
BASE: `${exports.API_PREFIX}/estimaciones`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/estimaciones/${id}`,
|
|
CONCEPTOS: (id) => `${exports.API_PREFIX}/estimaciones/${id}/conceptos`,
|
|
GENERADORES: (id) => `${exports.API_PREFIX}/estimaciones/${id}/generadores`,
|
|
WORKFLOW: (id) => `${exports.API_PREFIX}/estimaciones/${id}/workflow`,
|
|
SUBMIT: (id) => `${exports.API_PREFIX}/estimaciones/${id}/submit`,
|
|
APPROVE: (id) => `${exports.API_PREFIX}/estimaciones/${id}/approve`,
|
|
REJECT: (id) => `${exports.API_PREFIX}/estimaciones/${id}/reject`,
|
|
},
|
|
// INFONAVIT Module
|
|
INFONAVIT: {
|
|
BASE: `${exports.API_PREFIX}/infonavit`,
|
|
REGISTRO: `${exports.API_PREFIX}/infonavit/registro`,
|
|
OFERTA: `${exports.API_PREFIX}/infonavit/oferta`,
|
|
DERECHOHABIENTES: `${exports.API_PREFIX}/infonavit/derechohabientes`,
|
|
ASIGNACIONES: `${exports.API_PREFIX}/infonavit/asignaciones`,
|
|
ACTAS: `${exports.API_PREFIX}/infonavit/actas`,
|
|
REPORTES: `${exports.API_PREFIX}/infonavit/reportes`,
|
|
},
|
|
// Inventory Module
|
|
ALMACENES: {
|
|
BASE: `${exports.API_PREFIX}/almacenes`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/almacenes/${id}`,
|
|
BY_PROYECTO: (proyectoId) => `${exports.API_PREFIX}/proyectos/${proyectoId}/almacenes`,
|
|
STOCK: (id) => `${exports.API_PREFIX}/almacenes/${id}/stock`,
|
|
},
|
|
REQUISICIONES: {
|
|
BASE: `${exports.API_PREFIX}/requisiciones`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/requisiciones/${id}`,
|
|
LINEAS: (id) => `${exports.API_PREFIX}/requisiciones/${id}/lineas`,
|
|
SUBMIT: (id) => `${exports.API_PREFIX}/requisiciones/${id}/submit`,
|
|
APPROVE: (id) => `${exports.API_PREFIX}/requisiciones/${id}/approve`,
|
|
},
|
|
// Purchase Module
|
|
COMPRAS: {
|
|
BASE: `${exports.API_PREFIX}/compras`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/compras/${id}`,
|
|
LINEAS: (id) => `${exports.API_PREFIX}/compras/${id}/lineas`,
|
|
COMPARATIVO: `${exports.API_PREFIX}/compras/comparativo`,
|
|
RECEPCIONES: (id) => `${exports.API_PREFIX}/compras/${id}/recepciones`,
|
|
},
|
|
PROVEEDORES: {
|
|
BASE: `${exports.API_PREFIX}/proveedores`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/proveedores/${id}`,
|
|
COTIZACIONES: (id) => `${exports.API_PREFIX}/proveedores/${id}/cotizaciones`,
|
|
},
|
|
// Contracts Module
|
|
CONTRATOS: {
|
|
BASE: `${exports.API_PREFIX}/contratos`,
|
|
BY_ID: (id) => `${exports.API_PREFIX}/contratos/${id}`,
|
|
PARTIDAS: (id) => `${exports.API_PREFIX}/contratos/${id}/partidas`,
|
|
ESTIMACIONES: (id) => `${exports.API_PREFIX}/contratos/${id}/estimaciones`,
|
|
},
|
|
// Reports Module
|
|
REPORTS: {
|
|
BASE: `${exports.API_PREFIX}/reports`,
|
|
DASHBOARD: `${exports.API_PREFIX}/reports/dashboard`,
|
|
AVANCE_FISICO: `${exports.API_PREFIX}/reports/avance-fisico`,
|
|
AVANCE_FINANCIERO: `${exports.API_PREFIX}/reports/avance-financiero`,
|
|
CURVA_S: `${exports.API_PREFIX}/reports/curva-s`,
|
|
PRESUPUESTO_VS_REAL: `${exports.API_PREFIX}/reports/presupuesto-vs-real`,
|
|
KPI_HSE: `${exports.API_PREFIX}/reports/kpi-hse`,
|
|
EXPORT: `${exports.API_PREFIX}/reports/export`,
|
|
},
|
|
};
|
|
/**
|
|
* HTTP Methods
|
|
*/
|
|
exports.HTTP_METHODS = {
|
|
GET: 'GET',
|
|
POST: 'POST',
|
|
PUT: 'PUT',
|
|
PATCH: 'PATCH',
|
|
DELETE: 'DELETE',
|
|
};
|
|
/**
|
|
* HTTP Status Codes
|
|
*/
|
|
exports.HTTP_STATUS = {
|
|
OK: 200,
|
|
CREATED: 201,
|
|
NO_CONTENT: 204,
|
|
BAD_REQUEST: 400,
|
|
UNAUTHORIZED: 401,
|
|
FORBIDDEN: 403,
|
|
NOT_FOUND: 404,
|
|
CONFLICT: 409,
|
|
UNPROCESSABLE_ENTITY: 422,
|
|
INTERNAL_SERVER_ERROR: 500,
|
|
SERVICE_UNAVAILABLE: 503,
|
|
};
|
|
/**
|
|
* Content Types
|
|
*/
|
|
exports.CONTENT_TYPES = {
|
|
JSON: 'application/json',
|
|
FORM_URLENCODED: 'application/x-www-form-urlencoded',
|
|
MULTIPART: 'multipart/form-data',
|
|
PDF: 'application/pdf',
|
|
EXCEL: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
};
|
|
//# sourceMappingURL=api.constants.js.map
|