Overview
Trazea supports multi-location operations, allowing you to manage inventory, technicians, and operations across different workshop locations. Users can be assigned to one or more locations, and the system tracks which location they’re currently working from.Location Architecture
Database Schema
The multi-location system uses three key tables:localizacion Table
Stores location information:src/entities/locations/api/index.ts:5-7
| Field | Type | Description |
|---|---|---|
id_localizacion | uuid | Primary key |
nombre | text | Location name (e.g., “Main Workshop”, “Branch Office”) |
telefono | text | Contact phone number |
usuarios_localizacion Table
This is the junction table that creates the many-to-many relationship between users and locations.
src/shared/api/fetchUserSessionData.ts:26-29
| Field | Type | Description |
|---|---|---|
id_usuario | uuid | Foreign key to usuarios table |
id_localizacion | uuid | Foreign key to localizacion table |
UserLocation Interface
src/entities/user/model/types.ts:1-4
Location Assignment
Assigning Locations to Users
Multiple Location Assignment
Users can be assigned to multiple locations:- They can switch between locations during their session
- Inventory and operations are filtered by the currently selected location
- The system tracks their current location choice
Current Location Management
User Store Implementation
The system maintains the current location in the user store:src/entities/user/model/useUserStore.ts:84-90
Setting Current Location
Persisting Location Choice
The current location is persisted to localStorage:src/entities/user/model/useUserStore.ts:174-179
Location-Filtered Queries
Inventory by Location
Inventory operations automatically filter by current location:src/entities/inventario/api/index.ts:22-25
src/entities/inventario/api/index.ts:42
Movements by Location
src/entities/movimientos/api/index.ts:16-21
Technicians by Location
src/entities/technical/api/index.ts:4-8
Permission-Based Location Access
View All Locations
Some roles may have permission to view data across all locations:src/entities/user/model/useUserStore.ts:36-38
Users with
inventory.view_all_locations = true can see inventory across all locations, regardless of their assigned locations.Location-Restricted Access
Users withview_assigned_location_only = true will only see:
- Inventory at their assigned locations
- Movements within their locations
- Technicians working at their locations
- Requests between their locations
Setting Up a New Location
Multi-Location Features
Transfer Orders
Create transfer orders to move inventory between locations using the requests system.
Location-Specific Inventory
Track stock levels, positions, and minimum quantities per location.
Location Reports
Generate reports filtered by location for performance analysis.
Cross-Location Visibility
Administrators can view and manage data across all locations.
Best Practices
User Assignment Strategy
User Assignment Strategy
- Assign users to their primary location by default
- Add additional locations only when users need regular access
- Mobile technicians may need access to multiple locations
- Administrative staff typically need access to all locations
Location Naming
Location Naming
- Use clear, descriptive location names
- Include geographic identifiers if helpful (“North Branch”, “Downtown Shop”)
- Keep names concise for better UI display
- Maintain consistent naming conventions
Data Isolation
Data Isolation
- Most queries automatically filter by current location
- Verify location filtering in custom queries
- Test multi-location scenarios thoroughly
- Use views like
v_tecnicos_por_localizacionfor location-aware data
Related Topics
User Management
Learn about user registration, approval, and role assignment
Permissions & Roles
Configure location-based permissions in role definitions