Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Edwin950821/BodegaX/llms.txt

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

All user identity operations in BodegaX flow through the /admin/* endpoints. This includes logging in, registering new accounts (both from the public registration page and the admin settings panel), editing existing user records, and deleting users. The term “admin” in the URL path is a legacy naming convention — the endpoints serve all user roles, and a role field on each user record distinguishes admin from user accounts.

POST /admin/login

Authenticates a user against the database and returns their full user object. On success, the Angular frontend stores this object in sessionStorage under the key bodegax and navigates to /. On failure, the application surfaces a dialog reading “Credenciales invalidas”.
curl -X POST http://localhost:8080/admin/login \
  -H "Content-Type: application/json" \
  -d '{
    "username": "María García",
    "password": "s3cur3pass"
  }'

Request Body

username
string
required
The user’s display name as stored in the database. This is the value of the nombre field set at registration.
password
string
required
The user’s password in plain text. Validated server-side against the stored credential.

Response

A JSON object representing the authenticated user. This object is stored verbatim in sessionStorage.
uuid
string
Universally unique identifier for the user. Used in subsequent requests as uuid_admin or uuid_cliente.
nombre
string
The user’s display name.
role
string
The user’s role. Either "admin" (warehouse staff) or "user" (client). Determines which UI views and actions are available.
id
string
The user’s government-issued document or ID number.
direccion
string
The user’s registered address.
Example response:
{
  "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "nombre": "María García",
  "role": "admin",
  "id": "1098765432",
  "direccion": "Calle 45 # 12-30, Bogotá"
}
The frontend reads sessionStorage.getItem('bodegax') on every page load to restore the session. Clearing sessionStorage effectively logs the user out.

POST /admin/create

Creates a new user account. This endpoint is called in two places: the public /register page (where new clients self-register) and the admin Settings panel (where staff create client accounts on behalf of users). In both cases, the frontend sets role to "user" automatically. After a successful registration from the public register page, the frontend immediately calls POST /admin/login with the same credentials to log the new user in.
curl -X POST http://localhost:8080/admin/create \
  -H "Content-Type: application/json" \
  -d '{
    "role": "user",
    "nombre": "Carlos Mendoza",
    "id": "1023456789",
    "password": "mypassword",
    "direccion": "Carrera 10 # 5-20, Medellín"
  }'

Request Body

role
string
required
The user’s role. The frontend always sends "user" for client accounts. Set to "admin" directly via the backend for warehouse staff accounts.
nombre
string
required
The user’s display name. Also serves as the username field for login.
id
string
required
The user’s document or national ID number.
password
string
required
The user’s password. Stored and validated server-side.
direccion
string
The user’s address. Optional — can be left empty or omitted.

Response

The newly created user object, with the same shape as the login response (uuid, nombre, role, id, direccion).

PUT /admin/edit

Updates an existing user’s information. Called from the Settings panel when an admin edits a client’s record via the UserFormDialog. All fields must be provided; the server replaces the existing record.
curl -X PUT http://localhost:8080/admin/edit \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "role": "user",
    "nombre": "Carlos Mendoza",
    "id": "1023456789",
    "password": "newpassword",
    "direccion": "Avenida 80 # 32-15, Medellín"
  }'

Request Body

uuid
string
required
The unique identifier of the user to update. This value is obtained from the user list (GET /admin/all) and passed into the edit dialog.
role
string
required
The user’s role. Pass the existing role value to preserve it (e.g., "user").
nombre
string
required
Updated display name for the user.
id
string
required
Updated document or national ID number.
password
string
required
Updated password. The frontend pre-populates this field with the existing password value from the user record.
direccion
string
Updated address.

Response

The updated user object.

DELETE /admin/delete

Deletes a user from the system. The Settings page opens a confirmation dialog before sending this request. The full user object is passed as the request body.
curl -X DELETE http://localhost:8080/admin/delete \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "nombre": "Carlos Mendoza",
    "role": "user",
    "id": "1023456789",
    "password": "mypassword",
    "direccion": "Carrera 10 # 5-20, Medellín"
  }'
Deletion is permanent. After a successful delete, the frontend refreshes the user list via GET /admin/all. Ensure that the user has no active sales records before deletion to avoid orphaned uuid_cliente references in the ventas table.

Request Body

Pass the complete user object as retrieved from GET /admin/all. The uuid field is used server-side to identify the record to delete.

Response

A confirmation response. After receiving a successful status, the frontend re-fetches GET /admin/all to update the displayed user table.

GET /admin/all

Returns an array of all registered user accounts. This endpoint is used in several parts of the application:
  • Settings page — renders the full user management table
  • Home page (Despachar Caja dialog) — populates the client dropdown; filtered client-side by role === 'user'
  • History page — resolves uuid_cliente from each sale record to a human-readable client name
  • TerminarJornada dialog — loads clients to generate end-of-day PDF reports
curl http://localhost:8080/admin/all

Response

An array of user objects.
[
  {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "nombre": "María García",
    "role": "admin",
    "id": "1098765432",
    "direccion": "Calle 45 # 12-30, Bogotá"
  },
  {
    "uuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "nombre": "Carlos Mendoza",
    "role": "user",
    "id": "1023456789",
    "direccion": "Carrera 10 # 5-20, Medellín"
  }
]
The frontend filters this array by role === 'user' when building client dropdowns. The full unfiltered array is used when resolving names for the history and report views. Admin accounts appear in the raw response and must be excluded in client-facing contexts.

Build docs developers (and LLMs) love