The Users API manages accounts for both students and administrators on the UniSierra Eats platform. Registration is restricted to institutional email addresses ending inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
@unisierra.edu.mx. There is no session middleware — after login the caller is responsible for persisting the returned user object in localStorage and passing identity data in subsequent requests where needed.
Passwords are stored and compared as plain text. There is no hashing or salting applied at any layer of this API. This is a known limitation of the current implementation and should be addressed before any production deployment.
POST /api/registro
Registers a new student account withrol_id = 2. The email address must belong to the @unisierra.edu.mx domain; the check is case-insensitive.
Request Body
Full name of the student.
Institutional email address. Must end with
@unisierra.edu.mx (case-insensitive).Account password stored as plain text.
Response — 200 OK
Confirmation message:
"Usuario registrado con éxito".The
lastID of the newly created user row.Response — 400 Bad Request (invalid email domain)
Response — 400 Bad Request (duplicate email)
Example
POST /api/admin/registro
Registers a new administrator account withrol_id = 1. Shares the same institutional email restriction as POST /api/registro.
This endpoint has no server-side authorization check. Any caller can create an administrator account as long as they supply a valid
@unisierra.edu.mx email.Request Body
Full name of the administrator.
Institutional email address. Must end with
@unisierra.edu.mx (case-insensitive).Account password stored as plain text.
Response — 200 OK
Confirmation message:
"Nuevo administrador registrado con éxito.".Response — 400 Bad Request (invalid email domain)
Response — 400 Bad Request (duplicate email)
Example
POST /api/login
Authenticates a user by matchingcorreo and password against the Usuarios table. Returns the user object on success so the frontend can persist it in localStorage.
Request Body
The user’s registered email address.
The user’s plain-text password.
Response — 200 OK
Confirmation message:
"Inicio de sesión exitoso".The authenticated user object.
Response — 401 Unauthorized
Response — 500 Internal Server Error
Example
PUT /api/usuarios/:id
Updates a user’s display name, and optionally their password, identified by the user’sid. If password is an empty string or contains only whitespace, only nombre is updated.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id of the user to update. |
Request Body
The user’s updated display name.
The user’s new plain-text password. If empty or whitespace-only, the existing password is left unchanged and only
nombre is updated.Update Logic
The endpoint branches internally based on thepassword value:
Response — 200 OK
Confirmation message:
"Perfil actualizado correctamente".Response — 500 Internal Server Error
Examples
Update name only (empty password):DELETE /api/usuarios/:id
Permanently deletes a user account. To avoid foreign-key constraint errors, the endpoint first removes all reviews authored by the user, then deletes the user record itself.Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id of the user to delete. |
Request Body
None required.Deletion Order
The server executes two sequentialDELETE statements:
Response — 200 OK
Confirmation message:
"Cuenta eliminada correctamente".