List All Commercial Spaces
Returns all commercial spaces with their relationships including estadoInmueble, torre.proyecto, and pisoTorre.Response Fields
Indicates if the request was successful
Array of commercial space objects
Get Single Commercial Space
Retrieve detailed information about a specific commercial space with all relationships.Path Parameters
The unique identifier of the commercial space
Create Commercial Space
Create a new commercial space. The system validates that:- The floor belongs to the specified tower
- The space number is unique within the tower
Request Body
Space number (max 20 characters, must be unique per tower)
Property status ID (must exist in estado_inmueble table)
Total area in square meters (min: 0, max: 99999999.99)
Tower ID (must exist in torre table)
Floor ID (must exist in piso_torre table and belong to the specified tower)
Total value (min: 0, max: 999999999.99)
Update Commercial Space
Update an existing commercial space. Same validation rules as creation.Path Parameters
The unique identifier of the commercial space to update
Request Body
Same as Create Commercial Space endpoint.Delete Commercial Space
Delete a commercial space.Path Parameters
The unique identifier of the commercial space to delete
Change Commercial Space Status
Update the status of a commercial space.Path Parameters
The commercial space ID
Request Body
New property status ID
Filter Commercial Spaces
By Tower
Also available at:
/api/torres/{id_torre}/localesBy Floor
Also available at:
/api/pisos/{id_piso_torre}/localesBy Status
By Project
Also available at:
/api/proyectos/{id_proyecto}/localesSearch Commercial Spaces
Search commercial spaces by number (case-insensitive).Query Parameters
Search term (min 1 character)
Filter by Area Range
Find commercial spaces within a specific area range.Query Parameters
Minimum area in square meters (min: 0)
Maximum area in square meters (must be >= area_min)
Get Commercial Space Summary
Get a comprehensive summary of a commercial space.Path Parameters
The commercial space ID
Get Commercial Space Statistics by Project
Also available at:
/api/proyectos/{id_proyecto}/locales/estadisticasPath Parameters
The project ID
Get Available Commercial Spaces by Project
Also available at:
/api/proyectos/{id_proyecto}/locales/disponiblesPath Parameters
The project ID
Model Structure
Database Table: locales
| Field | Type | Nullable | Description |
|---|---|---|---|
id_local | Integer | No | Primary key |
numero | String(20) | No | Space number |
id_estado_inmueble | Integer | No | Foreign key to estado_inmueble |
area_total_local | Decimal(10,2) | Yes | Total area in m² |
id_torre | Integer | No | Foreign key to torre |
id_piso_torre | Integer | No | Foreign key to piso_torre |
valor_m2 | Decimal(18,2) | Yes | Price per square meter |
valor_total | Decimal(18,2) | Yes | Total value |
Relationships
- BelongsTo:
estadoInmueble(EstadoInmueble) - BelongsTo:
torre(Torre) - BelongsTo:
pisoTorre(PisoTorre) - HasMany:
ventas(Venta)
Computed Attributes
valor_comercial: Returnsvalor_total
Business Rules
The
area_total_local field is critical for commercial spaces as pricing often depends on square meters. Many queries and reports aggregate by area.