Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Zapiony/PUCE_UZDI_2026/llms.txt

Use this file to discover all available pages before exploring further.

The medida-socioeducativa resource is the catalogue of socio-educational measure types defined by the UZDI programme. Each record names a type of measure and optionally specifies its standard duration in months. Individual measure assignments to adolescents are recorded in the expediente (case file) resource — which references this catalogue via the mdso_id foreign key. The frontend derives a display code MED-{id padded to 4 digits} from each record’s primary key, and renders progress bars with colour thresholds to visualise compliance. Base path: /api/v1/medida-socioeducativa

Role requirements

OperationAllowed roles
GET /api/v1/medida-socioeducativaADMINISTRADOR, SUPERADMINISTRADOR, TRABAJADOR_SOCIAL, PSICOLOGO, EDUCADOR, JURIDICO
GET /api/v1/medida-socioeducativa/:idAll authenticated users
POST /api/v1/medida-socioeducativaADMINISTRADOR, SUPERADMINISTRADOR
PATCH /api/v1/medida-socioeducativa/:idADMINISTRADOR, SUPERADMINISTRADOR
DELETE /api/v1/medida-socioeducativa/:idADMINISTRADOR, SUPERADMINISTRADOR
A valid JWT must be sent in every request via the Authorization: Bearer <token> header. Obtain a token via POST /api/v1/auth/login.

Endpoints

GET /api/v1/medida-socioeducativa

Returns the full catalogue of socio-educational measure types. The frontend maps each record to a MED-{id} display code and uses duracion_meses to compute progress percentages against the active expediente’s fecha_inicio_medida.
curl -X GET https://api.uzdi.puce.edu.ec/api/v1/medida-socioeducativa \
  -H "Authorization: Bearer <token>"

Response — 200 OK

Returns an array of MedidaSocioeducativa catalogue objects.
id
number
Internal primary key (mdso_id in the database). The frontend uses this value to derive the display code MED-{id padded to 4 digits}.
nombre
string
Full descriptive name of the measure type, e.g. "Libertad Asistida" or "Internamiento de Fin de Semana". Maximum 255 characters.
duracion_meses
number | null
Standard duration of the measure in months. Integer ≥ 1. Nullable — if null, no standard duration is defined for this measure type.
fcCrea
string (timestamp) | null
Server-set creation timestamp. Not writable via POST or PATCH.
fcMod
string (timestamp) | null
Server-set last-modification timestamp. Not writable via POST or PATCH.

POST /api/v1/medida-socioeducativa

Creates a new measure type in the catalogue. Once created, the record can be referenced by expediente records via its id (mdso_id).
curl -X POST https://api.uzdi.puce.edu.ec/api/v1/medida-socioeducativa \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Libertad Asistida",
    "duracion_meses": 12
  }'

Request body

nombre
string
required
Full name of the measure type. 1–255 characters. HTML is stripped by the global SanitizationPipe before validation.
duracion_meses
number
Standard duration in whole months. Integer ≥ 1. Optional — omit if the measure type has no fixed duration. This value is used by the frontend’s progress calculation: elapsed months / duracion_meses × 100.

Response — 201 Created

Returns the saved MedidaSocioeducativa object with the generated id and the server-set fcCrea timestamp.
{
  "id": 5,
  "nombre": "Libertad Asistida",
  "duracion_meses": 12,
  "fcCrea": "2024-03-01T10:42:00.000Z",
  "fcMod": null
}

GET /api/v1/medida-socioeducativa/:id

Retrieves a single measure type record by its numeric primary key.
Path parameterTypeDescription
idnumberThe mdso_id of the measure type to retrieve.
curl -X GET https://api.uzdi.puce.edu.ec/api/v1/medida-socioeducativa/5 \
  -H "Authorization: Bearer <token>"

Response — 200 OK

Returns the matching MedidaSocioeducativa object with the same shape as the list response. Returns null if no record is found for the given id.

PATCH /api/v1/medida-socioeducativa/:id

Partially updates an existing measure type. Both fields are optional — send only what you need to change. The body is validated by UpdateMedidaSocioeducativaDto, a PartialType of CreateMedidaSocioeducativaDto.
Path parameterTypeDescription
idnumberThe mdso_id of the measure type to update.
curl -X PATCH https://api.uzdi.puce.edu.ec/api/v1/medida-socioeducativa/5 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "duracion_meses": 18
  }'

Request body

nombre
string
Updated measure type name. 1–255 characters. Optional.
duracion_meses
number
Updated standard duration in months. Integer ≥ 1. Optional.

Response — 200 OK

Returns a TypeORM UpdateResult with an affected count.
The PATCH endpoint returns a TypeORM UpdateResult, not the full updated entity. Issue a follow-up GET /api/v1/medida-socioeducativa/:id if you need the refreshed object. Note that changing duracion_meses will immediately affect progress bar calculations in the MedidasView for all linked expedientes.

DELETE /api/v1/medida-socioeducativa/:id

Removes a measure type from the catalogue.
Path parameterTypeDescription
idnumberThe mdso_id of the measure type to remove.
curl -X DELETE https://api.uzdi.puce.edu.ec/api/v1/medida-socioeducativa/5 \
  -H "Authorization: Bearer <token>"

Response — 200 OK

Returns a TypeORM DeleteResult with an affected count.
Deleting a measure type that is still referenced by one or more expediente records (via mdso_id) will violate the database foreign-key constraint and result in a 500 error. Reassign or close all related case files before removing a catalogue entry in a production environment.

Progress calculation and revision date tracking

The duracion_meses field on each measure type is the primary input to the progress bar logic rendered in MedidasView. The frontend computes elapsed progress as:
progress (%) = (months elapsed since fecha_inicio_medida / duracion_meses) × 100
Bar colour thresholds applied by the design system:
Progress rangeBadge colour
0 – 49 %Green
50 – 79 %Amber
80 – 100 %Red
Revision dates are derived from the expediente entity’s fecha_inicio_medida and fecha_fin_medida fields. The dashboard Próximas Revisiones table queries these dates to generate urgency-colour-coded alerts. Neither the progress percentage nor revision dates are stored as columns — they are computed at read time from the catalogue duracion_meses value and the case file’s date fields.
If duracion_meses is null, the frontend renders the measure duration as "—" and no progress bar is displayed for affiliated expedientes.

Build docs developers (and LLMs) love