The Users API manages system accounts stored in theDocumentation 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.
seguridad.prsn PostgreSQL table. Each record represents a staff member (Técnico, Coordinador, or Administrador) who can log in to the UZDI platform. All endpoints require a valid Bearer token — the current implementation does not enforce role-based guards at the controller level.
All endpoints share the global prefix
/api/v1. The base path for this resource is /api/v1/users.Entity — seguridad.prsn
The TypeORM entity maps application field names to the underlying database column names. The table below shows both.
| App field | DB column | Type | Constraints | Description |
|---|---|---|---|---|
id | prsn_id | int4 | PK, auto-increment | Internal primary key |
uzdi_id | uzdi_id | int4 | nullable | FK to the UZDI unit |
tppr_id | tppr_id | int4 | nullable | Profile/role (1=Técnico, 2=Coordinador, 3=Administrador) |
nombres | prsnnmbr | varchar(31) | not null | First name(s) |
apellidos | prsnapll | varchar(31) | not null | Last name(s) |
sexo | prsnsexo | char(1) | nullable | 'M', 'F', or 'O' |
direccion | prsndire | varchar(255) | nullable | Street address |
telefono | prsntelf | varchar(63) | nullable | Phone number |
correo | prsnmail | varchar(63) | nullable | Email address |
login | prsnlogn | varchar(30) | unique, not null | Login handle |
password | prsnpass | varchar(63) | not null | bcrypt hash — never returned by the API |
observaciones | prsnobsr | varchar(255) | nullable | Free-text notes |
GET /api/v1/users
Returns a lightweight list of all users. Only the fields needed for display are selected (id, nombres, apellidos, correo, login, uzdi_id).
Authentication required: Bearer token
Request body: None
Success response — 200 OK
'Listado general de usuarios'Array of user summary objects.
Example
POST /api/v1/users
Creates a new user account. The service checks forlogin and correo uniqueness before hashing the password and saving the record. The saved password field is stripped before the response is returned.
Authentication required: Bearer token
Request body
First name(s). Max 31 characters.
Last name(s). Max 31 characters.
Unique login handle. Max 30 characters. Must not already exist in the database.
Plain-text password. The service hashes it with bcrypt before storage — the raw value is never persisted.
Valid email address. Must not already be registered to another user.
One of
'M' (Masculino), 'F' (Femenino), or 'O' (Otro). Optional.Street address. Max 255 characters. Optional.
Phone number. Max 63 characters. Optional.
FK to the UZDI unit. Optional.
Profile/role identifier. Optional. Accepted values:
1 (Técnico), 2 (Coordinador), 3 (Administrador).Array of additional role IDs. Optional — accepted by the DTO but not yet consumed by the service.
Free-text notes. Max 255 characters. Optional.
Success response — 201 Created
'Usuario registrado correctamente'Full user object (all fields except
password).Error responses
| Status | Body | Cause |
|---|---|---|
409 Conflict | { "message": "El login o correo ya está en uso" } | Duplicate login or correo value. |
400 Bad Request | Validation error array | A required field is missing or fails format validation. |
Example
The
login field must be unique across the entire seguridad.prsn table (varchar(30), unique constraint). Attempting to register a duplicate login returns 409 Conflict.GET /api/v1/users/search?q=
Full-text search acrossnombres, apellidos, login, and correo columns using SQL LIKE (%query%). Returns a summary projection that omits uzdi_id (unlike GET /users).
Authentication required: Bearer token
Query parameters
Search term. Matched case-insensitively against
nombres, apellidos, login, and correo.Success response — 200 OK
'Resultados de búsqueda para: {q}'Array of matching user summary objects (
id, nombres, apellidos, correo, login).Example
GET /api/v1/users/:id
Retrieves a single user by primary key. The full entity is returned (minus thepassword field).
Authentication required: Bearer token
Path parameters
The user’s numeric primary key (
prsn_id).Success response — 200 OK
'Usuario con ID {id}'Full user object (all entity fields except
password).Error responses
| Status | Body | Cause |
|---|---|---|
404 Not Found | { "message": "Usuario no encontrado" } | No user with the given id exists. |
Example
PATCH /api/v1/users/:id
Partially updates one or more fields on an existing user. AllUpdateUserDto fields are optional — only the fields included in the request body are modified. If password is included it is re-hashed before being saved.
Authentication required: Bearer token
Path parameters
Numeric ID of the user to update.
Request body
All fields are optional. Any subset of theCreateUserDto fields may be supplied:
Updated first name(s).
Updated last name(s).
Updated login handle (must remain unique, max 30 chars).
New plain-text password — will be bcrypt-hashed before storage.
Updated email address (must remain unique).
One of
'M', 'F', or 'O'.Updated street address.
Updated phone number.
Updated UZDI unit FK.
Updated profile/role identifier.
Updated array of additional role IDs.
Updated free-text notes.
Success response — 200 OK
'Información del usuario actualizada'The full updated user object (all entity fields except
password).Error responses
| Status | Body | Cause |
|---|---|---|
404 Not Found | { "message": "Usuario no encontrado" } | No user with the given id exists. |
400 Bad Request | Validation error array | A supplied field fails format validation. |
Example
Sending
password in a PATCH body is fully supported. The service detects the presence of the field and bcrypt-hashes it with a fresh salt before calling userRepository.update().DELETE /api/v1/users/:id
Removes a user from the system. The current implementation performs a hard delete viauserRepository.delete(id). Future iterations will introduce a logical deactivation field (estado) to support soft-delete semantics.
Authentication required: Bearer token
Path parameters
Numeric ID of the user to remove.
Success response — 200 OK
'Usuario con ID {id} desactivado/eliminado exitosamente'Error responses
| Status | Body | Cause |
|---|---|---|
404 Not Found | { "message": "Usuario no encontrado" } | No user with the given id exists. |
Example
Password handling summary
| Operation | Behaviour |
|---|---|
POST /users (create) | Plain-text password → bcrypt.genSalt(10) + bcrypt.hash → stored in prsnpass |
PATCH /users/:id with password | New plain-text password → bcrypt.genSalt(10) + bcrypt.hash → updates prsnpass |
POST /auth/change-password | Verifies currentPassword with bcrypt.compare, then hashes newPassword |
| Any read response | password field is always deleted before the object is serialised |
The
login field maps to prsnlogn (varchar(30), unique constraint). Attempting to create or update a user with a login that already exists in the table will cause a 409 Conflict error.