# _MAP: MGN-005 - Catalogos

**Modulo:** MGN-005
**Nombre:** Catalogos Maestros
**Fase:** 02 - Core Business
**Story Points:** 30 SP
**Estado:** Implementado
**Sprint:** 6
**Ultima actualizacion:** 2026-01-07

---

## Resumen

Sistema de catalogos maestros genericos para listas de valores reutilizables: paises, estados, monedas, tasas de cambio, unidades de medida, categorias, etc.

---

## Metricas

| Metrica | Valor |
|---------|-------|
| Story Points | 30 SP |
| Requerimientos (RF) | 5 |
| Especificaciones (ET) | 3 |
| User Stories (US) | 5 |
| Tablas DB | 8 |
| Endpoints API | 18 |
| Tests | 117 |

---

## Requerimientos Funcionales (5)

| ID | Archivo | Titulo | Prioridad | Estado |
|----|---------|--------|-----------|--------|
| RF-CATALOG-001 | [RF-CATALOG-001.md](./requerimientos/RF-CATALOG-001.md) | CRUD Catalogos | P0 | Migrado |
| RF-CATALOG-002 | [RF-CATALOG-002.md](./requerimientos/RF-CATALOG-002.md) | Items de Catalogo | P0 | Migrado |
| RF-CATALOG-003 | [RF-CATALOG-003.md](./requerimientos/RF-CATALOG-003.md) | Catalogos Jerarquicos | P1 | Migrado |
| RF-CATALOG-004 | [RF-CATALOG-004.md](./requerimientos/RF-CATALOG-004.md) | Catalogos de Sistema | P1 | Migrado |
| RF-CATALOG-005 | [RF-CATALOG-005.md](./requerimientos/RF-CATALOG-005.md) | Busqueda y Filtrado | P1 | Migrado |

**Indice:** [INDICE-RF-CATALOG.md](./requerimientos/INDICE-RF-CATALOG.md)

---

## Especificaciones Tecnicas

| ID | Archivo | Titulo |
|----|---------|--------|
| ET-CATALOG-backend | [ET-CATALOG-backend.md](./especificaciones/ET-CATALOG-backend.md) | Backend Services |
| ET-CATALOG-frontend | [ET-CATALOG-frontend.md](./especificaciones/ET-CATALOG-frontend.md) | Frontend Components |
| ET-CATALOG-database | [ET-CATALOG-database.md](./especificaciones/ET-CATALOG-database.md) | Database Schema |

---

## Historias de Usuario

| ID | Titulo | Estado |
|----|--------|--------|
| US-MGN005-001 | CRUD Paises | Implementado |
| US-MGN005-002 | CRUD Estados/Provincias | Implementado |
| US-MGN005-003 | CRUD Monedas | Implementado |
| US-MGN005-004 | Tasas de Cambio | Implementado |
| US-MGN005-005 | Unidades de Medida | Implementado |

---

## Implementacion

### Database (DDL: 02-core.sql, 02-core-extensions.sql)

| Objeto | Tipo | Schema |
|--------|------|--------|
| countries | Tabla | core |
| states | Tabla | core |
| currencies | Tabla | core |
| currency_rates | Tabla | core |
| exchange_rates | Tabla | core |
| uom_categories | Tabla | core |
| uom | Tabla | core |
| product_categories | Tabla | core |

### Backend (src/modules/core/)

| Objeto | Tipo | Path |
|--------|------|------|
| CountriesService | Service | src/modules/core/countries.service.ts |
| StatesService | Service | src/modules/core/states.service.ts |
| CurrenciesService | Service | src/modules/core/currencies.service.ts |
| CurrencyRatesService | Service | src/modules/core/currency-rates.service.ts |
| UomService | Service | src/modules/core/uom.service.ts |
| CoreController | Controller | src/modules/core/core.controller.ts |
| CoreRoutes | Routes | src/modules/core/core.routes.ts |

### Entities

| Entity | Path |
|--------|------|
| Country | src/modules/core/entities/country.entity.ts |
| State | src/modules/core/entities/state.entity.ts |
| Currency | src/modules/core/entities/currency.entity.ts |
| CurrencyRate | src/modules/core/entities/currency-rate.entity.ts |
| UomCategory | src/modules/core/entities/uom-category.entity.ts |
| Uom | src/modules/core/entities/uom.entity.ts |

### Tests (117 tests)

| Test File | Tests |
|-----------|-------|
| countries.service.spec.ts | 19 |
| states.service.spec.ts | 25 |
| currencies.service.spec.ts | 21 |
| currency-rates.service.spec.ts | 19 |
| uom.service.spec.ts | 33 |

---

## Dependencias

**Depende de:** MGN-001 (Auth), MGN-004 (Tenants)

**Requerido por:** MGN-010 (Financial), MGN-011 (Inventory), Verticales

---

## Trazabilidad

Ver: [TRACEABILITY.yml](./implementacion/TRACEABILITY.yml)

---

## Changelog

| Fecha | Sprint | Cambios |
|-------|--------|---------|
| 2026-01-07 | Sprint 6 | Implementacion completa: States, Currency Rates, UoM Conversions |
| 2025-12-05 | - | Migracion desde GAMILIT |

---

**Generado por:** Requirements-Analyst
**Implementado por:** Backend-Agent (Sprint 6)
**Fecha:** 2026-01-07
