List All Apartments
Returns all apartments with their relationships including tipoApartamento, torre.proyecto, pisoTorre, estadoInmueble, and parqueaderos.Response Fields
Indicates if the request was successful
Array of apartment objects
Get Single Apartment
Retrieve detailed information about a specific apartment with all relationships.Path Parameters
The unique identifier of the apartment
Create Apartment
Create a new apartment. The system validates that:- The floor belongs to the specified tower
- The apartment number is unique within the tower
Request Body
Apartment number (max 20 characters, must be unique per tower)
Apartment type ID (must exist in tipo_apartamento table)
Tower ID (must exist in torre table)
Floor ID (must exist in piso_torre table and belong to the specified tower)
Property status ID (must exist in estado_inmueble table)
Total value (min: 0)
Update Apartment
Update an existing apartment. Same validation rules as creation.Path Parameters
The unique identifier of the apartment to update
Request Body
Same as Create Apartment endpoint.Delete Apartment
Delete an apartment. Cannot delete if the apartment has associated parking spaces.Path Parameters
The unique identifier of the apartment to delete
Change Apartment Status
Update the status of an apartment (e.g., from “Disponible” to “Vendido”).Path Parameters
The apartment ID
Request Body
New property status ID
Filter Apartments
By Tower
Also available at:
/api/torres/{id_torre}/apartamentosBy Floor
Also available at:
/api/pisos/{id_piso_torre}/apartamentosBy Status
By Type
By Project
Also available at:
/api/proyectos/{id_proyecto}/apartamentosSearch Apartments
Search apartments by number (case-insensitive).Request Body
Search term (min 1 character)
Get Apartment Summary
Get a comprehensive summary with parking breakdown.Path Parameters
The apartment ID
Get Apartment Statistics by Project
Get aggregated statistics for all apartments in a project.Path Parameters
The project ID
Get Available Apartments by Project
Retrieve all available apartments in a project (status contains “disponible”).Path Parameters
The project ID
Model Structure
Database Table: apartamentos
| Field | Type | Nullable | Description |
|---|---|---|---|
id_apartamento | Integer | No | Primary key |
numero | String(20) | No | Apartment number |
id_tipo_apartamento | Integer | No | Foreign key to tipo_apartamento |
id_torre | Integer | No | Foreign key to torre |
id_piso_torre | Integer | No | Foreign key to piso_torre |
id_estado_inmueble | Integer | No | Foreign key to estado_inmueble |
valor_total | Decimal(18,2) | Yes | Base value |
prima_altura | Decimal(18,2) | Yes | Height premium |
valor_politica | Decimal(18,2) | Yes | Policy adjustment |
valor_final | Decimal(18,2) | Yes | Final calculated price |
documento | String | Yes | Client document if sold |
Relationships
- BelongsTo:
tipoApartamento(TipoApartamento) - BelongsTo:
torre(Torre) - BelongsTo:
pisoTorre(PisoTorre) - BelongsTo:
estadoInmueble(EstadoInmueble) - BelongsTo:
cliente(Cliente) - via documento - HasMany:
parqueaderos(Parqueadero) - HasMany:
ventas(Venta)
Computed Attributes
valor_comercial: Returnsvalor_total + prima_altura + valor_politica