Units of measure define the counting standard applied to each material in Corpointa. When a material is created, it must be assigned a unit of measure (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/EricMartinez758/corpointa-frontend/llms.txt
Use this file to discover all available pages before exploring further.
fk_id_medida) that determines how its quantity is expressed throughout the system — in stock records, movement entries, and dispatch documents. The module is accessible at the /unidades-medida route and provides a simple CRUD interface for managing the available unit options.
Data Model
TheUnidadMedida type is derived from the Zod schema in src/features/unidades-medida/data/schema.ts.
Field Reference
| Field | Type | Constraints | Description |
|---|---|---|---|
id_medida | number | Auto-assigned | Primary key. Referenced as fk_id_medida in material records. |
nombre | string | Required, max 50 chars | Display name of the unit (e.g., Unidad, Kg, Litro, Metro). |
Features
CRUD Table
Lists all defined units of measure. Each row has edit and delete actions available via an inline action menu.
Create Dialog
A minimal form with a single
nombre field. Client-side Zod validation enforces the required constraint before submission.Edit Dialog
Pre-fills the form with the selected unit’s current name. Updates are applied via
PUT /unidades-medidas/:id.Referenced by Materials
The unit name (
medida_nombre) is resolved via JOIN and displayed in the Materials table and material detail dialogs wherever a material’s unit needs to be shown.API Operations
All functions live insrc/features/unidades-medida/api/unidades-medidas.ts.
The API base path for this resource is
/unidades-medidas (with a trailing s), matching the backend route naming convention.| Method | Endpoint | Function | Description |
|---|---|---|---|
GET | /unidades-medidas | getUnidades() | Returns all unit of measure records. |
GET | /unidades-medidas/:id | getUnidad(id) | Returns a single unit by id_medida. |
POST | /unidades-medidas | createUnidad(data) | Creates a new unit. Body: { nombre: string }. |
PUT | /unidades-medidas/:id | updateUnidad(id, data) | Updates the name of an existing unit. Body: { nombre: string }. |
DELETE | /unidades-medidas/:id | deleteUnidad(id) | Permanently removes a unit of measure record. |
Create Payload
When creating or updating a unit,id_medida is excluded from the request body: