chore: seed sample video data, add spec 033 and update instructions
This commit is contained in:
parent
2e9f903d06
commit
e1a1f71fbd
11 changed files with 1911 additions and 2 deletions
110
specs/033-video-apresentacao-imovel/quickstart.md
Normal file
110
specs/033-video-apresentacao-imovel/quickstart.md
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
# Quickstart: Vídeo de Apresentação do Imóvel (033)
|
||||
|
||||
**Gerado por**: /speckit.plan
|
||||
**Data**: 2026-04-22
|
||||
|
||||
---
|
||||
|
||||
## Setup do Ambiente
|
||||
|
||||
```bash
|
||||
# Backend
|
||||
cd backend
|
||||
uv sync
|
||||
alembic upgrade head # aplica k3l4m5n6o7p8_add_video_to_properties
|
||||
|
||||
# Frontend
|
||||
cd frontend
|
||||
npm install # sem novas dependências nesta feature
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Rodando Localmente
|
||||
|
||||
```bash
|
||||
# Do root do projeto
|
||||
docker compose up # ou: start.ps1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testando o Fluxo Completo
|
||||
|
||||
### 1. Configurar vídeo via admin
|
||||
|
||||
```bash
|
||||
# Autenticar e obter token
|
||||
TOKEN=$(curl -s -X POST http://localhost:5000/api/admin/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email":"admin@example.com","password":"senha"}' | jq -r .access_token)
|
||||
|
||||
# Atualizar imóvel com vídeo
|
||||
curl -X PUT http://localhost:5000/api/admin/properties/<UUID> \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"video_url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","video_position":"section"}'
|
||||
```
|
||||
|
||||
### 2. Verificar retorno da API pública
|
||||
|
||||
```bash
|
||||
curl http://localhost:5000/api/properties/<SLUG> | jq '.video_url, .video_position'
|
||||
# Esperado: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" e "section"
|
||||
```
|
||||
|
||||
### 3. Verificar exibição na página
|
||||
|
||||
Abrir `http://localhost:5173/imoveis/<SLUG>` e confirmar:
|
||||
- Seção "Vídeo de Apresentação" visível abaixo do carrossel
|
||||
- Player do YouTube incorporado
|
||||
- Sem erros no console
|
||||
|
||||
### 4. Testar posição carrossel
|
||||
|
||||
```bash
|
||||
curl -X PUT http://localhost:5000/api/admin/properties/<UUID> \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"video_position":"carousel"}'
|
||||
```
|
||||
|
||||
Recarregar a página: vídeo deve aparecer como primeiro slide no carrossel.
|
||||
|
||||
### 5. Remover vídeo
|
||||
|
||||
```bash
|
||||
curl -X PUT http://localhost:5000/api/admin/properties/<UUID> \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"video_url":""}'
|
||||
```
|
||||
|
||||
Confirmar que `video_url` retorna `null` na API pública e a seção de vídeo desaparece.
|
||||
|
||||
---
|
||||
|
||||
## Rodando os Testes
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
pytest tests/ -v -k "video" # testes específicos da feature (quando criados)
|
||||
pytest tests/ -v # suite completa
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Arquivos Criados/Modificados
|
||||
|
||||
| Arquivo | Ação |
|
||||
|---------|------|
|
||||
| `backend/migrations/versions/k3l4m5n6o7p8_add_video_to_properties.py` | NOVO |
|
||||
| `backend/app/models/property.py` | MODIFICADO — 2 campos novos |
|
||||
| `backend/app/schemas/property.py` | MODIFICADO — `PropertyDetailOut` |
|
||||
| `backend/app/routes/admin.py` | MODIFICADO — `PropertyAdminOut`, `_SCALAR_FIELDS`, sanitização |
|
||||
| `frontend/src/utils/getEmbedUrl.ts` | NOVO |
|
||||
| `frontend/src/components/PropertyDetail/VideoPlayer.tsx` | NOVO |
|
||||
| `frontend/src/components/PropertyDetail/PhotoCarousel.tsx` | MODIFICADO — prop `videoUrl` |
|
||||
| `frontend/src/pages/PropertyDetailPage.tsx` | MODIFICADO — renderização condicional |
|
||||
| `frontend/src/pages/admin/PropertyForm.tsx` | MODIFICADO — campo URL + select posição + preview |
|
||||
| `frontend/src/types/property.ts` | MODIFICADO — `PropertyDetail` |
|
||||
Loading…
Add table
Add a link
Reference in a new issue