134 lines
2.2 KiB
Markdown
134 lines
2.2 KiB
Markdown
# Contract: GET /api/v1/me/favorites
|
|
|
|
**Blueprint**: `client_bp`
|
|
**Auth**: JWT Bearer — `require_auth` — ClientUser only
|
|
|
|
---
|
|
|
|
## Request
|
|
|
|
```
|
|
GET /api/v1/me/favorites
|
|
Authorization: Bearer <jwt_token>
|
|
```
|
|
|
|
Sem parâmetros de query ou corpo.
|
|
|
|
---
|
|
|
|
## Response 200 OK
|
|
|
|
```json
|
|
[
|
|
{
|
|
"property": {
|
|
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
|
"title": "Apartamento 3 quartos Jardins",
|
|
"slug": "apartamento-3-quartos-jardins",
|
|
"price": "850000.00",
|
|
"condo_fee": "1200.00",
|
|
"type": "venda",
|
|
"subtype": { "id": 1, "name": "Apartamento" },
|
|
"bedrooms": 3,
|
|
"bathrooms": 2,
|
|
"parking_spots": 2,
|
|
"area_m2": 120,
|
|
"city": { "id": 1, "name": "São Paulo" },
|
|
"neighborhood": { "id": 5, "name": "Jardins" },
|
|
"is_featured": true,
|
|
"photos": [
|
|
{ "url": "https://...", "alt_text": "", "display_order": 0 }
|
|
],
|
|
"amenities": [{ "id": 1, "name": "Piscina" }],
|
|
"address": "Rua das Flores, 100",
|
|
"code": "AP001",
|
|
"description": "Apartamento espaçoso com varanda gourmet."
|
|
},
|
|
"created_at": "2026-04-13T10:00:00Z"
|
|
}
|
|
]
|
|
```
|
|
|
|
Lista vazia `[]` quando o cliente não possui favoritos.
|
|
|
|
---
|
|
|
|
## Response 401 Unauthorized
|
|
|
|
```json
|
|
{ "error": "Token inválido ou ausente" }
|
|
```
|
|
|
|
---
|
|
|
|
# Contract: POST /api/v1/me/favorites
|
|
|
|
## Request
|
|
|
|
```
|
|
POST /api/v1/me/favorites
|
|
Authorization: Bearer <jwt_token>
|
|
Content-Type: application/json
|
|
|
|
{ "property_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
|
|
```
|
|
|
|
---
|
|
|
|
## Response 201 Created
|
|
|
|
```json
|
|
{
|
|
"property": { /* PropertyDetailOut completo */ },
|
|
"created_at": "2026-04-13T10:00:00Z"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Response 409 Conflict
|
|
|
|
```json
|
|
{ "error": "Imóvel já está nos favoritos" }
|
|
```
|
|
|
|
---
|
|
|
|
## Response 404 Not Found
|
|
|
|
```json
|
|
{ "error": "Imóvel não encontrado" }
|
|
```
|
|
|
|
---
|
|
|
|
## Response 422 Unprocessable Entity
|
|
|
|
```json
|
|
{ "error": "Dados inválidos", "details": ["property_id: field required"] }
|
|
```
|
|
|
|
---
|
|
|
|
# Contract: DELETE /api/v1/me/favorites/<property_id>
|
|
|
|
## Request
|
|
|
|
```
|
|
DELETE /api/v1/me/favorites/3fa85f64-5717-4562-b3fc-2c963f66afa6
|
|
Authorization: Bearer <jwt_token>
|
|
```
|
|
|
|
---
|
|
|
|
## Response 204 No Content
|
|
|
|
Sem corpo.
|
|
|
|
---
|
|
|
|
## Response 404 Not Found
|
|
|
|
```json
|
|
{ "error": "Favorito não encontrado" }
|
|
```
|