Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JAQA20/LaComanda/llms.txt

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

Staff user accounts are managed from views/admin/usuarios.php, accessible only to administrators (rol_id=1). From this view, admins can create new accounts for waiters, kitchen staff, and baristas; update existing user details and passwords; and deactivate or permanently remove accounts that are no longer needed. Each user account is tied to a specific role that determines which parts of the application they can access.

User Fields

FieldTypeDescription
nombrestring (max 100)Required. The user’s first name.
apellidostring (max 100)Required. The user’s last name.
emailstring (max 100)Required, unique. Used as the login credential. Must not already exist in the users table.
passwordstring (min 8 chars)Required on create, optional on edit. Leave blank when editing to keep the existing password.
rol_idintegerRequired. Role assignment: 1 = Admin, 2 = Mesero, 3 = Cocina, 4 = Barista.
activobooleanDefault 1. Inactive users (activo=0) cannot log in, but their records and order history are preserved.

Creating a User

New user accounts are created through the form at views/admin/nuevoUsuario.php, which submits to:
POST /public/api/nuevoUsuario.php
The endpoint performs the following validation before inserting the record:
  • All required fields (nombre, apellido, email, password, rol_id) must be present and non-empty.
  • password must be at least 8 characters long.
  • The password confirmation field must exactly match the password field.
  • The provided email must be unique — if another active user already has that email, the request is rejected.
On success, the password is stored as a bcrypt hash — plain-text passwords are never persisted to the database.

Editing a User

Existing user records can be updated via the form at:
views/admin/editarUsuario.php?id={id}
The form submits to:
POST /public/api/editarUsuario.php
All fields are editable, including role and active status. The password field is optional when editing — leaving it blank preserves the user’s current password without modification. If a new password is provided, it must meet the same requirements as on creation: at least 8 characters and matching the confirmation field.

Deleting a User

To permanently remove a user account, submit:
POST /public/api/eliminarUsuario.php
ParameterDescription
idThe ID of the user to delete
The endpoint enforces two hard restrictions:
  • The root admin account (id=1) cannot be deleted under any circumstances.
  • An admin cannot delete their own account — the currently authenticated user’s ID is checked against the target ID.
Deleting a user is permanent. Alternatively, set activo=0 to deactivate without deleting — inactive users cannot log in but their order history is preserved.
Email must be unique across all users. Re-using an email from a deleted user is allowed since deleted records are removed from the table entirely.

Build docs developers (and LLMs) love