Overview
The Users API provides functionality for managing user data within the Walle system. User information is stored in MongoDB and supports various operations for authentication and user retrieval.Key Features
MongoDB Storage
User data is persisted in MongoDB using the Mongoose ODM. The system connects to theDELTA_DISPATCH database to store and retrieve user information.
DNI-Based Authentication
Users are identified and authenticated using their DNI (Documento Nacional de Identidad) number. The API provides methods to find users by their DNI for authentication purposes.User Model
The User schema includes comprehensive fields for:- Basic Information: Name, lastname, DNI, cellphone, email
- Authentication: Username, password, role, position
- Authorization: Admin flags, root privileges, module permissions
- Profile Data: Photo, color, full name, workgroup
- Application Access: Flags for different web modules (seguridad ciudadana, catastro, rentas, inspecciones)
- Notifications: Token for push notifications
- Incidents Tracking: Arrays for true and false incidents
- Tickets: Assignment tracking for tickets
- Timestamps: Creation date, latest update, deactivation date
Common User Operations
Finding Users by DNI
The most common operation is retrieving a user by their DNI number:null if no user exists with that DNI.
User Document Structure
When a user is retrieved, you receive aUserDocument which combines the User schema with MongoDB document properties:
Database Connection
The UserService connects to MongoDB using theDELTA_DISPATCH_DB_NAME connection, which is configured through the DatabaseModule’s dynamic module pattern.
Next Steps
- UserService Reference - Detailed API documentation for UserService methods
- Database Configuration - Learn about multi-database setup